broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(files, width):
    mx = max([f[1] + f[2] for f in files if f[1] is not None] + [0])
    lines = []
    ins = dels = changed = 0
    for path, add, rem in files:
        changed += 1
        if add is None:
            lines.append('%s | Bin' % path)
            continue
        ins += add
        dels += rem
        if mx > width:
            pa = add * width // mx
            pr = rem * width // mx
            if add and not pa:
                pa = 1
            if rem and not pr:
                pr = 1
        else:
            pa, pr = add, rem
        lines.append('%s | %d %s' % (path, add + rem, '+' * pa + '-' * pr))
    summary = '%d file%s changed' % (changed, '' if changed == 1 else 's')
    if ins:
        summary += ', %d insertions(+)' % ins
    if dels:
        summary += ', %d deletion%s(-)' % (dels, '' if dels == 1 else 's')
    lines.append(summary)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 5]], 40], ['gone | 5 -----', '1 file changed, 5 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 10, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 10 ++', '2 files changed, 40 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 1, 1]], 5], ['p | 1 +', 'q | 1 -', 'r | 2 +-', '3 files changed, 2 insertions(+), 2 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img1.png', None, None]], 40], ['img1.png | Bin', '1 file changed'])],
    2: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 6]], 40], ['gone | 6 ------', '1 file changed, 6 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 20, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 20 +++++', '2 files changed, 50 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 2, 2]], 5], ['p | 1 +', 'q | 1 -', 'r | 4 ++--', '3 files changed, 3 insertions(+), 3 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img2.png', None, None]], 40], ['img2.png | Bin', '1 file changed'])],
    3: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 7]], 40], ['gone | 7 -------', '1 file changed, 7 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 30, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 30 +++++++', '2 files changed, 60 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 3, 3]], 5], ['p | 1 +', 'q | 1 -', 'r | 6 ++--', '3 files changed, 4 insertions(+), 4 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img3.png', None, None]], 40], ['img3.png | Bin', '1 file changed'])],
    4: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 8]], 40], ['gone | 8 --------', '1 file changed, 8 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 40, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 40 ++++++++++', '2 files changed, 70 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 4, 4]], 5], ['p | 1 +', 'q | 1 -', 'r | 8 ++--', '3 files changed, 5 insertions(+), 5 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img4.png', None, None]], 40], ['img4.png | Bin', '1 file changed'])],
    5: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 9]], 40], ['gone | 9 ---------', '1 file changed, 9 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 50, 0]], 10], ['f1 | 40 ++++++--', 'f2 | 50 ++++++++++', '2 files changed, 80 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 5, 5]], 5], ['p | 1 +', 'q | 1 -', 'r | 10 ++--', '3 files changed, 6 insertions(+), 6 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img5.png', None, None]], 40], ['img5.png | Bin', '1 file changed'])],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(files, width):
    mx = max([f[1] + f[2] for f in files if f[1] is not None] + [0])
    lines = []
    ins = dels = changed = 0
    for path, add, rem in files:
        changed += 1
        if add is None:
            lines.append('%s | Bin' % path)
            continue
        ins += add
        dels += rem
        if mx > width:
            pa = add * width // mx
            pr = rem * width // mx
            if add and not pa:
                pa = 1
            if rem and not pr:
                pr = 1
        else:
            pa, pr = add, rem
        lines.append('%s | %d %s' % (path, add + rem, '+' * pa + '-' * pr))
    summary = '%d file%s changed' % (changed, '' if changed == 1 else 's')
    if ins:
        summary += ', %d insertion%s(+)' % (ins, '' if changed == 1 else 's')
    if dels:
        summary += ', %d deletion%s(-)' % (dels, '' if dels == 1 else 's')
    lines.append(summary)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 5]], 40], ['gone | 5 -----', '1 file changed, 5 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 10, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 10 ++', '2 files changed, 40 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 1, 1]], 5], ['p | 1 +', 'q | 1 -', 'r | 2 +-', '3 files changed, 2 insertions(+), 2 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img1.png', None, None]], 40], ['img1.png | Bin', '1 file changed'])],
    2: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 6]], 40], ['gone | 6 ------', '1 file changed, 6 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 20, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 20 +++++', '2 files changed, 50 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 2, 2]], 5], ['p | 1 +', 'q | 1 -', 'r | 4 ++--', '3 files changed, 3 insertions(+), 3 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img2.png', None, None]], 40], ['img2.png | Bin', '1 file changed'])],
    3: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 7]], 40], ['gone | 7 -------', '1 file changed, 7 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 30, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 30 +++++++', '2 files changed, 60 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 3, 3]], 5], ['p | 1 +', 'q | 1 -', 'r | 6 ++--', '3 files changed, 4 insertions(+), 4 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img3.png', None, None]], 40], ['img3.png | Bin', '1 file changed'])],
    4: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 8]], 40], ['gone | 8 --------', '1 file changed, 8 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 40, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 40 ++++++++++', '2 files changed, 70 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 4, 4]], 5], ['p | 1 +', 'q | 1 -', 'r | 8 ++--', '3 files changed, 5 insertions(+), 5 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img4.png', None, None]], 40], ['img4.png | Bin', '1 file changed'])],
    5: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 9]], 40], ['gone | 9 ---------', '1 file changed, 9 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 50, 0]], 10], ['f1 | 40 ++++++--', 'f2 | 50 ++++++++++', '2 files changed, 80 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 5, 5]], 5], ['p | 1 +', 'q | 1 -', 'r | 10 ++--', '3 files changed, 6 insertions(+), 6 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img5.png', None, None]], 40], ['img5.png | Bin', '1 file changed'])],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
