{"abstract":"Accounts closest to deserving another contract are skipped.","category":"Options payoff and settlement","checks":8,"contract":"Inputs exercised contracts (<= total short), shorts [account, qty, open sequence] and method. fifo assigns in ascending open sequence, each up to its quantity. pro-rata gives floor(exercised*qty/total) and distributes the remaining contracts one each by largest fractional remainder, ties by lower open sequence. Return sorted [account, assigned] for accounts with assignments.","evaluation_group":"w2-options_payoff_and_settlement-assignment-allocation","failed_approach":"Ranking by position size ignores the actual remainders.","family":"w2-options_payoff_and_settlement-assignment-allocation-remainder-ranking","id":"FA-61646","implementations":{"attempt":{"sha256":"b5d2dc75743f891dae4bee9539f18aa0dd5c73448780c257c7fd4c9ddb91e8e3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(exercised, shorts, method):\n    total = sum(q for _, q, _ in shorts)\n    alloc = {}\n    if method == 'fifo':\n        left = exercised\n        for acct, q, seq in sorted(shorts, key=lambda s: s[2]):\n            take = min(q, left)\n            alloc[acct] = alloc.get(acct, 0) + take\n            left -= take\n    else:\n        rem = []\n        for acct, q, seq in shorts:\n            alloc[acct] = alloc.get(acct, 0) + exercised * q // total\n            rem.append((-q, seq, acct))\n        left = exercised - sum(alloc.values())\n        for _, seq, acct in sorted(rem)[:left]:\n            alloc[acct] += 1\n    return sorted([a, n] for a, n in alloc.items() if n > 0)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression remainder ranking 1', [12, [['B2', 5, 6], ['A1', 2, 12], ['C3', 7, 10], ['E5', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 6], ['E5', 1]]], ['regression remainder ranking 2', [3, [['C3', 5, 10], ['D4', 2, 5]], 'pro-rata'], [['C3', 2], ['D4', 1]]], ['partial repair probe 1', [2, [['E5', 3, 17], ['A1', 1, 8]], 'pro-rata'], [['A1', 1], ['E5', 1]]], ['partial repair probe 2', [5, [['C3', 1, 5], ['B2', 3, 2], ['E5', 1, 8], ['A1', 5, 7]], 'pro-rata'], [['A1', 2], ['B2', 2], ['C3', 1]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [4, [['D4', 7, 13]], 'pro-rata'], [['D4', 4]]], ['normal control 2', [6, [['E5', 10, 11], ['F6', 7, 19]], 'fifo'], [['E5', 6]]]], [['regression remainder ranking 1', [12, [['A1', 3, 1], ['C3', 7, 18], ['B2', 7, 2], ['E5', 5, 5]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 4], ['E5', 3]]], ['regression remainder ranking 2', [1, [['A1', 7, 3], ['D4', 10, 11]], 'pro-rata'], [['D4', 1]]], ['partial repair probe 1', [9, [['F6', 3, 13], ['A1', 7, 16], ['C3', 3, 9], ['D4', 5, 7]], 'pro-rata'], [['A1', 3], ['C3', 2], ['D4', 3], ['F6', 1]]], ['partial repair probe 2', [8, [['C3', 7, 12], ['D4', 3, 5], ['A1', 3, 2], ['B2', 3, 11]], 'pro-rata'], [['A1', 2], ['B2', 1], ['C3', 3], ['D4', 2]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [3, [['D4', 3, 1]], 'pro-rata'], [['D4', 3]]], ['normal control 2', [7, [['E5', 7, 12]], 'pro-rata'], [['E5', 7]]]], [['regression remainder ranking 1', [13, [['E5', 7, 5], ['F6', 7, 1], ['D4', 10, 7], ['B2', 3, 10]], 'pro-rata'], [['B2', 2], ['D4', 5], ['E5', 3], ['F6', 3]]], ['regression remainder ranking 2', [6, [['B2', 2, 16], ['E5', 5, 6]], 'pro-rata'], [['B2', 2], ['E5', 4]]], ['partial repair probe 1', [5, [['E5', 3, 8], ['D4', 7, 18]], 'pro-rata'], [['D4', 3], ['E5', 2]]], ['partial repair probe 2', [4, [['B2', 3, 5], ['A1', 5, 6]], 'pro-rata'], [['A1', 2], ['B2', 2]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [2, [['B2', 3, 1]], 'fifo'], [['B2', 2]]], ['normal control 2', [2, [['F6', 5, 1]], 'pro-rata'], [['F6', 2]]]], [['regression remainder ranking 1', [11, [['A1', 3, 18], ['D4', 7, 8], ['F6', 5, 12]], 'pro-rata'], [['A1', 2], ['D4', 5], ['F6', 4]]], ['regression remainder ranking 2', [7, [['D4', 3, 19], ['B2', 5, 11], ['F6', 7, 12]], 'pro-rata'], [['B2', 2], ['D4', 2], ['F6', 3]]], ['partial repair probe 1', [5, [['D4', 7, 6], ['F6', 3, 10], ['C3', 7, 18], ['E5', 3, 1]], 'pro-rata'], [['C3', 1], ['D4', 2], ['E5', 1], ['F6', 1]]], ['partial repair probe 2', [2, [['C3', 1, 2], ['E5', 3, 17]], 'pro-rata'], [['C3', 1], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [6, [['A1', 5, 2], ['B2', 10, 4]], 'pro-rata'], [['A1', 2], ['B2', 4]]], ['normal control 2', [1, [['A1', 1, 1]], 'pro-rata'], [['A1', 1]]]], [['regression remainder ranking 1', [12, [['B2', 5, 16], ['A1', 2, 18], ['F6', 10, 12], ['C3', 10, 17], ['E5', 2, 3]], 'pro-rata'], [['A1', 1], ['B2', 2], ['C3', 4], ['E5', 1], ['F6', 4]]], ['regression remainder ranking 2', [1, [['A1', 10, 12], ['B2', 3, 11], ['E5', 3, 1], ['D4', 2, 5], ['F6', 7, 18]], 'pro-rata'], [['A1', 1]]], ['partial repair probe 1', [3, [['E5', 1, 1], ['A1', 5, 13]], 'pro-rata'], [['A1', 2], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [9, [['D4', 10, 2]], 'pro-rata'], [['D4', 9]]], ['normal control 2', [7, [['C3', 3, 7], ['F6', 2, 2], ['B2', 2, 6]], 'fifo'], [['B2', 2], ['C3', 3], ['F6', 2]]], ['normal control 3', [6, [['F6', 5, 19], ['A1', 1, 6]], 'pro-rata'], [['A1', 1], ['F6', 5]]]]]\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":"3dd5e9e9af42f54237559b480bc98560f4757e97413f88f4461f398878a0f402","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(exercised, shorts, method):\n    total = sum(q for _, q, _ in shorts)\n    alloc = {}\n    if method == 'fifo':\n        left = exercised\n        for acct, q, seq in sorted(shorts, key=lambda s: s[2]):\n            take = min(q, left)\n            alloc[acct] = alloc.get(acct, 0) + take\n            left -= take\n    else:\n        rem = []\n        for acct, q, seq in shorts:\n            alloc[acct] = alloc.get(acct, 0) + exercised * q // total\n            rem.append(((exercised * q % total), seq, acct))\n        left = exercised - sum(alloc.values())\n        for _, seq, acct in sorted(rem)[:left]:\n            alloc[acct] += 1\n    return sorted([a, n] for a, n in alloc.items() if n > 0)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression remainder ranking 1', [12, [['B2', 5, 6], ['A1', 2, 12], ['C3', 7, 10], ['E5', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 6], ['E5', 1]]], ['regression remainder ranking 2', [3, [['C3', 5, 10], ['D4', 2, 5]], 'pro-rata'], [['C3', 2], ['D4', 1]]], ['partial repair probe 1', [2, [['E5', 3, 17], ['A1', 1, 8]], 'pro-rata'], [['A1', 1], ['E5', 1]]], ['partial repair probe 2', [5, [['C3', 1, 5], ['B2', 3, 2], ['E5', 1, 8], ['A1', 5, 7]], 'pro-rata'], [['A1', 2], ['B2', 2], ['C3', 1]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [4, [['D4', 7, 13]], 'pro-rata'], [['D4', 4]]], ['normal control 2', [6, [['E5', 10, 11], ['F6', 7, 19]], 'fifo'], [['E5', 6]]]], [['regression remainder ranking 1', [12, [['A1', 3, 1], ['C3', 7, 18], ['B2', 7, 2], ['E5', 5, 5]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 4], ['E5', 3]]], ['regression remainder ranking 2', [1, [['A1', 7, 3], ['D4', 10, 11]], 'pro-rata'], [['D4', 1]]], ['partial repair probe 1', [9, [['F6', 3, 13], ['A1', 7, 16], ['C3', 3, 9], ['D4', 5, 7]], 'pro-rata'], [['A1', 3], ['C3', 2], ['D4', 3], ['F6', 1]]], ['partial repair probe 2', [8, [['C3', 7, 12], ['D4', 3, 5], ['A1', 3, 2], ['B2', 3, 11]], 'pro-rata'], [['A1', 2], ['B2', 1], ['C3', 3], ['D4', 2]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [3, [['D4', 3, 1]], 'pro-rata'], [['D4', 3]]], ['normal control 2', [7, [['E5', 7, 12]], 'pro-rata'], [['E5', 7]]]], [['regression remainder ranking 1', [13, [['E5', 7, 5], ['F6', 7, 1], ['D4', 10, 7], ['B2', 3, 10]], 'pro-rata'], [['B2', 2], ['D4', 5], ['E5', 3], ['F6', 3]]], ['regression remainder ranking 2', [6, [['B2', 2, 16], ['E5', 5, 6]], 'pro-rata'], [['B2', 2], ['E5', 4]]], ['partial repair probe 1', [5, [['E5', 3, 8], ['D4', 7, 18]], 'pro-rata'], [['D4', 3], ['E5', 2]]], ['partial repair probe 2', [4, [['B2', 3, 5], ['A1', 5, 6]], 'pro-rata'], [['A1', 2], ['B2', 2]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [2, [['B2', 3, 1]], 'fifo'], [['B2', 2]]], ['normal control 2', [2, [['F6', 5, 1]], 'pro-rata'], [['F6', 2]]]], [['regression remainder ranking 1', [11, [['A1', 3, 18], ['D4', 7, 8], ['F6', 5, 12]], 'pro-rata'], [['A1', 2], ['D4', 5], ['F6', 4]]], ['regression remainder ranking 2', [7, [['D4', 3, 19], ['B2', 5, 11], ['F6', 7, 12]], 'pro-rata'], [['B2', 2], ['D4', 2], ['F6', 3]]], ['partial repair probe 1', [5, [['D4', 7, 6], ['F6', 3, 10], ['C3', 7, 18], ['E5', 3, 1]], 'pro-rata'], [['C3', 1], ['D4', 2], ['E5', 1], ['F6', 1]]], ['partial repair probe 2', [2, [['C3', 1, 2], ['E5', 3, 17]], 'pro-rata'], [['C3', 1], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [6, [['A1', 5, 2], ['B2', 10, 4]], 'pro-rata'], [['A1', 2], ['B2', 4]]], ['normal control 2', [1, [['A1', 1, 1]], 'pro-rata'], [['A1', 1]]]], [['regression remainder ranking 1', [12, [['B2', 5, 16], ['A1', 2, 18], ['F6', 10, 12], ['C3', 10, 17], ['E5', 2, 3]], 'pro-rata'], [['A1', 1], ['B2', 2], ['C3', 4], ['E5', 1], ['F6', 4]]], ['regression remainder ranking 2', [1, [['A1', 10, 12], ['B2', 3, 11], ['E5', 3, 1], ['D4', 2, 5], ['F6', 7, 18]], 'pro-rata'], [['A1', 1]]], ['partial repair probe 1', [3, [['E5', 1, 1], ['A1', 5, 13]], 'pro-rata'], [['A1', 2], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [9, [['D4', 10, 2]], 'pro-rata'], [['D4', 9]]], ['normal control 2', [7, [['C3', 3, 7], ['F6', 2, 2], ['B2', 2, 6]], 'fifo'], [['B2', 2], ['C3', 3], ['F6', 2]]], ['normal control 3', [6, [['F6', 5, 19], ['A1', 1, 6]], 'pro-rata'], [['A1', 1], ['F6', 5]]]]]\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":"087901700e41beff83d389d1201cc8527491b2020869a3c4e7be1c403fff19a3","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\n\nN = 1\nobservations = []\ndef solve(exercised, shorts, method):\n    total = sum(q for _, q, _ in shorts)\n    alloc = {}\n    if method == 'fifo':\n        left = exercised\n        for acct, q, seq in sorted(shorts, key=lambda s: s[2]):\n            take = min(q, left)\n            alloc[acct] = alloc.get(acct, 0) + take\n            left -= take\n    else:\n        rem = []\n        for acct, q, seq in shorts:\n            alloc[acct] = alloc.get(acct, 0) + exercised * q // total\n            rem.append((-(exercised * q % total), seq, acct))\n        left = exercised - sum(alloc.values())\n        for _, seq, acct in sorted(rem)[:left]:\n            alloc[acct] += 1\n    return sorted([a, n] for a, n in alloc.items() if n > 0)\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[['regression remainder ranking 1', [12, [['B2', 5, 6], ['A1', 2, 12], ['C3', 7, 10], ['E5', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 6], ['E5', 1]]], ['regression remainder ranking 2', [3, [['C3', 5, 10], ['D4', 2, 5]], 'pro-rata'], [['C3', 2], ['D4', 1]]], ['partial repair probe 1', [2, [['E5', 3, 17], ['A1', 1, 8]], 'pro-rata'], [['A1', 1], ['E5', 1]]], ['partial repair probe 2', [5, [['C3', 1, 5], ['B2', 3, 2], ['E5', 1, 8], ['A1', 5, 7]], 'pro-rata'], [['A1', 2], ['B2', 2], ['C3', 1]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [4, [['D4', 7, 13]], 'pro-rata'], [['D4', 4]]], ['normal control 2', [6, [['E5', 10, 11], ['F6', 7, 19]], 'fifo'], [['E5', 6]]]], [['regression remainder ranking 1', [12, [['A1', 3, 1], ['C3', 7, 18], ['B2', 7, 2], ['E5', 5, 5]], 'pro-rata'], [['A1', 1], ['B2', 4], ['C3', 4], ['E5', 3]]], ['regression remainder ranking 2', [1, [['A1', 7, 3], ['D4', 10, 11]], 'pro-rata'], [['D4', 1]]], ['partial repair probe 1', [9, [['F6', 3, 13], ['A1', 7, 16], ['C3', 3, 9], ['D4', 5, 7]], 'pro-rata'], [['A1', 3], ['C3', 2], ['D4', 3], ['F6', 1]]], ['partial repair probe 2', [8, [['C3', 7, 12], ['D4', 3, 5], ['A1', 3, 2], ['B2', 3, 11]], 'pro-rata'], [['A1', 2], ['B2', 1], ['C3', 3], ['D4', 2]]], ['boundary control 1', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['boundary control 2', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['normal control 1', [3, [['D4', 3, 1]], 'pro-rata'], [['D4', 3]]], ['normal control 2', [7, [['E5', 7, 12]], 'pro-rata'], [['E5', 7]]]], [['regression remainder ranking 1', [13, [['E5', 7, 5], ['F6', 7, 1], ['D4', 10, 7], ['B2', 3, 10]], 'pro-rata'], [['B2', 2], ['D4', 5], ['E5', 3], ['F6', 3]]], ['regression remainder ranking 2', [6, [['B2', 2, 16], ['E5', 5, 6]], 'pro-rata'], [['B2', 2], ['E5', 4]]], ['partial repair probe 1', [5, [['E5', 3, 8], ['D4', 7, 18]], 'pro-rata'], [['D4', 3], ['E5', 2]]], ['partial repair probe 2', [4, [['B2', 3, 5], ['A1', 5, 6]], 'pro-rata'], [['A1', 2], ['B2', 2]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [2, [['B2', 3, 1]], 'fifo'], [['B2', 2]]], ['normal control 2', [2, [['F6', 5, 1]], 'pro-rata'], [['F6', 2]]]], [['regression remainder ranking 1', [11, [['A1', 3, 18], ['D4', 7, 8], ['F6', 5, 12]], 'pro-rata'], [['A1', 2], ['D4', 5], ['F6', 4]]], ['regression remainder ranking 2', [7, [['D4', 3, 19], ['B2', 5, 11], ['F6', 7, 12]], 'pro-rata'], [['B2', 2], ['D4', 2], ['F6', 3]]], ['partial repair probe 1', [5, [['D4', 7, 6], ['F6', 3, 10], ['C3', 7, 18], ['E5', 3, 1]], 'pro-rata'], [['C3', 1], ['D4', 2], ['E5', 1], ['F6', 1]]], ['partial repair probe 2', [2, [['C3', 1, 2], ['E5', 3, 17]], 'pro-rata'], [['C3', 1], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [6, [['A1', 5, 2], ['B2', 10, 4]], 'pro-rata'], [['A1', 2], ['B2', 4]]], ['normal control 2', [1, [['A1', 1, 1]], 'pro-rata'], [['A1', 1]]]], [['regression remainder ranking 1', [12, [['B2', 5, 16], ['A1', 2, 18], ['F6', 10, 12], ['C3', 10, 17], ['E5', 2, 3]], 'pro-rata'], [['A1', 1], ['B2', 2], ['C3', 4], ['E5', 1], ['F6', 4]]], ['regression remainder ranking 2', [1, [['A1', 10, 12], ['B2', 3, 11], ['E5', 3, 1], ['D4', 2, 5], ['F6', 7, 18]], 'pro-rata'], [['A1', 1]]], ['partial repair probe 1', [3, [['E5', 1, 1], ['A1', 5, 13]], 'pro-rata'], [['A1', 2], ['E5', 1]]], ['boundary control 1', [3, [['A1', 1, 1], ['B2', 1, 2], ['C3', 1, 3]], 'pro-rata'], [['A1', 1], ['B2', 1], ['C3', 1]]], ['boundary control 2', [2, [['A1', 5, 2], ['B2', 5, 1]], 'fifo'], [['B2', 2]]], ['normal control 1', [9, [['D4', 10, 2]], 'pro-rata'], [['D4', 9]]], ['normal control 2', [7, [['C3', 3, 7], ['F6', 2, 2], ['B2', 2, 6]], 'fifo'], [['B2', 2], ['C3', 3], ['F6', 2]]], ['normal control 3', [6, [['F6', 5, 19], ['A1', 1, 6]], 'pro-rata'], [['A1', 1], ['F6', 5]]]]]\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":"A deterministic toy contract stated explicitly in the contract field; no claim of conformance to any exchange or clearing rulebook. 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-options_payoff_and_settlement-assignment-allocation-remainder-ranking","generated_at":"2026-09-29T14:46:57.181623+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Option expiry, exercise and settlement engines move cash and shares; a wrong branch misstates obligations.","repair":"Rank by descending remainder.","root_cause":"The remainder sort key is not negated.","sha256":"8e4fa67c57316c7684fa47704c68827e3c17c0578cc35a68c543cced26403da7","title":"Exercise assignment allocation across short accounts: leftovers go to the smallest remainders · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verification":{"attempt":{"elapsed_ms":43.379,"exit_code":1,"observations":[{"actual":[["A1",1],["B2",5],["C3",6]],"check":"regression remainder ranking 1","expected":[["A1",1],["B2",4],["C3",6],["E5",1]],"passed":false},{"actual":[["C3",3]],"check":"regression remainder ranking 2","expected":[["C3",2],["D4",1]],"passed":false},{"actual":[["E5",2]],"check":"partial repair probe 1","expected":[["A1",1],["E5",1]],"passed":false},{"actual":[["A1",3],["B2",2]],"check":"partial repair probe 2","expected":[["A1",2],["B2",2],["C3",1]],"passed":false},{"actual":[["B2",2]],"check":"boundary control 1","expected":[["B2",2]],"passed":true},{"actual":[["A1",1],["B2",1],["C3",1]],"check":"boundary control 2","expected":[["A1",1],["B2",1],["C3",1]],"passed":true},{"actual":[["D4",4]],"check":"normal control 1","expected":[["D4",4]],"passed":true},{"actual":[["E5",6]],"check":"normal control 2","expected":[["E5",6]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression remainder ranking 1\", \"actual\": [[\"A1\", 1], [\"B2\", 5], [\"C3\", 6]], \"expected\": [[\"A1\", 1], [\"B2\", 4], [\"C3\", 6], [\"E5\", 1]], \"passed\": false}, {\"check\": \"regression remainder ranking 2\", \"actual\": [[\"C3\", 3]], \"expected\": [[\"C3\", 2], [\"D4\", 1]], \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": [[\"E5\", 2]], \"expected\": [[\"A1\", 1], [\"E5\", 1]], \"passed\": false}, {\"check\": \"partial repair probe 2\", \"actual\": [[\"A1\", 3], [\"B2\", 2]], \"expected\": [[\"A1\", 2], [\"B2\", 2], [\"C3\", 1]], \"passed\": false}, {\"check\": \"boundary control 1\", \"actual\": [[\"B2\", 2]], \"expected\": [[\"B2\", 2]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"expected\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [[\"D4\", 4]], \"expected\": [[\"D4\", 4]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [[\"E5\", 6]], \"expected\": [[\"E5\", 6]], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":39.773,"exit_code":1,"observations":[{"actual":[["A1",1],["B2",5],["C3",6]],"check":"regression remainder ranking 1","expected":[["A1",1],["B2",4],["C3",6],["E5",1]],"passed":false},{"actual":[["C3",3]],"check":"regression remainder ranking 2","expected":[["C3",2],["D4",1]],"passed":false},{"actual":[["A1",1],["E5",1]],"check":"partial repair probe 1","expected":[["A1",1],["E5",1]],"passed":true},{"actual":[["A1",2],["B2",2],["C3",1]],"check":"partial repair probe 2","expected":[["A1",2],["B2",2],["C3",1]],"passed":true},{"actual":[["B2",2]],"check":"boundary control 1","expected":[["B2",2]],"passed":true},{"actual":[["A1",1],["B2",1],["C3",1]],"check":"boundary control 2","expected":[["A1",1],["B2",1],["C3",1]],"passed":true},{"actual":[["D4",4]],"check":"normal control 1","expected":[["D4",4]],"passed":true},{"actual":[["E5",6]],"check":"normal control 2","expected":[["E5",6]],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression remainder ranking 1\", \"actual\": [[\"A1\", 1], [\"B2\", 5], [\"C3\", 6]], \"expected\": [[\"A1\", 1], [\"B2\", 4], [\"C3\", 6], [\"E5\", 1]], \"passed\": false}, {\"check\": \"regression remainder ranking 2\", \"actual\": [[\"C3\", 3]], \"expected\": [[\"C3\", 2], [\"D4\", 1]], \"passed\": false}, {\"check\": \"partial repair probe 1\", \"actual\": [[\"A1\", 1], [\"E5\", 1]], \"expected\": [[\"A1\", 1], [\"E5\", 1]], \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": [[\"A1\", 2], [\"B2\", 2], [\"C3\", 1]], \"expected\": [[\"A1\", 2], [\"B2\", 2], [\"C3\", 1]], \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": [[\"B2\", 2]], \"expected\": [[\"B2\", 2]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"expected\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [[\"D4\", 4]], \"expected\": [[\"D4\", 4]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [[\"E5\", 6]], \"expected\": [[\"E5\", 6]], \"passed\": true}], \"passed\": false}\n"},"fixed":{"elapsed_ms":43.106,"exit_code":0,"observations":[{"actual":[["A1",1],["B2",4],["C3",6],["E5",1]],"check":"regression remainder ranking 1","expected":[["A1",1],["B2",4],["C3",6],["E5",1]],"passed":true},{"actual":[["C3",2],["D4",1]],"check":"regression remainder ranking 2","expected":[["C3",2],["D4",1]],"passed":true},{"actual":[["A1",1],["E5",1]],"check":"partial repair probe 1","expected":[["A1",1],["E5",1]],"passed":true},{"actual":[["A1",2],["B2",2],["C3",1]],"check":"partial repair probe 2","expected":[["A1",2],["B2",2],["C3",1]],"passed":true},{"actual":[["B2",2]],"check":"boundary control 1","expected":[["B2",2]],"passed":true},{"actual":[["A1",1],["B2",1],["C3",1]],"check":"boundary control 2","expected":[["A1",1],["B2",1],["C3",1]],"passed":true},{"actual":[["D4",4]],"check":"normal control 1","expected":[["D4",4]],"passed":true},{"actual":[["E5",6]],"check":"normal control 2","expected":[["E5",6]],"passed":true}],"passed":true,"stderr":"","stdout":"{\"observations\": [{\"check\": \"regression remainder ranking 1\", \"actual\": [[\"A1\", 1], [\"B2\", 4], [\"C3\", 6], [\"E5\", 1]], \"expected\": [[\"A1\", 1], [\"B2\", 4], [\"C3\", 6], [\"E5\", 1]], \"passed\": true}, {\"check\": \"regression remainder ranking 2\", \"actual\": [[\"C3\", 2], [\"D4\", 1]], \"expected\": [[\"C3\", 2], [\"D4\", 1]], \"passed\": true}, {\"check\": \"partial repair probe 1\", \"actual\": [[\"A1\", 1], [\"E5\", 1]], \"expected\": [[\"A1\", 1], [\"E5\", 1]], \"passed\": true}, {\"check\": \"partial repair probe 2\", \"actual\": [[\"A1\", 2], [\"B2\", 2], [\"C3\", 1]], \"expected\": [[\"A1\", 2], [\"B2\", 2], [\"C3\", 1]], \"passed\": true}, {\"check\": \"boundary control 1\", \"actual\": [[\"B2\", 2]], \"expected\": [[\"B2\", 2]], \"passed\": true}, {\"check\": \"boundary control 2\", \"actual\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"expected\": [[\"A1\", 1], [\"B2\", 1], [\"C3\", 1]], \"passed\": true}, {\"check\": \"normal control 1\", \"actual\": [[\"D4\", 4]], \"expected\": [[\"D4\", 4]], \"passed\": true}, {\"check\": \"normal control 2\", \"actual\": [[\"E5\", 6]], \"expected\": [[\"E5\", 6]], \"passed\": true}], \"passed\": true}\n"}},"verified":true,"visibility":"public"}