broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import sqlite3
N = 1
observations = []
def solve(rows, refs):
    db = sqlite3.connect(':memory:')
    try:
        for name, records in [('a', rows), ('b', refs)]:
            db.execute('CREATE TABLE ' + name + ' (id INTEGER PRIMARY KEY, k TEXT, v INTEGER, w INTEGER, flag INTEGER, parent INTEGER)')
            db.executemany('INSERT INTO ' + name + ' VALUES (?,?,?,?,?,?)', records)
        return sorted([list(row) for row in db.execute('SELECT k FROM a WHERE k IS NOT NULL GROUP BY k HAVING COUNT(v)>=(SELECT COUNT(v) FROM b)')], key=repr)
    finally:
        db.close()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[11, None, None, 3, None, None], [21, None, None, 4, None, None], [31, 'x', None, 5, None, None]], [[11, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[11, 'a', 0, 9, 0, 11]], [[11, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[11, 'n', -2, 4, -1, 11], [21, 'n', None, 2, 0, 21], [31, 'n', -1, 0, 2, None]], [[11, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[11, 'p', 2, 1, 1, 11], [21, 'p', 2, 2, 1, 11], [31, 'p', 3, 0, 1, 11], [41, 'p', None, 1, 0, None]], [[11, 'p', 2, 1, 1, None], [21, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[11, None, 2, 1, None, None], [21, 'b', 0, 1, 0, 31], [31, 'c', 2, 3, 0, 11], [41, None, -1, 1, None, 191], [51, 'A', -2, 2, 2, 191], [61, 'b', 5, 2, 1, None], [71, 'a', -2, 7, -1, 191], [81, 'b', 3, 1, 0, 31], [91, 'A', 2, 0, 0, None], [101, 'b', 2, 0, 2, 31]], [[11, 'a', -1, 2, 0, 21], [21, 'a', -3, 2, None, 191], [31, 'c', 2, 1, 1, None], [41, '', -2, 7, 1, 21]]), [])
elif N == 2:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[12, None, None, 3, None, None], [22, None, None, 4, None, None], [32, 'x', None, 5, None, None]], [[12, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[12, 'a', 0, 9, 0, 12]], [[12, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[12, 'n', -2, 4, -1, 12], [22, 'n', None, 2, 0, 22], [32, 'n', -1, 0, 2, None]], [[12, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[12, 'p', 2, 1, 1, 12], [22, 'p', 2, 2, 1, 12], [32, 'p', 3, 0, 1, 12], [42, 'p', None, 1, 0, None]], [[12, 'p', 2, 1, 1, None], [22, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[12, None, 2, 1, None, None], [22, 'b', 0, 1, 0, 32], [32, 'c', 2, 3, 0, 12], [42, None, -1, 1, None, 192], [52, 'A', -2, 2, 2, 192], [62, 'b', 5, 2, 1, None], [72, 'a', -2, 7, -1, 192], [82, 'b', 3, 1, 0, 32], [92, 'A', 2, 0, 0, None], [102, 'b', 2, 0, 2, 32]], [[12, 'a', -1, 2, 0, 22], [22, 'a', -3, 2, None, 192], [32, 'c', 2, 1, 1, None], [42, '', -2, 7, 1, 22]]), [])
elif N == 3:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[13, None, None, 3, None, None], [23, None, None, 4, None, None], [33, 'x', None, 5, None, None]], [[13, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[13, 'a', 0, 9, 0, 13]], [[13, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[13, 'n', -2, 4, -1, 13], [23, 'n', None, 2, 0, 23], [33, 'n', -1, 0, 2, None]], [[13, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[13, 'p', 2, 1, 1, 13], [23, 'p', 2, 2, 1, 13], [33, 'p', 3, 0, 1, 13], [43, 'p', None, 1, 0, None]], [[13, 'p', 2, 1, 1, None], [23, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[13, None, 2, 1, None, None], [23, 'b', 0, 1, 0, 33], [33, 'c', 2, 3, 0, 13], [43, None, -1, 1, None, 193], [53, 'A', -2, 2, 2, 193], [63, 'b', 5, 2, 1, None], [73, 'a', -2, 7, -1, 193], [83, 'b', 3, 1, 0, 33], [93, 'A', 2, 0, 0, None], [103, 'b', 2, 0, 2, 33]], [[13, 'a', -1, 2, 0, 23], [23, 'a', -3, 2, None, 193], [33, 'c', 2, 1, 1, None], [43, '', -2, 7, 1, 23]]), [])
elif N == 4:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[14, None, None, 3, None, None], [24, None, None, 4, None, None], [34, 'x', None, 5, None, None]], [[14, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[14, 'a', 0, 9, 0, 14]], [[14, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[14, 'n', -2, 4, -1, 14], [24, 'n', None, 2, 0, 24], [34, 'n', -1, 0, 2, None]], [[14, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[14, 'p', 2, 1, 1, 14], [24, 'p', 2, 2, 1, 14], [34, 'p', 3, 0, 1, 14], [44, 'p', None, 1, 0, None]], [[14, 'p', 2, 1, 1, None], [24, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[14, None, 2, 1, None, None], [24, 'b', 0, 1, 0, 34], [34, 'c', 2, 3, 0, 14], [44, None, -1, 1, None, 194], [54, 'A', -2, 2, 2, 194], [64, 'b', 5, 2, 1, None], [74, 'a', -2, 7, -1, 194], [84, 'b', 3, 1, 0, 34], [94, 'A', 2, 0, 0, None], [104, 'b', 2, 0, 2, 34]], [[14, 'a', -1, 2, 0, 24], [24, 'a', -3, 2, None, 194], [34, 'c', 2, 1, 1, None], [44, '', -2, 7, 1, 24]]), [])
elif N == 5:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[15, None, None, 3, None, None], [25, None, None, 4, None, None], [35, 'x', None, 5, None, None]], [[15, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[15, 'a', 0, 9, 0, 15]], [[15, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[15, 'n', -2, 4, -1, 15], [25, 'n', None, 2, 0, 25], [35, 'n', -1, 0, 2, None]], [[15, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[15, 'p', 2, 1, 1, 15], [25, 'p', 2, 2, 1, 15], [35, 'p', 3, 0, 1, 15], [45, 'p', None, 1, 0, None]], [[15, 'p', 2, 1, 1, None], [25, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[15, None, 2, 1, None, None], [25, 'b', 0, 1, 0, 35], [35, 'c', 2, 3, 0, 15], [45, None, -1, 1, None, 195], [55, 'A', -2, 2, 2, 195], [65, 'b', 5, 2, 1, None], [75, 'a', -2, 7, -1, 195], [85, 'b', 3, 1, 0, 35], [95, 'A', 2, 0, 0, None], [105, 'b', 2, 0, 2, 35]], [[15, 'a', -1, 2, 0, 25], [25, 'a', -3, 2, None, 195], [35, 'c', 2, 1, 1, None], [45, '', -2, 7, 1, 25]]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

evaluation_group: xs-division-coverage

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import sqlite3
N = 1
observations = []
def solve(rows, refs):
    db = sqlite3.connect(':memory:')
    try:
        for name, records in [('a', rows), ('b', refs)]:
            db.execute('CREATE TABLE ' + name + ' (id INTEGER PRIMARY KEY, k TEXT, v INTEGER, w INTEGER, flag INTEGER, parent INTEGER)')
            db.executemany('INSERT INTO ' + name + ' VALUES (?,?,?,?,?,?)', records)
        return sorted([list(row) for row in db.execute('SELECT DISTINCT x.k FROM a x WHERE x.k IS NOT NULL AND NOT EXISTS(SELECT 1 FROM b WHERE b.v IS NOT NULL AND NOT EXISTS(SELECT 1 FROM a y WHERE y.v=b.v))')], key=repr)
    finally:
        db.close()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[11, None, None, 3, None, None], [21, None, None, 4, None, None], [31, 'x', None, 5, None, None]], [[11, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[11, 'a', 0, 9, 0, 11]], [[11, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[11, 'n', -2, 4, -1, 11], [21, 'n', None, 2, 0, 21], [31, 'n', -1, 0, 2, None]], [[11, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[11, 'p', 2, 1, 1, 11], [21, 'p', 2, 2, 1, 11], [31, 'p', 3, 0, 1, 11], [41, 'p', None, 1, 0, None]], [[11, 'p', 2, 1, 1, None], [21, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[11, None, 2, 1, None, None], [21, 'b', 0, 1, 0, 31], [31, 'c', 2, 3, 0, 11], [41, None, -1, 1, None, 191], [51, 'A', -2, 2, 2, 191], [61, 'b', 5, 2, 1, None], [71, 'a', -2, 7, -1, 191], [81, 'b', 3, 1, 0, 31], [91, 'A', 2, 0, 0, None], [101, 'b', 2, 0, 2, 31]], [[11, 'a', -1, 2, 0, 21], [21, 'a', -3, 2, None, 191], [31, 'c', 2, 1, 1, None], [41, '', -2, 7, 1, 21]]), [])
elif N == 2:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[12, None, None, 3, None, None], [22, None, None, 4, None, None], [32, 'x', None, 5, None, None]], [[12, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[12, 'a', 0, 9, 0, 12]], [[12, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[12, 'n', -2, 4, -1, 12], [22, 'n', None, 2, 0, 22], [32, 'n', -1, 0, 2, None]], [[12, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[12, 'p', 2, 1, 1, 12], [22, 'p', 2, 2, 1, 12], [32, 'p', 3, 0, 1, 12], [42, 'p', None, 1, 0, None]], [[12, 'p', 2, 1, 1, None], [22, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[12, None, 2, 1, None, None], [22, 'b', 0, 1, 0, 32], [32, 'c', 2, 3, 0, 12], [42, None, -1, 1, None, 192], [52, 'A', -2, 2, 2, 192], [62, 'b', 5, 2, 1, None], [72, 'a', -2, 7, -1, 192], [82, 'b', 3, 1, 0, 32], [92, 'A', 2, 0, 0, None], [102, 'b', 2, 0, 2, 32]], [[12, 'a', -1, 2, 0, 22], [22, 'a', -3, 2, None, 192], [32, 'c', 2, 1, 1, None], [42, '', -2, 7, 1, 22]]), [])
elif N == 3:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[13, None, None, 3, None, None], [23, None, None, 4, None, None], [33, 'x', None, 5, None, None]], [[13, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[13, 'a', 0, 9, 0, 13]], [[13, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[13, 'n', -2, 4, -1, 13], [23, 'n', None, 2, 0, 23], [33, 'n', -1, 0, 2, None]], [[13, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[13, 'p', 2, 1, 1, 13], [23, 'p', 2, 2, 1, 13], [33, 'p', 3, 0, 1, 13], [43, 'p', None, 1, 0, None]], [[13, 'p', 2, 1, 1, None], [23, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[13, None, 2, 1, None, None], [23, 'b', 0, 1, 0, 33], [33, 'c', 2, 3, 0, 13], [43, None, -1, 1, None, 193], [53, 'A', -2, 2, 2, 193], [63, 'b', 5, 2, 1, None], [73, 'a', -2, 7, -1, 193], [83, 'b', 3, 1, 0, 33], [93, 'A', 2, 0, 0, None], [103, 'b', 2, 0, 2, 33]], [[13, 'a', -1, 2, 0, 23], [23, 'a', -3, 2, None, 193], [33, 'c', 2, 1, 1, None], [43, '', -2, 7, 1, 23]]), [])
elif N == 4:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[14, None, None, 3, None, None], [24, None, None, 4, None, None], [34, 'x', None, 5, None, None]], [[14, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[14, 'a', 0, 9, 0, 14]], [[14, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[14, 'n', -2, 4, -1, 14], [24, 'n', None, 2, 0, 24], [34, 'n', -1, 0, 2, None]], [[14, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[14, 'p', 2, 1, 1, 14], [24, 'p', 2, 2, 1, 14], [34, 'p', 3, 0, 1, 14], [44, 'p', None, 1, 0, None]], [[14, 'p', 2, 1, 1, None], [24, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[14, None, 2, 1, None, None], [24, 'b', 0, 1, 0, 34], [34, 'c', 2, 3, 0, 14], [44, None, -1, 1, None, 194], [54, 'A', -2, 2, 2, 194], [64, 'b', 5, 2, 1, None], [74, 'a', -2, 7, -1, 194], [84, 'b', 3, 1, 0, 34], [94, 'A', 2, 0, 0, None], [104, 'b', 2, 0, 2, 34]], [[14, 'a', -1, 2, 0, 24], [24, 'a', -3, 2, None, 194], [34, 'c', 2, 1, 1, None], [44, '', -2, 7, 1, 24]]), [])
elif N == 5:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[15, None, None, 3, None, None], [25, None, None, 4, None, None], [35, 'x', None, 5, None, None]], [[15, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[15, 'a', 0, 9, 0, 15]], [[15, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[15, 'n', -2, 4, -1, 15], [25, 'n', None, 2, 0, 25], [35, 'n', -1, 0, 2, None]], [[15, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[15, 'p', 2, 1, 1, 15], [25, 'p', 2, 2, 1, 15], [35, 'p', 3, 0, 1, 15], [45, 'p', None, 1, 0, None]], [[15, 'p', 2, 1, 1, None], [25, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[15, None, 2, 1, None, None], [25, 'b', 0, 1, 0, 35], [35, 'c', 2, 3, 0, 15], [45, None, -1, 1, None, 195], [55, 'A', -2, 2, 2, 195], [65, 'b', 5, 2, 1, None], [75, 'a', -2, 7, -1, 195], [85, 'b', 3, 1, 0, 35], [95, 'A', 2, 0, 0, None], [105, 'b', 2, 0, 2, 35]], [[15, 'a', -1, 2, 0, 25], [25, 'a', -3, 2, None, 195], [35, 'c', 2, 1, 1, None], [45, '', -2, 7, 1, 25]]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The query violates its result contract: uses row count rather than distinct requirement coverage.

Return distinct known a.k whose known a.v cover every distinct known b.v requirement; no requirements makes all candidate keys eligible. Inputs are finite relations a=rows and b=refs with columns (id,k,v,w,flag,parent). IDs are unique within each relation, None is SQL NULL, keys are ASCII strings or None, and other values are integers or None. Return an unordered result bag as lists sorted by repr, preserving multiplicity unless explicitly distinct.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import sqlite3
N = 1
observations = []
def solve(rows, refs):
    db = sqlite3.connect(':memory:')
    try:
        for name, records in [('a', rows), ('b', refs)]:
            db.execute('CREATE TABLE ' + name + ' (id INTEGER PRIMARY KEY, k TEXT, v INTEGER, w INTEGER, flag INTEGER, parent INTEGER)')
            db.executemany('INSERT INTO ' + name + ' VALUES (?,?,?,?,?,?)', records)
        return sorted([list(row) for row in db.execute('SELECT DISTINCT x.k FROM a x WHERE x.k IS NOT NULL AND NOT EXISTS(SELECT 1 FROM b WHERE b.v IS NOT NULL AND NOT EXISTS(SELECT 1 FROM a y WHERE y.v=b.v))')], key=repr)
    finally:
        db.close()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[11, None, None, 3, None, None], [21, None, None, 4, None, None], [31, 'x', None, 5, None, None]], [[11, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[11, 'a', 0, 9, 0, 11]], [[11, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[11, 'n', -2, 4, -1, 11], [21, 'n', None, 2, 0, 21], [31, 'n', -1, 0, 2, None]], [[11, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[11, 'p', 2, 1, 1, 11], [21, 'p', 2, 2, 1, 11], [31, 'p', 3, 0, 1, 11], [41, 'p', None, 1, 0, None]], [[11, 'p', 2, 1, 1, None], [21, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[11, None, 2, 1, None, None], [21, 'b', 0, 1, 0, 31], [31, 'c', 2, 3, 0, 11], [41, None, -1, 1, None, 191], [51, 'A', -2, 2, 2, 191], [61, 'b', 5, 2, 1, None], [71, 'a', -2, 7, -1, 191], [81, 'b', 3, 1, 0, 31], [91, 'A', 2, 0, 0, None], [101, 'b', 2, 0, 2, 31]], [[11, 'a', -1, 2, 0, 21], [21, 'a', -3, 2, None, 191], [31, 'c', 2, 1, 1, None], [41, '', -2, 7, 1, 21]]), [])
elif N == 2:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[12, None, None, 3, None, None], [22, None, None, 4, None, None], [32, 'x', None, 5, None, None]], [[12, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[12, 'a', 0, 9, 0, 12]], [[12, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[12, 'n', -2, 4, -1, 12], [22, 'n', None, 2, 0, 22], [32, 'n', -1, 0, 2, None]], [[12, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[12, 'p', 2, 1, 1, 12], [22, 'p', 2, 2, 1, 12], [32, 'p', 3, 0, 1, 12], [42, 'p', None, 1, 0, None]], [[12, 'p', 2, 1, 1, None], [22, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[12, None, 2, 1, None, None], [22, 'b', 0, 1, 0, 32], [32, 'c', 2, 3, 0, 12], [42, None, -1, 1, None, 192], [52, 'A', -2, 2, 2, 192], [62, 'b', 5, 2, 1, None], [72, 'a', -2, 7, -1, 192], [82, 'b', 3, 1, 0, 32], [92, 'A', 2, 0, 0, None], [102, 'b', 2, 0, 2, 32]], [[12, 'a', -1, 2, 0, 22], [22, 'a', -3, 2, None, 192], [32, 'c', 2, 1, 1, None], [42, '', -2, 7, 1, 22]]), [])
elif N == 3:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[13, None, None, 3, None, None], [23, None, None, 4, None, None], [33, 'x', None, 5, None, None]], [[13, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[13, 'a', 0, 9, 0, 13]], [[13, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[13, 'n', -2, 4, -1, 13], [23, 'n', None, 2, 0, 23], [33, 'n', -1, 0, 2, None]], [[13, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[13, 'p', 2, 1, 1, 13], [23, 'p', 2, 2, 1, 13], [33, 'p', 3, 0, 1, 13], [43, 'p', None, 1, 0, None]], [[13, 'p', 2, 1, 1, None], [23, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[13, None, 2, 1, None, None], [23, 'b', 0, 1, 0, 33], [33, 'c', 2, 3, 0, 13], [43, None, -1, 1, None, 193], [53, 'A', -2, 2, 2, 193], [63, 'b', 5, 2, 1, None], [73, 'a', -2, 7, -1, 193], [83, 'b', 3, 1, 0, 33], [93, 'A', 2, 0, 0, None], [103, 'b', 2, 0, 2, 33]], [[13, 'a', -1, 2, 0, 23], [23, 'a', -3, 2, None, 193], [33, 'c', 2, 1, 1, None], [43, '', -2, 7, 1, 23]]), [])
elif N == 4:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[14, None, None, 3, None, None], [24, None, None, 4, None, None], [34, 'x', None, 5, None, None]], [[14, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[14, 'a', 0, 9, 0, 14]], [[14, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[14, 'n', -2, 4, -1, 14], [24, 'n', None, 2, 0, 24], [34, 'n', -1, 0, 2, None]], [[14, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[14, 'p', 2, 1, 1, 14], [24, 'p', 2, 2, 1, 14], [34, 'p', 3, 0, 1, 14], [44, 'p', None, 1, 0, None]], [[14, 'p', 2, 1, 1, None], [24, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[14, None, 2, 1, None, None], [24, 'b', 0, 1, 0, 34], [34, 'c', 2, 3, 0, 14], [44, None, -1, 1, None, 194], [54, 'A', -2, 2, 2, 194], [64, 'b', 5, 2, 1, None], [74, 'a', -2, 7, -1, 194], [84, 'b', 3, 1, 0, 34], [94, 'A', 2, 0, 0, None], [104, 'b', 2, 0, 2, 34]], [[14, 'a', -1, 2, 0, 24], [24, 'a', -3, 2, None, 194], [34, 'c', 2, 1, 1, None], [44, '', -2, 7, 1, 24]]), [])
elif N == 5:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[15, None, None, 3, None, None], [25, None, None, 4, None, None], [35, 'x', None, 5, None, None]], [[15, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[15, 'a', 0, 9, 0, 15]], [[15, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[15, 'n', -2, 4, -1, 15], [25, 'n', None, 2, 0, 25], [35, 'n', -1, 0, 2, None]], [[15, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[15, 'p', 2, 1, 1, 15], [25, 'p', 2, 2, 1, 15], [35, 'p', 3, 0, 1, 15], [45, 'p', None, 1, 0, None]], [[15, 'p', 2, 1, 1, None], [25, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[15, None, 2, 1, None, None], [25, 'b', 0, 1, 0, 35], [35, 'c', 2, 3, 0, 15], [45, None, -1, 1, None, 195], [55, 'A', -2, 2, 2, 195], [65, 'b', 5, 2, 1, None], [75, 'a', -2, 7, -1, 195], [85, 'b', 3, 1, 0, 35], [95, 'A', 2, 0, 0, None], [105, 'b', 2, 0, 2, 35]], [[15, 'a', -1, 2, 0, 25], [25, 'a', -3, 2, None, 195], [35, 'c', 2, 1, 1, None], [45, '', -2, 7, 1, 25]]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

evaluation_group: xs-division-coverage

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import sqlite3
N = 1
observations = []
def solve(rows, refs):
    db = sqlite3.connect(':memory:')
    try:
        for name, records in [('a', rows), ('b', refs)]:
            db.execute('CREATE TABLE ' + name + ' (id INTEGER PRIMARY KEY, k TEXT, v INTEGER, w INTEGER, flag INTEGER, parent INTEGER)')
            db.executemany('INSERT INTO ' + name + ' VALUES (?,?,?,?,?,?)', records)
        return sorted([list(row) for row in db.execute('SELECT DISTINCT x.k FROM a x WHERE x.k IS NOT NULL AND NOT EXISTS(SELECT 1 FROM b WHERE NOT EXISTS(SELECT 1 FROM a y WHERE y.k=x.k AND y.v=b.v))')], key=repr)
    finally:
        db.close()
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
if N == 1:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[11, 'a', None, 8, None, None], [21, 'a', 0, 3, 0, 11], [31, 'a', 2, 1, 1, 21], [41, 'a', 2, 2, 2, 901], [51, 'a', -1, 4, -1, 31], [61, 'a', 3, 1, 1, 41], [71, 'b', -2, 2, 0, 11], [81, 'b', 2, 8, 1, 21], [91, 'b', None, 4, None, None], [101, None, None, 0, 1, 901], [111, None, 0, 5, 0, 11], [121, None, None, 7, None, 21], [131, 'c', None, 6, None, 31], [141, 'd', -1, 1, 0, 41], [151, 'A', 2, 2, 1, 51], [161, ' a ', 2, 8, 1, None], [171, '', None, 2, 0, None], [181, 'a', 2, 8, 1, 11], [191, 'd', 1, 3, 0, 41], [201, 'd', -1, 0, -1, 21]], [[11, 'a', None, 0, 1, None], [21, 'a', 2, 2, 0, None], [31, 'a', 2, 3, 2, None], [41, 'a', 3, 4, None, None], [51, 'b', -2, 2, 1, None], [61, 'b', 0, 8, -1, None], [71, None, None, 2, 1, None], [81, None, 0, 5, None, None], [91, 'z', 3, 2, 0, None], [101, 'z', 3, 2, 1, None], [111, 'A', 2, 1, 1, None], [121, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[11, None, None, 3, None, None], [21, None, None, 4, None, None], [31, 'x', None, 5, None, None]], [[11, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[11, 'a', 0, 9, 0, 11]], [[11, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[11, 'n', -2, 4, -1, 11], [21, 'n', None, 2, 0, 21], [31, 'n', -1, 0, 2, None]], [[11, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[11, 'p', 2, 1, 1, 11], [21, 'p', 2, 2, 1, 11], [31, 'p', 3, 0, 1, 11], [41, 'p', None, 1, 0, None]], [[11, 'p', 2, 1, 1, None], [21, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[11, None, 2, 1, None, None], [21, 'b', 0, 1, 0, 31], [31, 'c', 2, 3, 0, 11], [41, None, -1, 1, None, 191], [51, 'A', -2, 2, 2, 191], [61, 'b', 5, 2, 1, None], [71, 'a', -2, 7, -1, 191], [81, 'b', 3, 1, 0, 31], [91, 'A', 2, 0, 0, None], [101, 'b', 2, 0, 2, 31]], [[11, 'a', -1, 2, 0, 21], [21, 'a', -3, 2, None, 191], [31, 'c', 2, 1, 1, None], [41, '', -2, 7, 1, 21]]), [])
elif N == 2:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[12, 'a', None, 8, None, None], [22, 'a', 0, 3, 0, 12], [32, 'a', 2, 1, 1, 22], [42, 'a', 2, 2, 2, 902], [52, 'a', -1, 4, -1, 32], [62, 'a', 3, 1, 1, 42], [72, 'b', -2, 2, 0, 12], [82, 'b', 2, 8, 1, 22], [92, 'b', None, 4, None, None], [102, None, None, 0, 1, 902], [112, None, 0, 5, 0, 12], [122, None, None, 7, None, 22], [132, 'c', None, 6, None, 32], [142, 'd', -1, 1, 0, 42], [152, 'A', 2, 2, 1, 52], [162, ' a ', 2, 8, 1, None], [172, '', None, 2, 0, None], [182, 'a', 2, 8, 1, 12], [192, 'd', 1, 3, 0, 42], [202, 'd', -1, 0, -1, 22]], [[12, 'a', None, 0, 1, None], [22, 'a', 2, 2, 0, None], [32, 'a', 2, 3, 2, None], [42, 'a', 3, 4, None, None], [52, 'b', -2, 2, 1, None], [62, 'b', 0, 8, -1, None], [72, None, None, 2, 1, None], [82, None, 0, 5, None, None], [92, 'z', 3, 2, 0, None], [102, 'z', 3, 2, 1, None], [112, 'A', 2, 1, 1, None], [122, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[12, None, None, 3, None, None], [22, None, None, 4, None, None], [32, 'x', None, 5, None, None]], [[12, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[12, 'a', 0, 9, 0, 12]], [[12, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[12, 'n', -2, 4, -1, 12], [22, 'n', None, 2, 0, 22], [32, 'n', -1, 0, 2, None]], [[12, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[12, 'p', 2, 1, 1, 12], [22, 'p', 2, 2, 1, 12], [32, 'p', 3, 0, 1, 12], [42, 'p', None, 1, 0, None]], [[12, 'p', 2, 1, 1, None], [22, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[12, None, 2, 1, None, None], [22, 'b', 0, 1, 0, 32], [32, 'c', 2, 3, 0, 12], [42, None, -1, 1, None, 192], [52, 'A', -2, 2, 2, 192], [62, 'b', 5, 2, 1, None], [72, 'a', -2, 7, -1, 192], [82, 'b', 3, 1, 0, 32], [92, 'A', 2, 0, 0, None], [102, 'b', 2, 0, 2, 32]], [[12, 'a', -1, 2, 0, 22], [22, 'a', -3, 2, None, 192], [32, 'c', 2, 1, 1, None], [42, '', -2, 7, 1, 22]]), [])
elif N == 3:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[13, 'a', None, 8, None, None], [23, 'a', 0, 3, 0, 13], [33, 'a', 2, 1, 1, 23], [43, 'a', 2, 2, 2, 903], [53, 'a', -1, 4, -1, 33], [63, 'a', 3, 1, 1, 43], [73, 'b', -2, 2, 0, 13], [83, 'b', 2, 8, 1, 23], [93, 'b', None, 4, None, None], [103, None, None, 0, 1, 903], [113, None, 0, 5, 0, 13], [123, None, None, 7, None, 23], [133, 'c', None, 6, None, 33], [143, 'd', -1, 1, 0, 43], [153, 'A', 2, 2, 1, 53], [163, ' a ', 2, 8, 1, None], [173, '', None, 2, 0, None], [183, 'a', 2, 8, 1, 13], [193, 'd', 1, 3, 0, 43], [203, 'd', -1, 0, -1, 23]], [[13, 'a', None, 0, 1, None], [23, 'a', 2, 2, 0, None], [33, 'a', 2, 3, 2, None], [43, 'a', 3, 4, None, None], [53, 'b', -2, 2, 1, None], [63, 'b', 0, 8, -1, None], [73, None, None, 2, 1, None], [83, None, 0, 5, None, None], [93, 'z', 3, 2, 0, None], [103, 'z', 3, 2, 1, None], [113, 'A', 2, 1, 1, None], [123, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[13, None, None, 3, None, None], [23, None, None, 4, None, None], [33, 'x', None, 5, None, None]], [[13, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[13, 'a', 0, 9, 0, 13]], [[13, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[13, 'n', -2, 4, -1, 13], [23, 'n', None, 2, 0, 23], [33, 'n', -1, 0, 2, None]], [[13, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[13, 'p', 2, 1, 1, 13], [23, 'p', 2, 2, 1, 13], [33, 'p', 3, 0, 1, 13], [43, 'p', None, 1, 0, None]], [[13, 'p', 2, 1, 1, None], [23, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[13, None, 2, 1, None, None], [23, 'b', 0, 1, 0, 33], [33, 'c', 2, 3, 0, 13], [43, None, -1, 1, None, 193], [53, 'A', -2, 2, 2, 193], [63, 'b', 5, 2, 1, None], [73, 'a', -2, 7, -1, 193], [83, 'b', 3, 1, 0, 33], [93, 'A', 2, 0, 0, None], [103, 'b', 2, 0, 2, 33]], [[13, 'a', -1, 2, 0, 23], [23, 'a', -3, 2, None, 193], [33, 'c', 2, 1, 1, None], [43, '', -2, 7, 1, 23]]), [])
elif N == 4:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[14, 'a', None, 8, None, None], [24, 'a', 0, 3, 0, 14], [34, 'a', 2, 1, 1, 24], [44, 'a', 2, 2, 2, 904], [54, 'a', -1, 4, -1, 34], [64, 'a', 3, 1, 1, 44], [74, 'b', -2, 2, 0, 14], [84, 'b', 2, 8, 1, 24], [94, 'b', None, 4, None, None], [104, None, None, 0, 1, 904], [114, None, 0, 5, 0, 14], [124, None, None, 7, None, 24], [134, 'c', None, 6, None, 34], [144, 'd', -1, 1, 0, 44], [154, 'A', 2, 2, 1, 54], [164, ' a ', 2, 8, 1, None], [174, '', None, 2, 0, None], [184, 'a', 2, 8, 1, 14], [194, 'd', 1, 3, 0, 44], [204, 'd', -1, 0, -1, 24]], [[14, 'a', None, 0, 1, None], [24, 'a', 2, 2, 0, None], [34, 'a', 2, 3, 2, None], [44, 'a', 3, 4, None, None], [54, 'b', -2, 2, 1, None], [64, 'b', 0, 8, -1, None], [74, None, None, 2, 1, None], [84, None, 0, 5, None, None], [94, 'z', 3, 2, 0, None], [104, 'z', 3, 2, 1, None], [114, 'A', 2, 1, 1, None], [124, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[14, None, None, 3, None, None], [24, None, None, 4, None, None], [34, 'x', None, 5, None, None]], [[14, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[14, 'a', 0, 9, 0, 14]], [[14, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[14, 'n', -2, 4, -1, 14], [24, 'n', None, 2, 0, 24], [34, 'n', -1, 0, 2, None]], [[14, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[14, 'p', 2, 1, 1, 14], [24, 'p', 2, 2, 1, 14], [34, 'p', 3, 0, 1, 14], [44, 'p', None, 1, 0, None]], [[14, 'p', 2, 1, 1, None], [24, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[14, None, 2, 1, None, None], [24, 'b', 0, 1, 0, 34], [34, 'c', 2, 3, 0, 14], [44, None, -1, 1, None, 194], [54, 'A', -2, 2, 2, 194], [64, 'b', 5, 2, 1, None], [74, 'a', -2, 7, -1, 194], [84, 'b', 3, 1, 0, 34], [94, 'A', 2, 0, 0, None], [104, 'b', 2, 0, 2, 34]], [[14, 'a', -1, 2, 0, 24], [24, 'a', -3, 2, None, 194], [34, 'c', 2, 1, 1, None], [44, '', -2, 7, 1, 24]]), [])
elif N == 5:
    check('empty relations', solve([], []), [])
    check('left facts without references', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], []), [[' a '], [''], ['A'], ['a'], ['b'], ['c'], ['d']])
    check('references without candidates', solve([], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('mixed nullable groups duplicates ties and truth flags', solve([[15, 'a', None, 8, None, None], [25, 'a', 0, 3, 0, 15], [35, 'a', 2, 1, 1, 25], [45, 'a', 2, 2, 2, 905], [55, 'a', -1, 4, -1, 35], [65, 'a', 3, 1, 1, 45], [75, 'b', -2, 2, 0, 15], [85, 'b', 2, 8, 1, 25], [95, 'b', None, 4, None, None], [105, None, None, 0, 1, 905], [115, None, 0, 5, 0, 15], [125, None, None, 7, None, 25], [135, 'c', None, 6, None, 35], [145, 'd', -1, 1, 0, 45], [155, 'A', 2, 2, 1, 55], [165, ' a ', 2, 8, 1, None], [175, '', None, 2, 0, None], [185, 'a', 2, 8, 1, 15], [195, 'd', 1, 3, 0, 45], [205, 'd', -1, 0, -1, 25]], [[15, 'a', None, 0, 1, None], [25, 'a', 2, 2, 0, None], [35, 'a', 2, 3, 2, None], [45, 'a', 3, 4, None, None], [55, 'b', -2, 2, 1, None], [65, 'b', 0, 8, -1, None], [75, None, None, 2, 1, None], [85, None, 0, 5, None, None], [95, 'z', 3, 2, 0, None], [105, 'z', 3, 2, 1, None], [115, 'A', 2, 1, 1, None], [125, 'c', None, 2, 0, None]]), [])
    check('unknown-only group with duplicate nullable index keys', solve([[15, None, None, 3, None, None], [25, None, None, 4, None, None], [35, 'x', None, 5, None, None]], [[15, None, None, 2, None, None]]), [['x']])
    check('single known zero and matching reference', solve([[15, 'a', 0, 9, 0, 15]], [[15, 'a', 0, 3, 1, None]]), [['a']])
    check('negative-only group and missing measurement', solve([[15, 'n', -2, 4, -1, 15], [25, 'n', None, 2, 0, 25], [35, 'n', -1, 0, 2, None]], [[15, 'n', -2, 1, 1, None]]), [['n']])
    check('positive-only group with repeated measurements and NULL', solve([[15, 'p', 2, 1, 1, 15], [25, 'p', 2, 2, 1, 15], [35, 'p', 3, 0, 1, 15], [45, 'p', None, 1, 0, None]], [[15, 'p', 2, 1, 1, None], [25, 'p', 2, 1, 1, None]]), [['p']])
    check('adversarial key cardinality and NULL placement witness 6', solve([[15, None, 2, 1, None, None], [25, 'b', 0, 1, 0, 35], [35, 'c', 2, 3, 0, 15], [45, None, -1, 1, None, 195], [55, 'A', -2, 2, 2, 195], [65, 'b', 5, 2, 1, None], [75, 'a', -2, 7, -1, 195], [85, 'b', 3, 1, 0, 35], [95, 'A', 2, 0, 0, None], [105, 'b', 2, 0, 2, 35]], [[15, 'a', -1, 2, 0, 25], [25, 'a', -3, 2, None, 195], [35, 'c', 2, 1, 1, None], [45, '', -2, 7, 1, 25]]), [])
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The query violates its result contract: uses all source keys collectively to cover requirements.

Return distinct known a.k whose known a.v cover every distinct known b.v requirement; no requirements makes all candidate keys eligible. Inputs are finite relations a=rows and b=refs with columns (id,k,v,w,flag,parent). IDs are unique within each relation, None is SQL NULL, keys are ASCII strings or None, and other values are integers or None. Return an unordered result bag as lists sorted by repr, preserving multiplicity unless explicitly distinct.

split: open-access