The summary reads "1 insertions(+)".

Files are [path, added, removed], with None counts for binary files. Each text file prints "path | total +++---"; when the largest total exceeds width, both counts scale by width/max with floor, but a non-zero count keeps at least one mark. Binary files print "path | Bin". The summary counts files and, when non-zero, insertions and deletions with singular/plural wording.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(files, width):
    mx = max([f[1] + f[2] for f in files if f[1] is not None] + [0])
    lines = []
    ins = dels = changed = 0
    for path, add, rem in files:
        changed += 1
        if add is None:
            lines.append('%s | Bin' % path)
            continue
        ins += add
        dels += rem
        if mx > width:
            pa = add * width // mx
            pr = rem * width // mx
            if add and not pa:
                pa = 1
            if rem and not pr:
                pr = 1
        else:
            pa, pr = add, rem
        lines.append('%s | %d %s' % (path, add + rem, '+' * pa + '-' * pr))
    summary = '%d file%s changed' % (changed, '' if changed == 1 else 's')
    if True:
        summary += ', %d insertion%s(+)' % (ins, '' if ins == 1 else 's')
    if dels:
        summary += ', %d deletion%s(-)' % (dels, '' if dels == 1 else 's')
    lines.append(summary)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 5]], 40], ['gone | 5 -----', '1 file changed, 5 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 10, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 10 ++', '2 files changed, 40 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 1, 1]], 5], ['p | 1 +', 'q | 1 -', 'r | 2 +-', '3 files changed, 2 insertions(+), 2 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img1.png', None, None]], 40], ['img1.png | Bin', '1 file changed'])],
    2: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 6]], 40], ['gone | 6 ------', '1 file changed, 6 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 20, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 20 +++++', '2 files changed, 50 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 2, 2]], 5], ['p | 1 +', 'q | 1 -', 'r | 4 ++--', '3 files changed, 3 insertions(+), 3 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img2.png', None, None]], 40], ['img2.png | Bin', '1 file changed'])],
    3: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 7]], 40], ['gone | 7 -------', '1 file changed, 7 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 30, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 30 +++++++', '2 files changed, 60 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 3, 3]], 5], ['p | 1 +', 'q | 1 -', 'r | 6 ++--', '3 files changed, 4 insertions(+), 4 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img3.png', None, None]], 40], ['img3.png | Bin', '1 file changed'])],
    4: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 8]], 40], ['gone | 8 --------', '1 file changed, 8 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 40, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 40 ++++++++++', '2 files changed, 70 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 4, 4]], 5], ['p | 1 +', 'q | 1 -', 'r | 8 ++--', '3 files changed, 5 insertions(+), 5 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img4.png', None, None]], 40], ['img4.png | Bin', '1 file changed'])],
    5: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 9]], 40], ['gone | 9 ---------', '1 file changed, 9 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 50, 0]], 10], ['f1 | 40 ++++++--', 'f2 | 50 ++++++++++', '2 files changed, 80 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 5, 5]], 5], ['p | 1 +', 'q | 1 -', 'r | 10 ++--', '3 files changed, 6 insertions(+), 6 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img5.png', None, None]], 40], ['img5.png | Bin', '1 file changed'])],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

