{"abstract":"The conventional cost ratio shifts whenever a markdown is reversed, even though markdowns are excluded from that ratio.","category":"Inventory cost layering","checks":7,"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}.","evaluation_group":"w2-inventory-cost-layering-retail-method","failed_approach":"Dropping markdown cancellations altogether leaves ending retail understated by the reversed markdowns.","family":"w2-inventory-cost-layering-retail-method-markdown-cancellation-treatment","id":"FA-60026","implementations":{"attempt":{"sha256":"6277e5b6833a38d43e909fbffa05d6ee54e4ca1096ac057670e1bff2fcf4ad49","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']\n    retail_pool = x['begin_retail'] + x['purch_retail'] - x['returns_retail'] + x['markups'] - x['markup_cancel']\n    net_md = x['markdowns']\n    denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md\n    ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']\n    ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)\n    ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)\n    return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['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}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"broken":{"sha256":"2755a70edd27afbab26decfad71d262924e6f85b9d6017b9ac7f000f40a0fbbe","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']\n    retail_pool = x['begin_retail'] + x['purch_retail'] - x['returns_retail'] + x['markups'] - x['markup_cancel'] + x['markdown_cancel']\n    net_md = x['markdowns']\n    denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md\n    ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']\n    ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)\n    ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)\n    return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['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}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"},"fixed":{"sha256":"6b36780c7110caf65b55d4eec6565ef01ff7f6ae54b4d5799bd9c8adc472f3e1","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(x):\n    cost_pool = x['begin_cost'] + x['purch_cost'] + x['freight_in'] - x['returns_cost']\n    retail_pool = x['begin_retail'] + x['purch_retail'] - x['returns_retail'] + x['markups'] - x['markup_cancel']\n    net_md = x['markdowns'] - x['markdown_cancel']\n    denom = retail_pool if x['method'] == 'conventional' else retail_pool - net_md\n    ending_retail = retail_pool - net_md - x['sales'] - x['employee_discounts']\n    ratio_bp = (2 * cost_pool * 10000 + denom) // (2 * denom)\n    ending_cost = (2 * ending_retail * cost_pool + denom) // (2 * denom)\n    return {'ratio_bp': ratio_bp, 'ending_retail': ending_retail, 'ending_cost': ending_cost}\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['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}]]]\nfor label, args, expected in fixtures[N-1]:\n    check(label, solve(args), expected)\nprint(json.dumps({\"observations\": observations, \"passed\": all(x[\"passed\"] for x in observations)}, ensure_ascii=False))\nraise SystemExit(0 if all(x[\"passed\"] for x in observations) else 1)\n"}},"limitations":"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.","method":"Deterministic executable model with adversarial boundary fixtures.","provenance":{"created_by":"Failure Map","dependencies":"Python standard library","family":"w2-inventory-cost-layering-retail-method-markdown-cancellation-treatment","generated_at":"2026-09-29T14:46:41.759732+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Inventory valuation and cost-of-goods decisions depend on this rule.","repair":"Net markdowns = markdowns - markdown cancellations; keep cancellations out of the markup line.","root_cause":"Markdown cancellations are booked as extra markups in the retail pool instead of being netted against markdowns.","sha256":"2f377c8326dbe9ef9ebbf06f99b102ea81c2f447b94b55d1cb6ed8c66d3a0d8a","title":"Retail inventory method estimate: markdown cancellation treatment · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":40.692,"exit_code":1,"observations":[{"actual":{"ending_cost":9436,"ending_retail":16090,"ratio_bp":5864},"check":"conventional","expected":{"ending_cost":9670,"ending_retail":16490,"ratio_bp":5864},"passed":false},{"actual":{"ending_cost":9918,"ending_retail":16090,"ratio_bp":6164},"check":"cost method","expected":{"ending_cost":10096,"ending_retail":16490,"ratio_bp":6122},"passed":false},{"actual":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"check":"no markdowns","expected":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"passed":true},{"actual":{"ending_cost":5962,"ending_retail":9689,"ratio_bp":6154},"check":"heavy returns","expected":{"ending_cost":6161,"ending_retail":10089,"ratio_bp":6107},"passed":false},{"actual":{"ending_cost":9577,"ending_retail":16890,"ratio_bp":5670},"check":"no freight","expected":{"ending_cost":9804,"ending_retail":17290,"ratio_bp":5670},"passed":false},{"actual":{"ending_cost":7826,"ending_retail":12591,"ratio_bp":6216},"check":"markup cancel","expected":{"ending_cost":8075,"ending_retail":12991,"ratio_bp":6216},"passed":false},{"actual":{"ending_cost":8561,"ending_retail":13889,"ratio_bp":6164},"check":"discounts heavy","expected":{"ending_cost":8748,"ending_retail":14289,"ratio_bp":6122},"passed":false}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"conventional\", \"actual\": {\"ratio_bp\": 5864, \"ending_retail\": 16090, \"ending_cost\": 9436}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 16490, \"ending_cost\": 9670}, \"passed\": false}, {\"check\": \"cost method\", \"actual\": {\"ratio_bp\": 6164, \"ending_retail\": 16090, \"ending_cost\": 9918}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 16490, \"ending_cost\": 10096}, \"passed\": false}, {\"check\": \"no markdowns\", \"actual\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"passed\": true}, {\"check\": \"heavy returns\", \"actual\": {\"ratio_bp\": 6154, \"ending_retail\": 9689, \"ending_cost\": 5962}, \"expected\": {\"ratio_bp\": 6107, \"ending_retail\": 10089, \"ending_cost\": 6161}, \"passed\": false}, {\"check\": \"no freight\", \"actual\": {\"ratio_bp\": 5670, \"ending_retail\": 16890, \"ending_cost\": 9577}, \"expected\": {\"ratio_bp\": 5670, \"ending_retail\": 17290, \"ending_cost\": 9804}, \"passed\": false}, {\"check\": \"markup cancel\", \"actual\": {\"ratio_bp\": 6216, \"ending_retail\": 12591, \"ending_cost\": 7826}, \"expected\": {\"ratio_bp\": 6216, \"ending_retail\": 12991, \"ending_cost\": 8075}, \"passed\": false}, {\"check\": \"discounts heavy\", \"actual\": {\"ratio_bp\": 6164, \"ending_retail\": 13889, \"ending_cost\": 8561}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 14289, \"ending_cost\": 8748}, \"passed\": false}], \"passed\": false}\n"},"broken":{"elapsed_ms":38.714,"exit_code":1,"observations":[{"actual":{"ending_cost":9608,"ending_retail":16490,"ratio_bp":5827},"check":"conventional","expected":{"ending_cost":9670,"ending_retail":16490,"ratio_bp":5864},"passed":false},{"actual":{"ending_cost":10096,"ending_retail":16490,"ratio_bp":6122},"check":"cost method","expected":{"ending_cost":10096,"ending_retail":16490,"ratio_bp":6122},"passed":true},{"actual":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"check":"no markdowns","expected":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"passed":true},{"actual":{"ending_cost":6161,"ending_retail":10089,"ratio_bp":6107},"check":"heavy returns","expected":{"ending_cost":6161,"ending_retail":10089,"ratio_bp":6107},"passed":true},{"actual":{"ending_cost":9741,"ending_retail":17290,"ratio_bp":5634},"check":"no freight","expected":{"ending_cost":9804,"ending_retail":17290,"ratio_bp":5670},"passed":false},{"actual":{"ending_cost":8020,"ending_retail":12991,"ratio_bp":6173},"check":"markup cancel","expected":{"ending_cost":8075,"ending_retail":12991,"ratio_bp":6216},"passed":false},{"actual":{"ending_cost":8748,"ending_retail":14289,"ratio_bp":6122},"check":"discounts heavy","expected":{"ending_cost":8748,"ending_retail":14289,"ratio_bp":6122},"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"conventional\", \"actual\": {\"ratio_bp\": 5827, \"ending_retail\": 16490, \"ending_cost\": 9608}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 16490, \"ending_cost\": 9670}, \"passed\": false}, {\"check\": \"cost method\", \"actual\": {\"ratio_bp\": 6122, \"ending_retail\": 16490, \"ending_cost\": 10096}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 16490, \"ending_cost\": 10096}, \"passed\": true}, {\"check\": \"no markdowns\", \"actual\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"passed\": true}, {\"check\": \"heavy returns\", \"actual\": {\"ratio_bp\": 6107, \"ending_retail\": 10089, \"ending_cost\": 6161}, \"expected\": {\"ratio_bp\": 6107, \"ending_retail\": 10089, \"ending_cost\": 6161}, \"passed\": true}, {\"check\": \"no freight\", \"actual\": {\"ratio_bp\": 5634, \"ending_retail\": 17290, \"ending_cost\": 9741}, \"expected\": {\"ratio_bp\": 5670, \"ending_retail\": 17290, \"ending_cost\": 9804}, \"passed\": false}, {\"check\": \"markup cancel\", \"actual\": {\"ratio_bp\": 6173, \"ending_retail\": 12991, \"ending_cost\": 8020}, \"expected\": {\"ratio_bp\": 6216, \"ending_retail\": 12991, \"ending_cost\": 8075}, \"passed\": false}, {\"check\": \"discounts heavy\", \"actual\": {\"ratio_bp\": 6122, \"ending_retail\": 14289, \"ending_cost\": 8748}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 14289, \"ending_cost\": 8748}, \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":42.55,"exit_code":0,"observations":[{"actual":{"ending_cost":9670,"ending_retail":16490,"ratio_bp":5864},"check":"conventional","expected":{"ending_cost":9670,"ending_retail":16490,"ratio_bp":5864},"passed":true},{"actual":{"ending_cost":10096,"ending_retail":16490,"ratio_bp":6122},"check":"cost method","expected":{"ending_cost":10096,"ending_retail":16490,"ratio_bp":6122},"passed":true},{"actual":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"check":"no markdowns","expected":{"ending_cost":12373,"ending_retail":21099,"ratio_bp":5864},"passed":true},{"actual":{"ending_cost":6161,"ending_retail":10089,"ratio_bp":6107},"check":"heavy returns","expected":{"ending_cost":6161,"ending_retail":10089,"ratio_bp":6107},"passed":true},{"actual":{"ending_cost":9804,"ending_retail":17290,"ratio_bp":5670},"check":"no freight","expected":{"ending_cost":9804,"ending_retail":17290,"ratio_bp":5670},"passed":true},{"actual":{"ending_cost":8075,"ending_retail":12991,"ratio_bp":6216},"check":"markup cancel","expected":{"ending_cost":8075,"ending_retail":12991,"ratio_bp":6216},"passed":true},{"actual":{"ending_cost":8748,"ending_retail":14289,"ratio_bp":6122},"check":"discounts heavy","expected":{"ending_cost":8748,"ending_retail":14289,"ratio_bp":6122},"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"conventional\", \"actual\": {\"ratio_bp\": 5864, \"ending_retail\": 16490, \"ending_cost\": 9670}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 16490, \"ending_cost\": 9670}, \"passed\": true}, {\"check\": \"cost method\", \"actual\": {\"ratio_bp\": 6122, \"ending_retail\": 16490, \"ending_cost\": 10096}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 16490, \"ending_cost\": 10096}, \"passed\": true}, {\"check\": \"no markdowns\", \"actual\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"expected\": {\"ratio_bp\": 5864, \"ending_retail\": 21099, \"ending_cost\": 12373}, \"passed\": true}, {\"check\": \"heavy returns\", \"actual\": {\"ratio_bp\": 6107, \"ending_retail\": 10089, \"ending_cost\": 6161}, \"expected\": {\"ratio_bp\": 6107, \"ending_retail\": 10089, \"ending_cost\": 6161}, \"passed\": true}, {\"check\": \"no freight\", \"actual\": {\"ratio_bp\": 5670, \"ending_retail\": 17290, \"ending_cost\": 9804}, \"expected\": {\"ratio_bp\": 5670, \"ending_retail\": 17290, \"ending_cost\": 9804}, \"passed\": true}, {\"check\": \"markup cancel\", \"actual\": {\"ratio_bp\": 6216, \"ending_retail\": 12991, \"ending_cost\": 8075}, \"expected\": {\"ratio_bp\": 6216, \"ending_retail\": 12991, \"ending_cost\": 8075}, \"passed\": true}, {\"check\": \"discounts heavy\", \"actual\": {\"ratio_bp\": 6122, \"ending_retail\": 14289, \"ending_cost\": 8748}, \"expected\": {\"ratio_bp\": 6122, \"ending_retail\": 14289, \"ending_cost\": 8748}, \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}