{"abstract":"Boxes sliding past each other while overlapping lose their contact.","category":"Collision detection broadphase","checks":8,"contract":"solve(prev, curr): incremental sweep-and-prune on x. Endpoints [x, 0=min/1=max, id] of prev are sorted, refreshed with curr coordinates and insertion-sorted by (x, kind). Each swap where a min passes left over a max begins a pair (if y overlaps in curr); a max passing left over a min ends a pair. Return [sorted begin pairs, sorted end pairs, swap count], pairs as [min,max].","contract_signature":"prev, curr","evaluation_group":"w2-collision_detection_broadphase-incremental-sap-swaps","failed_approach":"Treating any max swap as an end still ends on max-over-max swaps.","family":"w2-collision_detection_broadphase-incremental-sap-swaps-end-event-classification","id":"FA-87796","implementations":{"attempt":{"sha256":"f9b2311becf541de14c90bd9fa0ce6d448f0ad11786fa88751a841ed40206aa7","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prev, curr):\n    old = {b[0]: b for b in prev}\n    new = {b[0]: b for b in curr}\n    E = []\n    for i, b in old.items():\n        E.append([b[1], 0, i])\n        E.append([b[3], 1, i])\n    E.sort()\n    for e in E:\n        b = new[e[2]]\n        e[0] = b[1] if e[1] == 0 else b[3]\n    def yover(a, c):\n        return new[a][2] <= new[c][4] and new[c][2] <= new[a][4]\n    begins, ends = set(), set()\n    swaps = 0\n    for i in range(1, len(E)):\n        j = i\n        while j > 0 and (E[j - 1][0], E[j - 1][1]) > (E[j][0], E[j][1]):\n            e, f = E[j], E[j - 1]\n            E[j - 1], E[j] = e, f\n            swaps += 1\n            p = (min(e[2], f[2]), max(e[2], f[2]))\n            if e[1] == 0 and f[1] == 1:\n                if yover(e[2], f[2]):\n                    begins.add(p)\n            elif e[1] == 1:\n                ends.add(p)\n            j -= 1\n    return [sorted(list(p) for p in begins), sorted(list(p) for p in ends), swaps]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[[[31, 2.0, 5.0, 4.0, 8.0], [26, -1.0, -3.0, -1.0, -3.0], [32, 0.0, 4.0, 1.0, 5.0], [20, -4.0, 3.0, -2.0, 5.0]], [[31, 2.0, 4.0, 4.0, 7.0], [26, -1.0, -2.0, -1.0, -2.0], [32, 4.0, 4.0, 5.0, 5.0], [20, -2.0, 3.0, 0.0, 5.0]]], [[[31, 32]], [], 5]], [[[[15, 2.0, 1.0, 5.0, 1.0], [38, 4.0, -4.0, 4.0, -2.0], [11, -2.0, 5.0, 0.0, 7.0], [28, -1.0, -5.0, 1.0, -3.0], [12, -1.0, 1.0, 0.0, 1.0], [25, -5.0, -2.0, -2.0, 1.0]], [[15, 6.0, 0.0, 9.0, 0.0], [38, 5.0, -5.0, 5.0, -3.0], [11, 0.0, 6.0, 2.0, 8.0], [28, -1.0, -4.0, 1.0, -2.0], [12, 0.0, 1.0, 1.0, 1.0], [25, -6.0, -3.0, -3.0, 0.0]]], [[], [[11, 25], [15, 38]], 7]], [[[[10, 1.0, -5.0, 3.0, -4.0], [15, -2.0, 4.0, -2.0, 7.0], [19, -3.0, -1.0, 0.0, 1.0], [14, 1.0, 1.0, 4.0, 3.0], [22, 3.0, -3.0, 3.0, -1.0]], [[10, -2.0, -5.0, 0.0, -4.0], [15, 0.0, 4.0, 0.0, 7.0], [19, 1.0, 0.0, 4.0, 2.0], [14, 1.0, 1.0, 4.0, 3.0], [22, 2.0, -4.0, 2.0, -2.0]]], [[[14, 19]], [[10, 14], [10, 19], [10, 22], [15, 19]], 13]], [[[[37, 4.0, 2.0, 5.0, 4.0], [38, 4.0, 5.0, 7.0, 8.0]], [[37, 4.0, 2.0, 5.0, 4.0], [38, 5.0, 4.0, 8.0, 7.0]]], [[], [], 0]], [[[[32, -2.0, -1.0, -2.0, 2.0], [33, 1.0, -4.0, 2.0, -2.0], [12, 3.0, 1.0, 5.0, 2.0], [5, 1.0, 5.0, 3.0, 7.0]], [[32, -1.0, -1.0, -1.0, 2.0], [33, 1.0, -5.0, 2.0, -3.0], [12, 7.0, 1.0, 9.0, 2.0], [5, -2.0, 6.0, 0.0, 8.0]]], [[], [[5, 12], [5, 33]], 5]], [[[[25, 0.0, 0.0, 1.0, 0.0], [4, -2.0, -3.0, -2.0, -1.0], [2, 2.0, 4.0, 4.0, 4.0], [7, -4.0, -1.0, -2.0, 2.0], [30, 4.0, -2.0, 6.0, 1.0]], [[25, -3.0, 1.0, -2.0, 1.0], [4, -1.0, -3.0, -1.0, -1.0], [2, 1.0, 4.0, 3.0, 4.0], [7, -4.0, -2.0, -2.0, 1.0], [30, 1.0, -2.0, 3.0, 1.0]]], [[[7, 25]], [[4, 7], [4, 25]], 7]], [[[[21, -2.0, -5.0, 1.0, -5.0], [19, 3.0, -5.0, 5.0, -4.0], [36, -2.0, -1.0, 0.0, 0.0], [16, 5.0, -1.0, 5.0, 0.0], [1, -3.0, 3.0, -3.0, 4.0]], [[21, -1.0, -5.0, 2.0, -5.0], [19, 2.0, -6.0, 4.0, -5.0], [36, -2.0, 0.0, 0.0, 1.0], [16, 9.0, -1.0, 9.0, 0.0], [1, -3.0, 3.0, -3.0, 4.0]]], [[[19, 21]], [[16, 19]], 4]], [[[[20, -5.0, 5.0, -2.0, 6.0], [5, 0.0, 5.0, 3.0, 7.0]], [[20, -1.0, 6.0, 2.0, 7.0], [5, 2.0, 5.0, 5.0, 7.0]]], [[[5, 20]], [], 1]]], [[[[[36, 5.0, -4.0, 6.0, -3.0], [6, 0.0, -2.0, 2.0, -2.0], [5, -5.0, -4.0, -4.0, -2.0], [3, 5.0, 4.0, 5.0, 4.0], [7, 0.0, 0.0, 3.0, 2.0], [28, 0.0, 0.0, 2.0, 0.0], [22, -4.0, -1.0, -4.0, 1.0]], [[36, 5.0, -3.0, 6.0, -2.0], [6, 0.0, -2.0, 2.0, -2.0], [5, -4.0, -4.0, -3.0, -2.0], [3, 6.0, 4.0, 6.0, 4.0], [7, 0.0, 1.0, 3.0, 3.0], [28, 4.0, 0.0, 6.0, 0.0], [22, -4.0, -1.0, -4.0, 1.0]]], [[], [[6, 28], [7, 28]], 7]], [[[[4, -5.0, -3.0, -3.0, 0.0], [9, -3.0, -1.0, -2.0, 1.0], [29, 5.0, 4.0, 6.0, 4.0], [33, 4.0, -5.0, 4.0, -4.0], [37, 5.0, -4.0, 7.0, -2.0], [27, 5.0, 4.0, 5.0, 7.0]], [[4, -4.0, -3.0, -2.0, 0.0], [9, -4.0, 0.0, -3.0, 2.0], [29, 7.0, 3.0, 8.0, 3.0], [33, 4.0, -5.0, 4.0, -4.0], [37, 6.0, -3.0, 8.0, -1.0], [27, 9.0, 4.0, 9.0, 7.0]]], [[], [[27, 29], [27, 37]], 8]], [[[[32, 1.0, 5.0, 2.0, 6.0], [6, 0.0, 5.0, 2.0, 5.0], [9, 0.0, -2.0, 3.0, 1.0], [24, -5.0, 0.0, -3.0, 3.0]], [[32, -2.0, 6.0, -1.0, 7.0], [6, 1.0, 4.0, 3.0, 4.0], [9, 4.0, -1.0, 7.0, 2.0], [24, -5.0, 1.0, -3.0, 4.0]]], [[], [[6, 9], [6, 32], [9, 32]], 6]], [[[[34, -2.0, 4.0, -1.0, 4.0], [17, -5.0, -1.0, -4.0, 0.0], [22, 5.0, -2.0, 8.0, 1.0], [28, 4.0, -4.0, 4.0, -3.0], [33, -2.0, -3.0, 1.0, -1.0], [31, 2.0, -1.0, 3.0, 2.0], [8, 5.0, 0.0, 8.0, 0.0]], [[34, 2.0, 4.0, 3.0, 4.0], [17, -5.0, -1.0, -4.0, 0.0], [22, 5.0, -2.0, 8.0, 1.0], [28, 6.0, -5.0, 6.0, -4.0], [33, -1.0, -3.0, 2.0, -1.0], [31, -1.0, -2.0, 0.0, 1.0], [8, 6.0, 1.0, 9.0, 1.0]]], [[[31, 33]], [[31, 34]], 12]], [[[[17, 1.0, 2.0, 2.0, 5.0], [2, -1.0, 0.0, -1.0, 2.0]], [[17, 5.0, 1.0, 6.0, 4.0], [2, -1.0, -1.0, -1.0, 1.0]]], [[], [], 0]], [[[[37, -2.0, 5.0, -1.0, 5.0], [2, -1.0, 1.0, 2.0, 3.0], [16, -2.0, 5.0, -1.0, 8.0], [22, -4.0, -4.0, -1.0, -1.0]], [[37, -3.0, 5.0, -2.0, 5.0], [2, -1.0, 2.0, 2.0, 4.0], [16, -1.0, 5.0, 0.0, 8.0], [22, -7.0, -4.0, -4.0, -1.0]]], [[], [[2, 22], [2, 37], [16, 22], [16, 37], [22, 37]], 8]], [[[[39, -4.0, -3.0, -1.0, -3.0], [20, -5.0, 4.0, -4.0, 4.0], [13, 1.0, -4.0, 2.0, -1.0], [25, -1.0, -2.0, 2.0, 0.0], [22, 4.0, 4.0, 6.0, 6.0]], [[39, -7.0, -3.0, -4.0, -3.0], [20, -5.0, 3.0, -4.0, 3.0], [13, 1.0, -4.0, 2.0, -1.0], [25, -2.0, -3.0, 1.0, -1.0], [22, 4.0, 4.0, 6.0, 6.0]]], [[], [[25, 39]], 3]], [[[[4, -4.0, 2.0, -3.0, 4.0], [2, 1.0, 1.0, 2.0, 2.0], [7, -3.0, -2.0, 0.0, -2.0], [1, 1.0, 0.0, 4.0, 2.0], [16, 5.0, 2.0, 6.0, 5.0], [17, 5.0, -1.0, 7.0, 0.0], [28, 5.0, 0.0, 8.0, 3.0]], [[4, -4.0, 1.0, -3.0, 3.0], [2, 1.0, 1.0, 2.0, 2.0], [7, -1.0, -3.0, 2.0, -3.0], [1, 2.0, 1.0, 5.0, 3.0], [16, 4.0, 2.0, 5.0, 5.0], [17, 2.0, 0.0, 4.0, 1.0], [28, 4.0, 0.0, 7.0, 3.0]]], [[[1, 16], [1, 17], [1, 28], [2, 17]], [[4, 7]], 12]]], [[[[[23, -1.0, 5.0, -1.0, 7.0], [28, 1.0, -1.0, 3.0, 2.0], [18, -2.0, 2.0, -1.0, 5.0], [19, 0.0, -1.0, 1.0, 0.0], [33, 1.0, -1.0, 1.0, 2.0], [31, -5.0, 0.0, -3.0, 3.0], [25, 5.0, -3.0, 8.0, -3.0], [22, -4.0, 2.0, -3.0, 5.0]], [[23, 0.0, 5.0, 0.0, 7.0], [28, 1.0, 0.0, 3.0, 3.0], [18, 2.0, 2.0, 3.0, 5.0], [19, 0.0, -1.0, 1.0, 0.0], [33, 2.0, -2.0, 2.0, 1.0], [31, -5.0, -1.0, -3.0, 2.0], [25, 6.0, -3.0, 9.0, -3.0], [22, -4.0, 2.0, -3.0, 5.0]]], [[[18, 28]], [[18, 19], [18, 23], [19, 33]], 13]], [[[[29, 4.0, 4.0, 6.0, 5.0], [28, 4.0, 5.0, 6.0, 7.0], [15, 3.0, -4.0, 3.0, -4.0], [20, -2.0, 2.0, -2.0, 3.0], [25, -2.0, 2.0, 0.0, 4.0], [6, -3.0, 1.0, -1.0, 3.0], [35, -4.0, 4.0, -3.0, 7.0]], [[29, 8.0, 4.0, 10.0, 5.0], [28, 5.0, 5.0, 7.0, 7.0], [15, 3.0, -4.0, 3.0, -4.0], [20, -5.0, 3.0, -5.0, 4.0], [25, -1.0, 2.0, 1.0, 4.0], [6, 1.0, 1.0, 3.0, 3.0], [35, -2.0, 4.0, -1.0, 7.0]]], [[[20, 35], [25, 35]], [[6, 20], [6, 35], [20, 25], [20, 35], [28, 29]], 13]], [[[[5, -1.0, -4.0, 1.0, -4.0], [6, 0.0, 4.0, 3.0, 7.0], [4, 5.0, 2.0, 8.0, 4.0]], [[5, -4.0, -4.0, -2.0, -4.0], [6, -3.0, 3.0, 0.0, 6.0], [4, 5.0, 2.0, 8.0, 4.0]]], [[], [], 0]], [[[[22, -2.0, 5.0, 0.0, 8.0], [37, 5.0, -1.0, 5.0, 2.0], [7, 5.0, 2.0, 8.0, 5.0], [25, -5.0, -1.0, -4.0, 1.0]], [[22, -5.0, 5.0, -3.0, 8.0], [37, 7.0, 0.0, 7.0, 3.0], [7, 2.0, 2.0, 5.0, 5.0], [25, -5.0, -1.0, -4.0, 1.0]]], [[], [[7, 37]], 3]], [[[[13, 3.0, 4.0, 4.0, 4.0], [31, 0.0, 2.0, 2.0, 5.0], [3, 0.0, 5.0, 2.0, 5.0], [15, -1.0, 3.0, -1.0, 5.0], [5, 0.0, -4.0, 3.0, -1.0], [29, 1.0, -1.0, 2.0, 2.0], [19, -2.0, -3.0, 0.0, 0.0], [39, 5.0, -4.0, 8.0, -3.0]], [[13, 0.0, 4.0, 1.0, 4.0], [31, 0.0, 2.0, 2.0, 5.0], [3, 0.0, 5.0, 2.0, 5.0], [15, -1.0, 3.0, -1.0, 5.0], [5, 0.0, -4.0, 3.0, -1.0], [29, 3.0, -1.0, 4.0, 2.0], [19, -3.0, -3.0, -1.0, 0.0], [39, 9.0, -3.0, 12.0, -2.0]]], [[[13, 31]], [[3, 19], [3, 29], [5, 19], [13, 29], [19, 31], [29, 31]], 16]], [[[[12, 0.0, -3.0, 2.0, -2.0], [32, 1.0, -5.0, 3.0, -2.0], [4, 1.0, -1.0, 2.0, 1.0], [31, 3.0, 3.0, 6.0, 3.0], [9, 5.0, -2.0, 7.0, -2.0], [20, 0.0, 2.0, 0.0, 4.0], [3, 5.0, 0.0, 6.0, 3.0]], [[12, 0.0, -4.0, 2.0, -3.0], [32, 2.0, -4.0, 4.0, -1.0], [4, 2.0, -1.0, 3.0, 1.0], [31, 0.0, 4.0, 3.0, 4.0], [9, 9.0, -3.0, 11.0, -3.0], [20, -1.0, 3.0, -1.0, 5.0], [3, 7.0, 0.0, 8.0, 3.0]]], [[], [[3, 9], [3, 31], [9, 31], [12, 20]], 12]], [[[[25, 1.0, 1.0, 2.0, 2.0], [34, 2.0, -3.0, 5.0, -3.0], [29, 0.0, -4.0, 0.0, -2.0]], [[25, 1.0, 1.0, 2.0, 2.0], [34, 2.0, -2.0, 5.0, -2.0], [29, -1.0, -3.0, -1.0, -1.0]]], [[], [], 0]], [[[[8, 5.0, 2.0, 8.0, 5.0], [13, 2.0, -4.0, 3.0, -1.0]], [[8, 2.0, 3.0, 5.0, 6.0], [13, 1.0, -4.0, 2.0, -1.0]]], [[], [], 1]]], [[[[[8, -1.0, -1.0, -1.0, -1.0], [9, 4.0, 0.0, 4.0, 3.0], [30, -3.0, 5.0, -1.0, 5.0], [32, 0.0, 2.0, 1.0, 5.0], [3, -3.0, 1.0, 0.0, 1.0], [18, -2.0, 4.0, -2.0, 7.0], [23, 5.0, 2.0, 5.0, 2.0], [39, -4.0, 4.0, -1.0, 5.0]], [[8, 0.0, -1.0, 0.0, -1.0], [9, 1.0, -1.0, 1.0, 2.0], [30, -6.0, 4.0, -4.0, 4.0], [32, -1.0, 1.0, 0.0, 4.0], [3, -3.0, 2.0, 0.0, 2.0], [18, -3.0, 4.0, -3.0, 7.0], [23, 5.0, 1.0, 5.0, 1.0], [39, -4.0, 3.0, -1.0, 4.0]]], [[[32, 39]], [[3, 30], [8, 30], [8, 39], [18, 30]], 12]], [[[[38, 2.0, -1.0, 4.0, -1.0], [13, -5.0, 2.0, -4.0, 2.0], [17, -1.0, -1.0, 1.0, -1.0], [22, 3.0, -5.0, 6.0, -5.0], [4, -1.0, 3.0, 0.0, 3.0], [12, 1.0, -5.0, 3.0, -4.0], [23, 1.0, -4.0, 2.0, -3.0], [15, -5.0, -2.0, -3.0, -1.0]], [[38, 2.0, -2.0, 4.0, -2.0], [13, -1.0, 2.0, 0.0, 2.0], [17, -4.0, -2.0, -2.0, -2.0], [22, 5.0, -6.0, 8.0, -6.0], [4, -4.0, 3.0, -3.0, 3.0], [12, 3.0, -6.0, 5.0, -5.0], [23, 1.0, -4.0, 2.0, -3.0], [15, -4.0, -2.0, -2.0, -1.0]]], [[[15, 17]], [[4, 13], [12, 17], [12, 23], [13, 15], [13, 17], [17, 23], [22, 38]], 21]], [[[[13, -3.0, -4.0, 0.0, -4.0], [18, -5.0, -5.0, -2.0, -2.0], [19, -1.0, -5.0, -1.0, -4.0], [9, 1.0, 4.0, 2.0, 6.0], [5, 5.0, -2.0, 8.0, -1.0], [12, -4.0, 2.0, -4.0, 2.0], [23, -3.0, -2.0, -3.0, -2.0], [25, 1.0, 3.0, 4.0, 6.0], [33, 5.0, 1.0, 7.0, 2.0]], [[13, -3.0, -3.0, 0.0, -3.0], [18, -5.0, -4.0, -2.0, -1.0], [19, -2.0, -5.0, -2.0, -4.0], [9, 2.0, 3.0, 3.0, 5.0], [5, 9.0, -2.0, 12.0, -1.0], [12, -4.0, 1.0, -4.0, 1.0], [23, -1.0, -1.0, -1.0, -1.0], [25, 3.0, 3.0, 6.0, 6.0], [33, 5.0, 0.0, 7.0, 1.0]]], [[[18, 19]], [[5, 33], [18, 23], [19, 23]], 10]], [[[[20, 4.0, 4.0, 5.0, 5.0], [37, -2.0, 0.0, 0.0, 2.0], [7, -3.0, 4.0, -2.0, 6.0], [16, 3.0, 5.0, 3.0, 8.0], [35, -2.0, 1.0, -2.0, 2.0], [9, 3.0, -5.0, 6.0, -5.0], [8, 1.0, 3.0, 4.0, 3.0], [29, 4.0, -4.0, 7.0, -4.0], [4, -2.0, -3.0, -1.0, 0.0]], [[20, 4.0, 5.0, 5.0, 6.0], [37, -2.0, -1.0, 0.0, 1.0], [7, -2.0, 3.0, -1.0, 5.0], [16, 3.0, 5.0, 3.0, 8.0], [35, -2.0, 1.0, -2.0, 2.0], [9, 7.0, -5.0, 10.0, -5.0], [8, 1.0, 4.0, 4.0, 4.0], [29, 3.0, -4.0, 6.0, -4.0], [4, -2.0, -4.0, -1.0, -1.0]]], [[], [[8, 9], [9, 16], [9, 20], [9, 29]], 11]], [[[[23, -3.0, -5.0, -3.0, -3.0], [19, 1.0, 5.0, 1.0, 6.0], [16, -3.0, 1.0, 0.0, 3.0], [33, 1.0, -4.0, 4.0, -4.0]], [[23, -1.0, -6.0, -1.0, -4.0], [19, 3.0, 5.0, 3.0, 6.0], [16, 1.0, 1.0, 4.0, 3.0], [33, 2.0, -4.0, 5.0, -4.0]]], [[], [[16, 23]], 6]], [[[[9, 0.0, -4.0, 1.0, -3.0], [37, -2.0, 2.0, -2.0, 5.0]], [[9, 0.0, -4.0, 1.0, -3.0], [37, -3.0, 2.0, -3.0, 5.0]]], [[], [], 0]], [[[[10, 3.0, -1.0, 3.0, 1.0], [19, 5.0, -5.0, 6.0, -4.0]], [[10, 3.0, 0.0, 3.0, 2.0], [19, 4.0, -6.0, 5.0, -5.0]]], [[], [], 0]], [[[[32, -2.0, -2.0, -1.0, 0.0], [24, 2.0, 4.0, 3.0, 7.0], [29, -3.0, 4.0, -1.0, 4.0], [37, -1.0, 3.0, 2.0, 3.0], [38, 2.0, -5.0, 2.0, -3.0], [14, -3.0, 3.0, 0.0, 4.0], [18, 0.0, 0.0, 2.0, 1.0]], [[32, -3.0, -2.0, -2.0, 0.0], [24, 2.0, 4.0, 3.0, 7.0], [29, -2.0, 3.0, 0.0, 3.0], [37, -1.0, 3.0, 2.0, 3.0], [38, 2.0, -5.0, 2.0, -3.0], [14, -6.0, 2.0, -3.0, 3.0], [18, -1.0, 0.0, 1.0, 1.0]]], [[], [[14, 18], [14, 29], [14, 37], [18, 24], [18, 38], [32, 37]], 11]]], [[[[[28, 0.0, -4.0, 2.0, -4.0], [20, 2.0, -5.0, 2.0, -3.0]], [[28, 4.0, -3.0, 6.0, -3.0], [20, 2.0, -5.0, 2.0, -3.0]]], [[], [[20, 28]], 2]], [[[[37, 0.0, -3.0, 3.0, -3.0], [2, 3.0, -2.0, 5.0, -2.0], [35, 5.0, 2.0, 7.0, 3.0]], [[37, 2.0, -3.0, 5.0, -3.0], [2, 3.0, -3.0, 5.0, -3.0], [35, 5.0, 3.0, 7.0, 4.0]]], [[], [], 1]], [[[[30, 0.0, 1.0, 1.0, 2.0], [1, -3.0, -5.0, -3.0, -4.0], [37, -1.0, -4.0, -1.0, -4.0], [27, -1.0, -5.0, 1.0, -4.0]], [[30, 0.0, 0.0, 1.0, 1.0], [1, -3.0, -5.0, -3.0, -4.0], [37, -1.0, -4.0, -1.0, -4.0], [27, 0.0, -5.0, 2.0, -4.0]]], [[], [[27, 37]], 3]], [[[[6, 4.0, 4.0, 7.0, 5.0], [13, 0.0, 3.0, 0.0, 4.0], [12, -3.0, 5.0, -1.0, 5.0], [27, 2.0, -4.0, 5.0, -2.0], [25, 4.0, 0.0, 6.0, 3.0], [2, 0.0, 2.0, 3.0, 3.0], [15, -2.0, -3.0, -2.0, -2.0], [10, 0.0, -1.0, 0.0, 0.0], [31, 2.0, -1.0, 2.0, 1.0]], [[6, 5.0, 4.0, 8.0, 5.0], [13, -1.0, 2.0, -1.0, 3.0], [12, -2.0, 5.0, 0.0, 5.0], [27, 4.0, -4.0, 7.0, -2.0], [25, 6.0, 1.0, 8.0, 4.0], [2, -1.0, 2.0, 2.0, 3.0], [15, -3.0, -3.0, -3.0, -2.0], [10, 4.0, 0.0, 4.0, 1.0], [31, 3.0, 0.0, 3.0, 2.0]]], [[[10, 31]], [[2, 10], [2, 27], [2, 31], [10, 13], [10, 31], [12, 15], [27, 31]], 20]], [[[[4, 2.0, -2.0, 2.0, 1.0], [12, -3.0, -2.0, 0.0, 0.0], [28, -4.0, -1.0, -3.0, 0.0], [22, 2.0, -3.0, 5.0, -1.0], [8, 0.0, 1.0, 0.0, 3.0], [30, -4.0, 3.0, -2.0, 4.0], [10, -4.0, 2.0, -2.0, 4.0], [39, 3.0, -5.0, 4.0, -4.0], [5, 0.0, -3.0, 2.0, -1.0]], [[4, 4.0, -2.0, 4.0, 1.0], [12, 1.0, -2.0, 4.0, 0.0], [28, -4.0, -1.0, -3.0, 0.0], [22, 1.0, -3.0, 4.0, -1.0], [8, 2.0, 2.0, 2.0, 4.0], [30, -7.0, 4.0, -5.0, 5.0], [10, 0.0, 2.0, 2.0, 4.0], [39, 2.0, -5.0, 3.0, -4.0], [5, 1.0, -4.0, 3.0, -2.0]]], [[[4, 12], [5, 39], [8, 10], [12, 22]], [[4, 5], [4, 39], [10, 28], [10, 30], [12, 28], [12, 30], [28, 30]], 30]], [[[[29, -5.0, 2.0, -2.0, 4.0], [24, 1.0, 4.0, 1.0, 6.0], [25, -4.0, 0.0, -2.0, 0.0], [16, 0.0, 1.0, 3.0, 2.0], [2, 4.0, -1.0, 7.0, 1.0], [6, 4.0, 3.0, 7.0, 3.0], [3, -1.0, 0.0, -1.0, 1.0], [27, -4.0, 3.0, -1.0, 6.0], [23, -2.0, -5.0, -2.0, -4.0]], [[29, -8.0, 1.0, -5.0, 3.0], [24, -2.0, 4.0, -2.0, 6.0], [25, -3.0, 1.0, -1.0, 1.0], [16, 1.0, 2.0, 4.0, 3.0], [2, 8.0, -1.0, 11.0, 1.0], [6, 4.0, 2.0, 7.0, 2.0], [3, 3.0, 0.0, 3.0, 1.0], [27, -7.0, 2.0, -4.0, 5.0], [23, -1.0, -4.0, -1.0, -3.0]]], [[[6, 16]], [[2, 6], [3, 24], [3, 27], [16, 24], [23, 24], [23, 27], [23, 29], [25, 27], [25, 29]], 29]], [[[[25, 0.0, 3.0, 2.0, 3.0], [27, 0.0, 5.0, 0.0, 5.0], [33, -1.0, -5.0, 1.0, -4.0], [9, -5.0, 4.0, -5.0, 6.0], [21, 3.0, 4.0, 6.0, 6.0], [18, -2.0, -2.0, -2.0, -1.0], [39, -2.0, -3.0, 0.0, 0.0], [20, 3.0, -3.0, 3.0, -3.0], [2, -1.0, 0.0, 2.0, 1.0]], [[25, 0.0, 4.0, 2.0, 4.0], [27, 4.0, 6.0, 4.0, 6.0], [33, 1.0, -5.0, 3.0, -4.0], [9, -5.0, 5.0, -5.0, 7.0], [21, 4.0, 5.0, 7.0, 7.0], [18, -1.0, -2.0, -1.0, -1.0], [39, -5.0, -3.0, -3.0, 0.0], [20, 3.0, -2.0, 3.0, -2.0], [2, 3.0, 0.0, 6.0, 1.0]]], [[[21, 27]], [[2, 25], [2, 39], [18, 39], [20, 21], [20, 27], [25, 27], [25, 39], [27, 33], [27, 39], [33, 39]], 29]], [[[[34, 4.0, -3.0, 5.0, -2.0], [39, -5.0, 2.0, -5.0, 5.0]], [[34, 1.0, -3.0, 2.0, -2.0], [39, -5.0, 1.0, -5.0, 4.0]]], [[], [], 0]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"case %d\" % i, 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":"6d297d01b964cdb696859ff2eb8675afd5150a3d8e4b45b12071b5a2dded2e58","source":"\"\"\"Failure Map reference implementation. Python standard library only.\"\"\"\nimport json\nimport math\nN = 1\nobservations = []\ndef solve(prev, curr):\n    old = {b[0]: b for b in prev}\n    new = {b[0]: b for b in curr}\n    E = []\n    for i, b in old.items():\n        E.append([b[1], 0, i])\n        E.append([b[3], 1, i])\n    E.sort()\n    for e in E:\n        b = new[e[2]]\n        e[0] = b[1] if e[1] == 0 else b[3]\n    def yover(a, c):\n        return new[a][2] <= new[c][4] and new[c][2] <= new[a][4]\n    begins, ends = set(), set()\n    swaps = 0\n    for i in range(1, len(E)):\n        j = i\n        while j > 0 and (E[j - 1][0], E[j - 1][1]) > (E[j][0], E[j][1]):\n            e, f = E[j], E[j - 1]\n            E[j - 1], E[j] = e, f\n            swaps += 1\n            p = (min(e[2], f[2]), max(e[2], f[2]))\n            if e[1] == 0 and f[1] == 1:\n                if yover(e[2], f[2]):\n                    begins.add(p)\n            else:\n                ends.add(p)\n            j -= 1\n    return [sorted(list(p) for p in begins), sorted(list(p) for p in ends), swaps]\ndef check(label, actual, expected):\n    observations.append({\"check\": label, \"actual\": actual, \"expected\": expected, \"passed\": actual == expected})\nfixtures = [[[[[[31, 2.0, 5.0, 4.0, 8.0], [26, -1.0, -3.0, -1.0, -3.0], [32, 0.0, 4.0, 1.0, 5.0], [20, -4.0, 3.0, -2.0, 5.0]], [[31, 2.0, 4.0, 4.0, 7.0], [26, -1.0, -2.0, -1.0, -2.0], [32, 4.0, 4.0, 5.0, 5.0], [20, -2.0, 3.0, 0.0, 5.0]]], [[[31, 32]], [], 5]], [[[[15, 2.0, 1.0, 5.0, 1.0], [38, 4.0, -4.0, 4.0, -2.0], [11, -2.0, 5.0, 0.0, 7.0], [28, -1.0, -5.0, 1.0, -3.0], [12, -1.0, 1.0, 0.0, 1.0], [25, -5.0, -2.0, -2.0, 1.0]], [[15, 6.0, 0.0, 9.0, 0.0], [38, 5.0, -5.0, 5.0, -3.0], [11, 0.0, 6.0, 2.0, 8.0], [28, -1.0, -4.0, 1.0, -2.0], [12, 0.0, 1.0, 1.0, 1.0], [25, -6.0, -3.0, -3.0, 0.0]]], [[], [[11, 25], [15, 38]], 7]], [[[[10, 1.0, -5.0, 3.0, -4.0], [15, -2.0, 4.0, -2.0, 7.0], [19, -3.0, -1.0, 0.0, 1.0], [14, 1.0, 1.0, 4.0, 3.0], [22, 3.0, -3.0, 3.0, -1.0]], [[10, -2.0, -5.0, 0.0, -4.0], [15, 0.0, 4.0, 0.0, 7.0], [19, 1.0, 0.0, 4.0, 2.0], [14, 1.0, 1.0, 4.0, 3.0], [22, 2.0, -4.0, 2.0, -2.0]]], [[[14, 19]], [[10, 14], [10, 19], [10, 22], [15, 19]], 13]], [[[[37, 4.0, 2.0, 5.0, 4.0], [38, 4.0, 5.0, 7.0, 8.0]], [[37, 4.0, 2.0, 5.0, 4.0], [38, 5.0, 4.0, 8.0, 7.0]]], [[], [], 0]], [[[[32, -2.0, -1.0, -2.0, 2.0], [33, 1.0, -4.0, 2.0, -2.0], [12, 3.0, 1.0, 5.0, 2.0], [5, 1.0, 5.0, 3.0, 7.0]], [[32, -1.0, -1.0, -1.0, 2.0], [33, 1.0, -5.0, 2.0, -3.0], [12, 7.0, 1.0, 9.0, 2.0], [5, -2.0, 6.0, 0.0, 8.0]]], [[], [[5, 12], [5, 33]], 5]], [[[[25, 0.0, 0.0, 1.0, 0.0], [4, -2.0, -3.0, -2.0, -1.0], [2, 2.0, 4.0, 4.0, 4.0], [7, -4.0, -1.0, -2.0, 2.0], [30, 4.0, -2.0, 6.0, 1.0]], [[25, -3.0, 1.0, -2.0, 1.0], [4, -1.0, -3.0, -1.0, -1.0], [2, 1.0, 4.0, 3.0, 4.0], [7, -4.0, -2.0, -2.0, 1.0], [30, 1.0, -2.0, 3.0, 1.0]]], [[[7, 25]], [[4, 7], [4, 25]], 7]], [[[[21, -2.0, -5.0, 1.0, -5.0], [19, 3.0, -5.0, 5.0, -4.0], [36, -2.0, -1.0, 0.0, 0.0], [16, 5.0, -1.0, 5.0, 0.0], [1, -3.0, 3.0, -3.0, 4.0]], [[21, -1.0, -5.0, 2.0, -5.0], [19, 2.0, -6.0, 4.0, -5.0], [36, -2.0, 0.0, 0.0, 1.0], [16, 9.0, -1.0, 9.0, 0.0], [1, -3.0, 3.0, -3.0, 4.0]]], [[[19, 21]], [[16, 19]], 4]], [[[[20, -5.0, 5.0, -2.0, 6.0], [5, 0.0, 5.0, 3.0, 7.0]], [[20, -1.0, 6.0, 2.0, 7.0], [5, 2.0, 5.0, 5.0, 7.0]]], [[[5, 20]], [], 1]]], [[[[[36, 5.0, -4.0, 6.0, -3.0], [6, 0.0, -2.0, 2.0, -2.0], [5, -5.0, -4.0, -4.0, -2.0], [3, 5.0, 4.0, 5.0, 4.0], [7, 0.0, 0.0, 3.0, 2.0], [28, 0.0, 0.0, 2.0, 0.0], [22, -4.0, -1.0, -4.0, 1.0]], [[36, 5.0, -3.0, 6.0, -2.0], [6, 0.0, -2.0, 2.0, -2.0], [5, -4.0, -4.0, -3.0, -2.0], [3, 6.0, 4.0, 6.0, 4.0], [7, 0.0, 1.0, 3.0, 3.0], [28, 4.0, 0.0, 6.0, 0.0], [22, -4.0, -1.0, -4.0, 1.0]]], [[], [[6, 28], [7, 28]], 7]], [[[[4, -5.0, -3.0, -3.0, 0.0], [9, -3.0, -1.0, -2.0, 1.0], [29, 5.0, 4.0, 6.0, 4.0], [33, 4.0, -5.0, 4.0, -4.0], [37, 5.0, -4.0, 7.0, -2.0], [27, 5.0, 4.0, 5.0, 7.0]], [[4, -4.0, -3.0, -2.0, 0.0], [9, -4.0, 0.0, -3.0, 2.0], [29, 7.0, 3.0, 8.0, 3.0], [33, 4.0, -5.0, 4.0, -4.0], [37, 6.0, -3.0, 8.0, -1.0], [27, 9.0, 4.0, 9.0, 7.0]]], [[], [[27, 29], [27, 37]], 8]], [[[[32, 1.0, 5.0, 2.0, 6.0], [6, 0.0, 5.0, 2.0, 5.0], [9, 0.0, -2.0, 3.0, 1.0], [24, -5.0, 0.0, -3.0, 3.0]], [[32, -2.0, 6.0, -1.0, 7.0], [6, 1.0, 4.0, 3.0, 4.0], [9, 4.0, -1.0, 7.0, 2.0], [24, -5.0, 1.0, -3.0, 4.0]]], [[], [[6, 9], [6, 32], [9, 32]], 6]], [[[[34, -2.0, 4.0, -1.0, 4.0], [17, -5.0, -1.0, -4.0, 0.0], [22, 5.0, -2.0, 8.0, 1.0], [28, 4.0, -4.0, 4.0, -3.0], [33, -2.0, -3.0, 1.0, -1.0], [31, 2.0, -1.0, 3.0, 2.0], [8, 5.0, 0.0, 8.0, 0.0]], [[34, 2.0, 4.0, 3.0, 4.0], [17, -5.0, -1.0, -4.0, 0.0], [22, 5.0, -2.0, 8.0, 1.0], [28, 6.0, -5.0, 6.0, -4.0], [33, -1.0, -3.0, 2.0, -1.0], [31, -1.0, -2.0, 0.0, 1.0], [8, 6.0, 1.0, 9.0, 1.0]]], [[[31, 33]], [[31, 34]], 12]], [[[[17, 1.0, 2.0, 2.0, 5.0], [2, -1.0, 0.0, -1.0, 2.0]], [[17, 5.0, 1.0, 6.0, 4.0], [2, -1.0, -1.0, -1.0, 1.0]]], [[], [], 0]], [[[[37, -2.0, 5.0, -1.0, 5.0], [2, -1.0, 1.0, 2.0, 3.0], [16, -2.0, 5.0, -1.0, 8.0], [22, -4.0, -4.0, -1.0, -1.0]], [[37, -3.0, 5.0, -2.0, 5.0], [2, -1.0, 2.0, 2.0, 4.0], [16, -1.0, 5.0, 0.0, 8.0], [22, -7.0, -4.0, -4.0, -1.0]]], [[], [[2, 22], [2, 37], [16, 22], [16, 37], [22, 37]], 8]], [[[[39, -4.0, -3.0, -1.0, -3.0], [20, -5.0, 4.0, -4.0, 4.0], [13, 1.0, -4.0, 2.0, -1.0], [25, -1.0, -2.0, 2.0, 0.0], [22, 4.0, 4.0, 6.0, 6.0]], [[39, -7.0, -3.0, -4.0, -3.0], [20, -5.0, 3.0, -4.0, 3.0], [13, 1.0, -4.0, 2.0, -1.0], [25, -2.0, -3.0, 1.0, -1.0], [22, 4.0, 4.0, 6.0, 6.0]]], [[], [[25, 39]], 3]], [[[[4, -4.0, 2.0, -3.0, 4.0], [2, 1.0, 1.0, 2.0, 2.0], [7, -3.0, -2.0, 0.0, -2.0], [1, 1.0, 0.0, 4.0, 2.0], [16, 5.0, 2.0, 6.0, 5.0], [17, 5.0, -1.0, 7.0, 0.0], [28, 5.0, 0.0, 8.0, 3.0]], [[4, -4.0, 1.0, -3.0, 3.0], [2, 1.0, 1.0, 2.0, 2.0], [7, -1.0, -3.0, 2.0, -3.0], [1, 2.0, 1.0, 5.0, 3.0], [16, 4.0, 2.0, 5.0, 5.0], [17, 2.0, 0.0, 4.0, 1.0], [28, 4.0, 0.0, 7.0, 3.0]]], [[[1, 16], [1, 17], [1, 28], [2, 17]], [[4, 7]], 12]]], [[[[[23, -1.0, 5.0, -1.0, 7.0], [28, 1.0, -1.0, 3.0, 2.0], [18, -2.0, 2.0, -1.0, 5.0], [19, 0.0, -1.0, 1.0, 0.0], [33, 1.0, -1.0, 1.0, 2.0], [31, -5.0, 0.0, -3.0, 3.0], [25, 5.0, -3.0, 8.0, -3.0], [22, -4.0, 2.0, -3.0, 5.0]], [[23, 0.0, 5.0, 0.0, 7.0], [28, 1.0, 0.0, 3.0, 3.0], [18, 2.0, 2.0, 3.0, 5.0], [19, 0.0, -1.0, 1.0, 0.0], [33, 2.0, -2.0, 2.0, 1.0], [31, -5.0, -1.0, -3.0, 2.0], [25, 6.0, -3.0, 9.0, -3.0], [22, -4.0, 2.0, -3.0, 5.0]]], [[[18, 28]], [[18, 19], [18, 23], [19, 33]], 13]], [[[[29, 4.0, 4.0, 6.0, 5.0], [28, 4.0, 5.0, 6.0, 7.0], [15, 3.0, -4.0, 3.0, -4.0], [20, -2.0, 2.0, -2.0, 3.0], [25, -2.0, 2.0, 0.0, 4.0], [6, -3.0, 1.0, -1.0, 3.0], [35, -4.0, 4.0, -3.0, 7.0]], [[29, 8.0, 4.0, 10.0, 5.0], [28, 5.0, 5.0, 7.0, 7.0], [15, 3.0, -4.0, 3.0, -4.0], [20, -5.0, 3.0, -5.0, 4.0], [25, -1.0, 2.0, 1.0, 4.0], [6, 1.0, 1.0, 3.0, 3.0], [35, -2.0, 4.0, -1.0, 7.0]]], [[[20, 35], [25, 35]], [[6, 20], [6, 35], [20, 25], [20, 35], [28, 29]], 13]], [[[[5, -1.0, -4.0, 1.0, -4.0], [6, 0.0, 4.0, 3.0, 7.0], [4, 5.0, 2.0, 8.0, 4.0]], [[5, -4.0, -4.0, -2.0, -4.0], [6, -3.0, 3.0, 0.0, 6.0], [4, 5.0, 2.0, 8.0, 4.0]]], [[], [], 0]], [[[[22, -2.0, 5.0, 0.0, 8.0], [37, 5.0, -1.0, 5.0, 2.0], [7, 5.0, 2.0, 8.0, 5.0], [25, -5.0, -1.0, -4.0, 1.0]], [[22, -5.0, 5.0, -3.0, 8.0], [37, 7.0, 0.0, 7.0, 3.0], [7, 2.0, 2.0, 5.0, 5.0], [25, -5.0, -1.0, -4.0, 1.0]]], [[], [[7, 37]], 3]], [[[[13, 3.0, 4.0, 4.0, 4.0], [31, 0.0, 2.0, 2.0, 5.0], [3, 0.0, 5.0, 2.0, 5.0], [15, -1.0, 3.0, -1.0, 5.0], [5, 0.0, -4.0, 3.0, -1.0], [29, 1.0, -1.0, 2.0, 2.0], [19, -2.0, -3.0, 0.0, 0.0], [39, 5.0, -4.0, 8.0, -3.0]], [[13, 0.0, 4.0, 1.0, 4.0], [31, 0.0, 2.0, 2.0, 5.0], [3, 0.0, 5.0, 2.0, 5.0], [15, -1.0, 3.0, -1.0, 5.0], [5, 0.0, -4.0, 3.0, -1.0], [29, 3.0, -1.0, 4.0, 2.0], [19, -3.0, -3.0, -1.0, 0.0], [39, 9.0, -3.0, 12.0, -2.0]]], [[[13, 31]], [[3, 19], [3, 29], [5, 19], [13, 29], [19, 31], [29, 31]], 16]], [[[[12, 0.0, -3.0, 2.0, -2.0], [32, 1.0, -5.0, 3.0, -2.0], [4, 1.0, -1.0, 2.0, 1.0], [31, 3.0, 3.0, 6.0, 3.0], [9, 5.0, -2.0, 7.0, -2.0], [20, 0.0, 2.0, 0.0, 4.0], [3, 5.0, 0.0, 6.0, 3.0]], [[12, 0.0, -4.0, 2.0, -3.0], [32, 2.0, -4.0, 4.0, -1.0], [4, 2.0, -1.0, 3.0, 1.0], [31, 0.0, 4.0, 3.0, 4.0], [9, 9.0, -3.0, 11.0, -3.0], [20, -1.0, 3.0, -1.0, 5.0], [3, 7.0, 0.0, 8.0, 3.0]]], [[], [[3, 9], [3, 31], [9, 31], [12, 20]], 12]], [[[[25, 1.0, 1.0, 2.0, 2.0], [34, 2.0, -3.0, 5.0, -3.0], [29, 0.0, -4.0, 0.0, -2.0]], [[25, 1.0, 1.0, 2.0, 2.0], [34, 2.0, -2.0, 5.0, -2.0], [29, -1.0, -3.0, -1.0, -1.0]]], [[], [], 0]], [[[[8, 5.0, 2.0, 8.0, 5.0], [13, 2.0, -4.0, 3.0, -1.0]], [[8, 2.0, 3.0, 5.0, 6.0], [13, 1.0, -4.0, 2.0, -1.0]]], [[], [], 1]]], [[[[[8, -1.0, -1.0, -1.0, -1.0], [9, 4.0, 0.0, 4.0, 3.0], [30, -3.0, 5.0, -1.0, 5.0], [32, 0.0, 2.0, 1.0, 5.0], [3, -3.0, 1.0, 0.0, 1.0], [18, -2.0, 4.0, -2.0, 7.0], [23, 5.0, 2.0, 5.0, 2.0], [39, -4.0, 4.0, -1.0, 5.0]], [[8, 0.0, -1.0, 0.0, -1.0], [9, 1.0, -1.0, 1.0, 2.0], [30, -6.0, 4.0, -4.0, 4.0], [32, -1.0, 1.0, 0.0, 4.0], [3, -3.0, 2.0, 0.0, 2.0], [18, -3.0, 4.0, -3.0, 7.0], [23, 5.0, 1.0, 5.0, 1.0], [39, -4.0, 3.0, -1.0, 4.0]]], [[[32, 39]], [[3, 30], [8, 30], [8, 39], [18, 30]], 12]], [[[[38, 2.0, -1.0, 4.0, -1.0], [13, -5.0, 2.0, -4.0, 2.0], [17, -1.0, -1.0, 1.0, -1.0], [22, 3.0, -5.0, 6.0, -5.0], [4, -1.0, 3.0, 0.0, 3.0], [12, 1.0, -5.0, 3.0, -4.0], [23, 1.0, -4.0, 2.0, -3.0], [15, -5.0, -2.0, -3.0, -1.0]], [[38, 2.0, -2.0, 4.0, -2.0], [13, -1.0, 2.0, 0.0, 2.0], [17, -4.0, -2.0, -2.0, -2.0], [22, 5.0, -6.0, 8.0, -6.0], [4, -4.0, 3.0, -3.0, 3.0], [12, 3.0, -6.0, 5.0, -5.0], [23, 1.0, -4.0, 2.0, -3.0], [15, -4.0, -2.0, -2.0, -1.0]]], [[[15, 17]], [[4, 13], [12, 17], [12, 23], [13, 15], [13, 17], [17, 23], [22, 38]], 21]], [[[[13, -3.0, -4.0, 0.0, -4.0], [18, -5.0, -5.0, -2.0, -2.0], [19, -1.0, -5.0, -1.0, -4.0], [9, 1.0, 4.0, 2.0, 6.0], [5, 5.0, -2.0, 8.0, -1.0], [12, -4.0, 2.0, -4.0, 2.0], [23, -3.0, -2.0, -3.0, -2.0], [25, 1.0, 3.0, 4.0, 6.0], [33, 5.0, 1.0, 7.0, 2.0]], [[13, -3.0, -3.0, 0.0, -3.0], [18, -5.0, -4.0, -2.0, -1.0], [19, -2.0, -5.0, -2.0, -4.0], [9, 2.0, 3.0, 3.0, 5.0], [5, 9.0, -2.0, 12.0, -1.0], [12, -4.0, 1.0, -4.0, 1.0], [23, -1.0, -1.0, -1.0, -1.0], [25, 3.0, 3.0, 6.0, 6.0], [33, 5.0, 0.0, 7.0, 1.0]]], [[[18, 19]], [[5, 33], [18, 23], [19, 23]], 10]], [[[[20, 4.0, 4.0, 5.0, 5.0], [37, -2.0, 0.0, 0.0, 2.0], [7, -3.0, 4.0, -2.0, 6.0], [16, 3.0, 5.0, 3.0, 8.0], [35, -2.0, 1.0, -2.0, 2.0], [9, 3.0, -5.0, 6.0, -5.0], [8, 1.0, 3.0, 4.0, 3.0], [29, 4.0, -4.0, 7.0, -4.0], [4, -2.0, -3.0, -1.0, 0.0]], [[20, 4.0, 5.0, 5.0, 6.0], [37, -2.0, -1.0, 0.0, 1.0], [7, -2.0, 3.0, -1.0, 5.0], [16, 3.0, 5.0, 3.0, 8.0], [35, -2.0, 1.0, -2.0, 2.0], [9, 7.0, -5.0, 10.0, -5.0], [8, 1.0, 4.0, 4.0, 4.0], [29, 3.0, -4.0, 6.0, -4.0], [4, -2.0, -4.0, -1.0, -1.0]]], [[], [[8, 9], [9, 16], [9, 20], [9, 29]], 11]], [[[[23, -3.0, -5.0, -3.0, -3.0], [19, 1.0, 5.0, 1.0, 6.0], [16, -3.0, 1.0, 0.0, 3.0], [33, 1.0, -4.0, 4.0, -4.0]], [[23, -1.0, -6.0, -1.0, -4.0], [19, 3.0, 5.0, 3.0, 6.0], [16, 1.0, 1.0, 4.0, 3.0], [33, 2.0, -4.0, 5.0, -4.0]]], [[], [[16, 23]], 6]], [[[[9, 0.0, -4.0, 1.0, -3.0], [37, -2.0, 2.0, -2.0, 5.0]], [[9, 0.0, -4.0, 1.0, -3.0], [37, -3.0, 2.0, -3.0, 5.0]]], [[], [], 0]], [[[[10, 3.0, -1.0, 3.0, 1.0], [19, 5.0, -5.0, 6.0, -4.0]], [[10, 3.0, 0.0, 3.0, 2.0], [19, 4.0, -6.0, 5.0, -5.0]]], [[], [], 0]], [[[[32, -2.0, -2.0, -1.0, 0.0], [24, 2.0, 4.0, 3.0, 7.0], [29, -3.0, 4.0, -1.0, 4.0], [37, -1.0, 3.0, 2.0, 3.0], [38, 2.0, -5.0, 2.0, -3.0], [14, -3.0, 3.0, 0.0, 4.0], [18, 0.0, 0.0, 2.0, 1.0]], [[32, -3.0, -2.0, -2.0, 0.0], [24, 2.0, 4.0, 3.0, 7.0], [29, -2.0, 3.0, 0.0, 3.0], [37, -1.0, 3.0, 2.0, 3.0], [38, 2.0, -5.0, 2.0, -3.0], [14, -6.0, 2.0, -3.0, 3.0], [18, -1.0, 0.0, 1.0, 1.0]]], [[], [[14, 18], [14, 29], [14, 37], [18, 24], [18, 38], [32, 37]], 11]]], [[[[[28, 0.0, -4.0, 2.0, -4.0], [20, 2.0, -5.0, 2.0, -3.0]], [[28, 4.0, -3.0, 6.0, -3.0], [20, 2.0, -5.0, 2.0, -3.0]]], [[], [[20, 28]], 2]], [[[[37, 0.0, -3.0, 3.0, -3.0], [2, 3.0, -2.0, 5.0, -2.0], [35, 5.0, 2.0, 7.0, 3.0]], [[37, 2.0, -3.0, 5.0, -3.0], [2, 3.0, -3.0, 5.0, -3.0], [35, 5.0, 3.0, 7.0, 4.0]]], [[], [], 1]], [[[[30, 0.0, 1.0, 1.0, 2.0], [1, -3.0, -5.0, -3.0, -4.0], [37, -1.0, -4.0, -1.0, -4.0], [27, -1.0, -5.0, 1.0, -4.0]], [[30, 0.0, 0.0, 1.0, 1.0], [1, -3.0, -5.0, -3.0, -4.0], [37, -1.0, -4.0, -1.0, -4.0], [27, 0.0, -5.0, 2.0, -4.0]]], [[], [[27, 37]], 3]], [[[[6, 4.0, 4.0, 7.0, 5.0], [13, 0.0, 3.0, 0.0, 4.0], [12, -3.0, 5.0, -1.0, 5.0], [27, 2.0, -4.0, 5.0, -2.0], [25, 4.0, 0.0, 6.0, 3.0], [2, 0.0, 2.0, 3.0, 3.0], [15, -2.0, -3.0, -2.0, -2.0], [10, 0.0, -1.0, 0.0, 0.0], [31, 2.0, -1.0, 2.0, 1.0]], [[6, 5.0, 4.0, 8.0, 5.0], [13, -1.0, 2.0, -1.0, 3.0], [12, -2.0, 5.0, 0.0, 5.0], [27, 4.0, -4.0, 7.0, -2.0], [25, 6.0, 1.0, 8.0, 4.0], [2, -1.0, 2.0, 2.0, 3.0], [15, -3.0, -3.0, -3.0, -2.0], [10, 4.0, 0.0, 4.0, 1.0], [31, 3.0, 0.0, 3.0, 2.0]]], [[[10, 31]], [[2, 10], [2, 27], [2, 31], [10, 13], [10, 31], [12, 15], [27, 31]], 20]], [[[[4, 2.0, -2.0, 2.0, 1.0], [12, -3.0, -2.0, 0.0, 0.0], [28, -4.0, -1.0, -3.0, 0.0], [22, 2.0, -3.0, 5.0, -1.0], [8, 0.0, 1.0, 0.0, 3.0], [30, -4.0, 3.0, -2.0, 4.0], [10, -4.0, 2.0, -2.0, 4.0], [39, 3.0, -5.0, 4.0, -4.0], [5, 0.0, -3.0, 2.0, -1.0]], [[4, 4.0, -2.0, 4.0, 1.0], [12, 1.0, -2.0, 4.0, 0.0], [28, -4.0, -1.0, -3.0, 0.0], [22, 1.0, -3.0, 4.0, -1.0], [8, 2.0, 2.0, 2.0, 4.0], [30, -7.0, 4.0, -5.0, 5.0], [10, 0.0, 2.0, 2.0, 4.0], [39, 2.0, -5.0, 3.0, -4.0], [5, 1.0, -4.0, 3.0, -2.0]]], [[[4, 12], [5, 39], [8, 10], [12, 22]], [[4, 5], [4, 39], [10, 28], [10, 30], [12, 28], [12, 30], [28, 30]], 30]], [[[[29, -5.0, 2.0, -2.0, 4.0], [24, 1.0, 4.0, 1.0, 6.0], [25, -4.0, 0.0, -2.0, 0.0], [16, 0.0, 1.0, 3.0, 2.0], [2, 4.0, -1.0, 7.0, 1.0], [6, 4.0, 3.0, 7.0, 3.0], [3, -1.0, 0.0, -1.0, 1.0], [27, -4.0, 3.0, -1.0, 6.0], [23, -2.0, -5.0, -2.0, -4.0]], [[29, -8.0, 1.0, -5.0, 3.0], [24, -2.0, 4.0, -2.0, 6.0], [25, -3.0, 1.0, -1.0, 1.0], [16, 1.0, 2.0, 4.0, 3.0], [2, 8.0, -1.0, 11.0, 1.0], [6, 4.0, 2.0, 7.0, 2.0], [3, 3.0, 0.0, 3.0, 1.0], [27, -7.0, 2.0, -4.0, 5.0], [23, -1.0, -4.0, -1.0, -3.0]]], [[[6, 16]], [[2, 6], [3, 24], [3, 27], [16, 24], [23, 24], [23, 27], [23, 29], [25, 27], [25, 29]], 29]], [[[[25, 0.0, 3.0, 2.0, 3.0], [27, 0.0, 5.0, 0.0, 5.0], [33, -1.0, -5.0, 1.0, -4.0], [9, -5.0, 4.0, -5.0, 6.0], [21, 3.0, 4.0, 6.0, 6.0], [18, -2.0, -2.0, -2.0, -1.0], [39, -2.0, -3.0, 0.0, 0.0], [20, 3.0, -3.0, 3.0, -3.0], [2, -1.0, 0.0, 2.0, 1.0]], [[25, 0.0, 4.0, 2.0, 4.0], [27, 4.0, 6.0, 4.0, 6.0], [33, 1.0, -5.0, 3.0, -4.0], [9, -5.0, 5.0, -5.0, 7.0], [21, 4.0, 5.0, 7.0, 7.0], [18, -1.0, -2.0, -1.0, -1.0], [39, -5.0, -3.0, -3.0, 0.0], [20, 3.0, -2.0, 3.0, -2.0], [2, 3.0, 0.0, 6.0, 1.0]]], [[[21, 27]], [[2, 25], [2, 39], [18, 39], [20, 21], [20, 27], [25, 27], [25, 39], [27, 33], [27, 39], [33, 39]], 29]], [[[[34, 4.0, -3.0, 5.0, -2.0], [39, -5.0, 2.0, -5.0, 5.0]], [[34, 1.0, -3.0, 2.0, -2.0], [39, -5.0, 1.0, -5.0, 4.0]]], [[], [], 0]]]]\nfor i, (args, expected) in enumerate(fixtures[N-1]):\n    check(\"case %d\" % i, 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 bounded teaching model with stipulated toy conventions; not a production physics engine or spatial index. 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-collision_detection_broadphase-incremental-sap-swaps-end-event-classification","generated_at":"2026-09-29T14:51:02.324834+00:00","license":"CC0-1.0","python":"3.12.14","seed":1,"split":"open-access"},"relevance":"Broadphase stages decide which object pairs ever reach narrowphase; a wrong boundary, ordering or bookkeeping rule silently drops real contacts or floods the solver with false candidates.","root_cause":"Any non-begin swap emits an end event.","sha256":"119518d354dbb6afec3f2cf3ba6387b51b2a2611e5fa4ed5d9c53fab3dac81ac","title":"Same-kind endpoint swaps end pairs · case 01","variant":1,"variant_policy":"Five numbered records share a model and may reuse boundary fixtures.","verified":true,"visibility":"public","verification":{"attempt":{"elapsed_ms":46.984,"exit_code":1,"observations":[{"actual":[[[31,32]],[[20,26],[31,32]],5],"check":"case 0","expected":[[[31,32]],[],5],"passed":false},{"actual":[[],[[11,12],[11,25],[11,28],[15,38]],7],"check":"case 1","expected":[[],[[11,25],[15,38]],7],"passed":false},{"actual":[[[14,19]],[[10,14],[10,19],[10,22],[15,19],[19,22]],13],"check":"case 2","expected":[[[14,19]],[[10,14],[10,19],[10,22],[15,19]],13],"passed":false},{"actual":[[],[],0],"check":"case 3","expected":[[],[],0],"passed":true},{"actual":[[],[[5,12],[5,33]],5],"check":"case 4","expected":[[],[[5,12],[5,33]],5],"passed":true},{"actual":[[[7,25]],[[4,7],[4,25]],7],"check":"case 5","expected":[[[7,25]],[[4,7],[4,25]],7],"passed":true},{"actual":[[[19,21]],[[16,19]],4],"check":"case 6","expected":[[[19,21]],[[16,19]],4],"passed":true},{"actual":[[[5,20]],[],1],"check":"case 7","expected":[[[5,20]],[],1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"case 0\", \"actual\": [[[31, 32]], [[20, 26], [31, 32]], 5], \"expected\": [[[31, 32]], [], 5], \"passed\": false}, {\"check\": \"case 1\", \"actual\": [[], [[11, 12], [11, 25], [11, 28], [15, 38]], 7], \"expected\": [[], [[11, 25], [15, 38]], 7], \"passed\": false}, {\"check\": \"case 2\", \"actual\": [[[14, 19]], [[10, 14], [10, 19], [10, 22], [15, 19], [19, 22]], 13], \"expected\": [[[14, 19]], [[10, 14], [10, 19], [10, 22], [15, 19]], 13], \"passed\": false}, {\"check\": \"case 3\", \"actual\": [[], [], 0], \"expected\": [[], [], 0], \"passed\": true}, {\"check\": \"case 4\", \"actual\": [[], [[5, 12], [5, 33]], 5], \"expected\": [[], [[5, 12], [5, 33]], 5], \"passed\": true}, {\"check\": \"case 5\", \"actual\": [[[7, 25]], [[4, 7], [4, 25]], 7], \"expected\": [[[7, 25]], [[4, 7], [4, 25]], 7], \"passed\": true}, {\"check\": \"case 6\", \"actual\": [[[19, 21]], [[16, 19]], 4], \"expected\": [[[19, 21]], [[16, 19]], 4], \"passed\": true}, {\"check\": \"case 7\", \"actual\": [[[5, 20]], [], 1], \"expected\": [[[5, 20]], [], 1], \"passed\": true}], \"passed\": false}\n"},"broken":{"elapsed_ms":45.969,"exit_code":1,"observations":[{"actual":[[[31,32]],[[20,26],[31,32]],5],"check":"case 0","expected":[[[31,32]],[],5],"passed":false},{"actual":[[],[[11,12],[11,25],[11,28],[12,28],[15,38]],7],"check":"case 1","expected":[[],[[11,25],[15,38]],7],"passed":false},{"actual":[[[14,19]],[[10,14],[10,15],[10,19],[10,22],[15,19],[19,22]],13],"check":"case 2","expected":[[[14,19]],[[10,14],[10,19],[10,22],[15,19]],13],"passed":false},{"actual":[[],[],0],"check":"case 3","expected":[[],[],0],"passed":true},{"actual":[[],[[5,12],[5,32],[5,33]],5],"check":"case 4","expected":[[],[[5,12],[5,33]],5],"passed":false},{"actual":[[[7,25]],[[4,7],[4,25]],7],"check":"case 5","expected":[[[7,25]],[[4,7],[4,25]],7],"passed":true},{"actual":[[[19,21]],[[16,19],[21,36]],4],"check":"case 6","expected":[[[19,21]],[[16,19]],4],"passed":false},{"actual":[[[5,20]],[],1],"check":"case 7","expected":[[[5,20]],[],1],"passed":true}],"passed":false,"stderr":"","stdout":"{\"observations\": [{\"check\": \"case 0\", \"actual\": [[[31, 32]], [[20, 26], [31, 32]], 5], \"expected\": [[[31, 32]], [], 5], \"passed\": false}, {\"check\": \"case 1\", \"actual\": [[], [[11, 12], [11, 25], [11, 28], [12, 28], [15, 38]], 7], \"expected\": [[], [[11, 25], [15, 38]], 7], \"passed\": false}, {\"check\": \"case 2\", \"actual\": [[[14, 19]], [[10, 14], [10, 15], [10, 19], [10, 22], [15, 19], [19, 22]], 13], \"expected\": [[[14, 19]], [[10, 14], [10, 19], [10, 22], [15, 19]], 13], \"passed\": false}, {\"check\": \"case 3\", \"actual\": [[], [], 0], \"expected\": [[], [], 0], \"passed\": true}, {\"check\": \"case 4\", \"actual\": [[], [[5, 12], [5, 32], [5, 33]], 5], \"expected\": [[], [[5, 12], [5, 33]], 5], \"passed\": false}, {\"check\": \"case 5\", \"actual\": [[[7, 25]], [[4, 7], [4, 25]], 7], \"expected\": [[[7, 25]], [[4, 7], [4, 25]], 7], \"passed\": true}, {\"check\": \"case 6\", \"actual\": [[[19, 21]], [[16, 19], [21, 36]], 4], \"expected\": [[[19, 21]], [[16, 19]], 4], \"passed\": false}, {\"check\": \"case 7\", \"actual\": [[[5, 20]], [], 1], \"expected\": [[[5, 20]], [], 1], \"passed\": true}], \"passed\": false}\n"}},"member_only":{"stages":["fixed"],"fields":["implementations.fixed","verification.fixed","harness","repair"],"note":"The verified repair, its recorded checks, the repair description, and the scoring harness are available to members."}}