source:
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(files, width):
    mx = max([f[1] + f[2] for f in files if f[1] is not None] + [0])
    lines = []
    ins = dels = changed = 0
    for path, add, rem in files:
        changed += 1
        if add is None:
            lines.append('%s | Bin' % path)
            continue
        ins += add
        dels += rem
        if mx > width:
            pa = add * width // mx
            pr = rem * width // mx
            if add and not pa:
                pa = 1
            if rem and not pr:
                pr = 1
        else:
            pa, pr = add, rem
        lines.append('%s | %d %s' % (path, add + rem, '+' * pa + '-' * pr))
    summary = '%d file%s changed' % (changed, '' if changed == 1 else 's')
    if ins or not dels:
        summary += ', %d insertion%s(+)' % (ins, '' if ins == 1 else 's')
    if dels:
        summary += ', %d deletion%s(-)' % (dels, '' if dels == 1 else 's')
    lines.append(summary)
    return lines
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 5]], 40], ['gone | 5 -----', '1 file changed, 5 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 10, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 10 ++', '2 files changed, 40 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 1, 1]], 5], ['p | 1 +', 'q | 1 -', 'r | 2 +-', '3 files changed, 2 insertions(+), 2 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img1.png', None, None]], 40], ['img1.png | Bin', '1 file changed'])],
    2: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 6]], 40], ['gone | 6 ------', '1 file changed, 6 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 20, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 20 +++++', '2 files changed, 50 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 2, 2]], 5], ['p | 1 +', 'q | 1 -', 'r | 4 ++--', '3 files changed, 3 insertions(+), 3 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img2.png', None, None]], 40], ['img2.png | Bin', '1 file changed'])],
    3: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 7]], 40], ['gone | 7 -------', '1 file changed, 7 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 30, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 30 +++++++', '2 files changed, 60 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 3, 3]], 5], ['p | 1 +', 'q | 1 -', 'r | 6 ++--', '3 files changed, 4 insertions(+), 4 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img3.png', None, None]], 40], ['img3.png | Bin', '1 file changed'])],
    4: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 8]], 40], ['gone | 8 --------', '1 file changed, 8 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 40, 0]], 10], ['f1 | 40 +++++++--', 'f2 | 40 ++++++++++', '2 files changed, 70 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 4, 4]], 5], ['p | 1 +', 'q | 1 -', 'r | 8 ++--', '3 files changed, 5 insertions(+), 5 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img4.png', None, None]], 40], ['img4.png | Bin', '1 file changed'])],
    5: [('small changes without scaling', [[['a.txt', 3, 1]], 40], ['a.txt | 4 +++-', '1 file changed, 3 insertions(+), 1 deletion(-)']), ('scaled bar keeps small counts visible', [[['big.c', 200, 0], ['tiny.c', 1, 1]], 20], ['big.c | 200 ++++++++++++++++++++', 'tiny.c | 2 +-', '2 files changed, 201 insertions(+), 1 deletion(-)']), ('binary file', [[['logo.png', None, None], ['x', 2, 0]], 40], ['logo.png | Bin', 'x | 2 ++', '2 files changed, 2 insertions(+)']), ('single insertion grammar', [[['one', 1, 0]], 40], ['one | 1 +', '1 file changed, 1 insertion(+)']), ('only deletions', [[['gone', 0, 9]], 40], ['gone | 9 ---------', '1 file changed, 9 deletions(-)']), ('scale uses the largest file', [[['f1', 30, 10], ['f2', 50, 0]], 10], ['f1 | 40 ++++++--', 'f2 | 50 ++++++++++', '2 files changed, 80 insertions(+), 10 deletions(-)']), ('several files', [[['p', 1, 0], ['q', 0, 1], ['r', 5, 5]], 5], ['p | 1 +', 'q | 1 -', 'r | 10 ++--', '3 files changed, 6 insertions(+), 6 deletions(-)']), ('unscaled wide change', [[['w', 12, 3]], 15], ['w | 15 ++++++++++++---', '1 file changed, 12 insertions(+), 3 deletions(-)']), ('floor not rounding when scaling', [[['r', 7, 0], ['s', 20, 0]], 10], ['r | 7 +++', 's | 20 ++++++++++', '2 files changed, 27 insertions(+)']), ('binary-only change', [[['img5.png', None, None]], 40], ['img5.png | Bin', '1 file changed'])],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A deletion-only change says "0 insertions(+)".

