FA-60001 / Inventory cost layering / Open access
Retail inventory method estimate: purchase return sign at retail · case 01
Returning goods to the vendor inflates the retail pool.
ROOT CAUSE
Purchase returns are added to retail instead of deducted.
VERIFIED REPAIR
Deduct purchase returns at retail.
Unsuccessful approach: Ignoring returns at retail entirely still overstates the retail pool.
Case contract
Input totals for a period. Cost pool = begin_cost + purch_cost + freight_in - returns_cost. Retail pool = begin_retail + purch_retail - returns_retail + markups - markup_cancel. Net markdowns = markdowns - markdown_cancel. The conventional (LCM) ratio uses the retail pool before markdowns; the cost method ratio deducts net markdowns. Ending retail = retail pool - net markdowns - sales - employee_discounts. Ending cost = round-half-up(ending retail * cost pool / ratio denominator). Return {ratio_bp (rounded half up), ending_retail, ending_cost}.
Why this case matters
Inventory valuation and cost-of-goods decisions depend on this rule.
1 / The failure
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']
retail_pool = x['begin_retail'] + x['purch_retail'] + x['returns_retail'] + x['markups'] - x['markup_cancel']
net_md = x['markdowns'] - x['markdown_cancel']
denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md
ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']
ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)
ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)
return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 16490, 'ending_cost': 9670}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 16490, 'ending_cost': 10096}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40001, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 21099, 'ending_cost': 12373}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8001, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6107, 'ending_retail': 10089, 'ending_cost': 6161}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5670, 'ending_retail': 17290, 'ending_cost': 9804}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1999, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6216, 'ending_retail': 12991, 'ending_cost': 8075}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3001, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 14289, 'ending_cost': 8748}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 16480, 'ending_cost': 9691}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 16480, 'ending_cost': 10119}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40002, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 21098, 'ending_cost': 12407}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8002, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6127, 'ending_retail': 10078, 'ending_cost': 6175}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5687, 'ending_retail': 17280, 'ending_cost': 9826}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1998, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6233, 'ending_retail': 12982, 'ending_cost': 8091}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3002, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 14278, 'ending_cost': 8767}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 16470, 'ending_cost': 9712}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 16470, 'ending_cost': 10143}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40003, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 21097, 'ending_cost': 12440}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8003, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6148, 'ending_retail': 10067, 'ending_cost': 6189}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5703, 'ending_retail': 17270, 'ending_cost': 9849}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1997, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6250, 'ending_retail': 12973, 'ending_cost': 8108}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3003, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 14267, 'ending_cost': 8786}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 16460, 'ending_cost': 9732}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 16460, 'ending_cost': 10166}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40004, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 21096, 'ending_cost': 12474}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8004, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6168, 'ending_retail': 10056, 'ending_cost': 6202}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5719, 'ending_retail': 17260, 'ending_cost': 9871}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1996, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6267, 'ending_retail': 12964, 'ending_cost': 8124}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3004, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 14256, 'ending_cost': 8805}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 16450, 'ending_cost': 9753}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 16450, 'ending_cost': 10189}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40005, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 21095, 'ending_cost': 12507}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8005, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6188, 'ending_retail': 10045, 'ending_cost': 6216}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5735, 'ending_retail': 17250, 'ending_cost': 9893}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1995, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6284, 'ending_retail': 12955, 'ending_cost': 8141}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3005, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 14245, 'ending_cost': 8823}]]]
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 |
|---|---|---|---|
| conventional | {'ending_cost': 10979, 'ending_retail': 19690, 'ratio_bp': 5576} | {'ending_cost': 9670, 'ending_retail': 16490, 'ratio_bp': 5864} | Failed |
| cost method | {'ending_cost': 11438, 'ending_retail': 19690, 'ratio_bp': 5809} | {'ending_cost': 10096, 'ending_retail': 16490, 'ratio_bp': 6122} | Failed |
| no markdowns | {'ending_cost': 13549, 'ending_retail': 24299, 'ratio_bp': 5576} | {'ending_cost': 12373, 'ending_retail': 21099, 'ratio_bp': 5864} | Failed |
| heavy returns | {'ending_cost': 12233, 'ending_retail': 26091, 'ratio_bp': 4689} | {'ending_cost': 6161, 'ending_retail': 10089, 'ratio_bp': 6107} | Failed |
| no freight | {'ending_cost': 11048, 'ending_retail': 20490, 'ratio_bp': 5392} | {'ending_cost': 9804, 'ending_retail': 17290, 'ratio_bp': 5670} | Failed |
| markup cancel | {'ending_cost': 9541, 'ending_retail': 16191, 'ratio_bp': 5893} | {'ending_cost': 8075, 'ending_retail': 12991, 'ratio_bp': 6216} | Failed |
| discounts heavy | {'ending_cost': 10159, 'ending_retail': 17489, 'ratio_bp': 5809} | {'ending_cost': 8748, 'ending_retail': 14289, 'ratio_bp': 6122} | Failed |
SHA-256 / c0af2fc881d664f817b1f60f5dffb7e7b9bca565dd6403e60d2382dce8380b67
2 / The unsuccessful fix
Exit 1"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']
retail_pool = x['begin_retail'] + x['purch_retail'] + x['markups'] - x['markup_cancel']
net_md = x['markdowns'] - x['markdown_cancel']
denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md
ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']
ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)
ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)
return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 16490, 'ending_cost': 9670}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 16490, 'ending_cost': 10096}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40001, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 21099, 'ending_cost': 12373}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8001, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6107, 'ending_retail': 10089, 'ending_cost': 6161}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5670, 'ending_retail': 17290, 'ending_cost': 9804}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1999, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6216, 'ending_retail': 12991, 'ending_cost': 8075}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3001, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 14289, 'ending_cost': 8748}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 16480, 'ending_cost': 9691}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 16480, 'ending_cost': 10119}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40002, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 21098, 'ending_cost': 12407}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8002, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6127, 'ending_retail': 10078, 'ending_cost': 6175}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5687, 'ending_retail': 17280, 'ending_cost': 9826}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1998, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6233, 'ending_retail': 12982, 'ending_cost': 8091}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3002, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 14278, 'ending_cost': 8767}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 16470, 'ending_cost': 9712}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 16470, 'ending_cost': 10143}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40003, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 21097, 'ending_cost': 12440}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8003, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6148, 'ending_retail': 10067, 'ending_cost': 6189}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5703, 'ending_retail': 17270, 'ending_cost': 9849}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1997, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6250, 'ending_retail': 12973, 'ending_cost': 8108}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3003, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 14267, 'ending_cost': 8786}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 16460, 'ending_cost': 9732}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 16460, 'ending_cost': 10166}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40004, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 21096, 'ending_cost': 12474}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8004, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6168, 'ending_retail': 10056, 'ending_cost': 6202}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5719, 'ending_retail': 17260, 'ending_cost': 9871}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1996, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6267, 'ending_retail': 12964, 'ending_cost': 8124}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3004, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 14256, 'ending_cost': 8805}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 16450, 'ending_cost': 9753}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 16450, 'ending_cost': 10189}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40005, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 21095, 'ending_cost': 12507}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8005, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6188, 'ending_retail': 10045, 'ending_cost': 6216}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5735, 'ending_retail': 17250, 'ending_cost': 9893}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1995, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6284, 'ending_retail': 12955, 'ending_cost': 8141}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3005, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 14245, 'ending_cost': 8823}]]]
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 |
|---|---|---|---|
| conventional | {'ending_cost': 10341, 'ending_retail': 18090, 'ratio_bp': 5717} | {'ending_cost': 9670, 'ending_retail': 16490, 'ratio_bp': 5864} | Failed |
| cost method | {'ending_cost': 10784, 'ending_retail': 18090, 'ratio_bp': 5962} | {'ending_cost': 10096, 'ending_retail': 16490, 'ratio_bp': 6122} | Failed |
| no markdowns | {'ending_cost': 12976, 'ending_retail': 22699, 'ratio_bp': 5717} | {'ending_cost': 12373, 'ending_retail': 21099, 'ratio_bp': 5864} | Failed |
| heavy returns | {'ending_cost': 9596, 'ending_retail': 18090, 'ratio_bp': 5305} | {'ending_cost': 6161, 'ending_retail': 10089, 'ratio_bp': 6107} | Failed |
| no freight | {'ending_cost': 10442, 'ending_retail': 18890, 'ratio_bp': 5528} | {'ending_cost': 9804, 'ending_retail': 17290, 'ratio_bp': 5670} | Failed |
| markup cancel | {'ending_cost': 8827, 'ending_retail': 14591, 'ratio_bp': 6050} | {'ending_cost': 8075, 'ending_retail': 12991, 'ratio_bp': 6216} | Failed |
| discounts heavy | {'ending_cost': 9472, 'ending_retail': 15889, 'ratio_bp': 5962} | {'ending_cost': 8748, 'ending_retail': 14289, 'ratio_bp': 6122} | Failed |
SHA-256 / 0dba9713dcf1eec1003fec63f50d6c27c565330b7caa4ddf91eb992051b85067
3 / The verified repair
Exit 0"""Failure Map reference implementation. Python standard library only."""
import json
N = 1
observations = []
def solve(x):
cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']
retail_pool = x['begin_retail'] + x['purch_retail'] - x['returns_retail'] + x['markups'] - x['markup_cancel']
net_md = x['markdowns'] - x['markdown_cancel']
denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md
ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']
ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)
ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)
return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}
def check(label, actual, expected):
observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 16490, 'ending_cost': 9670}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 16490, 'ending_cost': 10096}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40001, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5864, 'ending_retail': 21099, 'ending_cost': 12373}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8001, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6107, 'ending_retail': 10089, 'ending_cost': 6161}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5670, 'ending_retail': 17290, 'ending_cost': 9804}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1999, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6216, 'ending_retail': 12991, 'ending_cost': 8075}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30100, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3010, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3001, 'method': 'cost'}, {'ratio_bp': 6122, 'ending_retail': 14289, 'ending_cost': 8748}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 16480, 'ending_cost': 9691}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 16480, 'ending_cost': 10119}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40002, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5880, 'ending_retail': 21098, 'ending_cost': 12407}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8002, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6127, 'ending_retail': 10078, 'ending_cost': 6175}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5687, 'ending_retail': 17280, 'ending_cost': 9826}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1998, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6233, 'ending_retail': 12982, 'ending_cost': 8091}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30200, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3020, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3002, 'method': 'cost'}, {'ratio_bp': 6140, 'ending_retail': 14278, 'ending_cost': 8767}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 16470, 'ending_cost': 9712}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 16470, 'ending_cost': 10143}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40003, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5897, 'ending_retail': 21097, 'ending_cost': 12440}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8003, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6148, 'ending_retail': 10067, 'ending_cost': 6189}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5703, 'ending_retail': 17270, 'ending_cost': 9849}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1997, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6250, 'ending_retail': 12973, 'ending_cost': 8108}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30300, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3030, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3003, 'method': 'cost'}, {'ratio_bp': 6158, 'ending_retail': 14267, 'ending_cost': 8786}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 16460, 'ending_cost': 9732}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 16460, 'ending_cost': 10166}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40004, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5913, 'ending_retail': 21096, 'ending_cost': 12474}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8004, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6168, 'ending_retail': 10056, 'ending_cost': 6202}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5719, 'ending_retail': 17260, 'ending_cost': 9871}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1996, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6267, 'ending_retail': 12964, 'ending_cost': 8124}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30400, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3040, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3004, 'method': 'cost'}, {'ratio_bp': 6176, 'ending_retail': 14256, 'ending_cost': 8805}]], [['conventional', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 16450, 'ending_cost': 9753}], ['cost method', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 16450, 'ending_cost': 10189}], ['no markdowns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 0, 'markdown_cancel': 0, 'sales': 40005, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 5929, 'ending_retail': 21095, 'ending_cost': 12507}], ['heavy returns', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 5000, 'returns_retail': 8005, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'cost'}, {'ratio_bp': 6188, 'ending_retail': 10045, 'ending_cost': 6216}], ['no freight', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 0, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 0, 'method': 'conventional'}, {'ratio_bp': 5735, 'ending_retail': 17250, 'ending_cost': 9893}], ['markup cancel', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 2000, 'markup_cancel': 1995, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 800, 'method': 'conventional'}, {'ratio_bp': 6284, 'ending_retail': 12955, 'ending_cost': 8141}], ['discounts heavy', {'begin_cost': 6000, 'begin_retail': 10000, 'purch_cost': 30500, 'purch_retail': 50000, 'freight_in': 1200, 'returns_cost': 1000, 'returns_retail': 1600, 'markups': 4000, 'markup_cancel': 500, 'markdowns': 3050, 'markdown_cancel': 400, 'sales': 42000, 'employee_discounts': 3005, 'method': 'cost'}, {'ratio_bp': 6194, 'ending_retail': 14245, 'ending_cost': 8823}]]]
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 |
|---|---|---|---|
| conventional | {'ending_cost': 9670, 'ending_retail': 16490, 'ratio_bp': 5864} | {'ending_cost': 9670, 'ending_retail': 16490, 'ratio_bp': 5864} | Passed |
| cost method | {'ending_cost': 10096, 'ending_retail': 16490, 'ratio_bp': 6122} | {'ending_cost': 10096, 'ending_retail': 16490, 'ratio_bp': 6122} | Passed |
| no markdowns | {'ending_cost': 12373, 'ending_retail': 21099, 'ratio_bp': 5864} | {'ending_cost': 12373, 'ending_retail': 21099, 'ratio_bp': 5864} | Passed |
| heavy returns | {'ending_cost': 6161, 'ending_retail': 10089, 'ratio_bp': 6107} | {'ending_cost': 6161, 'ending_retail': 10089, 'ratio_bp': 6107} | Passed |
| no freight | {'ending_cost': 9804, 'ending_retail': 17290, 'ratio_bp': 5670} | {'ending_cost': 9804, 'ending_retail': 17290, 'ratio_bp': 5670} | Passed |
| markup cancel | {'ending_cost': 8075, 'ending_retail': 12991, 'ratio_bp': 6216} | {'ending_cost': 8075, 'ending_retail': 12991, 'ratio_bp': 6216} | Passed |
| discounts heavy | {'ending_cost': 8748, 'ending_retail': 14289, 'ratio_bp': 6122} | {'ending_cost': 8748, 'ending_retail': 14289, 'ratio_bp': 6122} | Passed |
SHA-256 / 6b36780c7110caf65b55d4eec6565ef01ff7f6ae54b4d5799bd9c8adc472f3e1
Verification & scope
Stipulated bounded teaching model with explicit toy rules; not an accounting-standard implementation. 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:46:41.512061+00:00.
Case digest / 2bdff684ac58ee4470466dcf926800079059166fa39841e26b3c7cfa35c2e498