Files are [path, added, removed], with None counts for binary files. Each text file prints "path | total +++---"; when the largest total exceeds width, both counts scale by width/max with floor, but a non-zero count keeps at least one mark. Binary files print "path | Bin". The summary counts files and, when non-zero, insertions and deletions with singular/plural wording.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).strip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).lstrip(' \t').rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Indenting a line is not reported under -b, although whitespace appeared where there was none.

Normalize each line: with strip_cr remove one trailing "\r"; mode "w" deletes all whitespace (str.split semantics); mode "b" collapses runs of spaces and tabs to one space and strips trailing spaces and tabs; mode "none" leaves the line. With ignore_blank, drop lines whose normalized key is empty. Return both key lists and whether they are equal.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ ]+', ' ', line).rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr and line.endswith('\r'):
            line = line[:-1]
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'\s+', ' ', line).rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Replacing a tab with a space is reported as a change under -b.

Normalize each line: with strip_cr remove one trailing "\r"; mode "w" deletes all whitespace (str.split semantics); mode "b" collapses runs of spaces and tabs to one space and strips trailing spaces and tabs; mode "none" leaves the line. With ignore_blank, drop lines whose normalized key is empty. Return both key lists and whether they are equal.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr:
            line = line.rstrip('\r')
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

source:
"""Failure Map reference implementation. Python standard library only."""
import json
import re
N = 1
observations = []
def solve(a, b, mode, strip_cr, ignore_blank):
    def norm(line):
        if strip_cr:
            line = line.replace('\r', '')
        if mode == 'w':
            return ''.join(line.split())
        if mode == 'b':
            return re.sub(r'[ \t]+', ' ', line).rstrip(' \t')
        return line
    ka = [norm(x) for x in a]
    kb = [norm(x) for x in b]
    if ignore_blank:
        ka = [x for x in ka if x != '']
        kb = [x for x in kb if x != '']
    return {'a': ka, 'b': kb, 'equal': ka == kb}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
cases = {
    1: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    2: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    3: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    4: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
    5: [('amount of whitespace ignored', [['a  b', 'c\t\td  '], ['a b', 'c d'], 'b', False, False], {'a': ['a b', 'c d'], 'b': ['a b', 'c d'], 'equal': True}), ('leading whitespace presence matters under -b', [['  x'], ['x'], 'b', False, False], {'a': [' x'], 'b': ['x'], 'equal': False}), ('all whitespace ignored', [['a b c', ' \t'], ['abc', ''], 'w', False, False], {'a': ['abc', ''], 'b': ['abc', ''], 'equal': True}), ('carriage return stripped once', [['line\r', 'two\r\r'], ['line', 'two\r'], 'none', True, False], {'a': ['line', 'two\r'], 'b': ['line', 'two'], 'equal': False}), ('carriage return kept without the flag', [['cr\r'], ['cr'], 'b', False, False], {'a': ['cr\r'], 'b': ['cr'], 'equal': False}), ('interior carriage return is content', [['a\rb'], ['ab'], 'none', True, False], {'a': ['a\rb'], 'b': ['ab'], 'equal': False}), ('whitespace-only line is blank only when normalized empty', [['x', '   ', 'y'], ['x', 'y'], 'none', False, True], {'a': ['x', '   ', 'y'], 'b': ['x', 'y'], 'equal': False}), ('blank lines ignored under -w', [['x', ' \t ', 'y', '', '', '', '', ''], ['x', 'y'], 'w', False, True], {'a': ['x', 'y'], 'b': ['x', 'y'], 'equal': True}), ('tabs under -w', [['k\tv', 'q'], ['kv', 'q'], 'w', False, False], {'a': ['kv', 'q'], 'b': ['kv', 'q'], 'equal': True}), ('vertical tab under -w', [['m\x0bn'], ['mn'], 'w', False, False], {'a': ['mn'], 'b': ['mn'], 'equal': True})],
}[N]
for label, args, expected in cases:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Lines ending in two carriage returns compare equal to lines with one.

Normalize each line: with strip_cr remove one trailing "\r"; mode "w" deletes all whitespace (str.split semantics); mode "b" collapses runs of spaces and tabs to one space and strips trailing spaces and tabs; mode "none" leaves the line. With ignore_blank, drop lines whose normalized key is empty. Return both key lists and whether they are equal.

split: open-access