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

N = 1
observations = []
def solve(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card) - deductions[1]
        tb = sum(r[1] for r in card) - deductions[0]
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        elif d == 1:
            kind = 'majority decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    elif d == 2:
        kind = 'majority draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 9], [10, 10], [10, 10], [8, 10], [9, 10], [10, 9]],
     [[10, 9], [10, 9], [8, 10], [10, 8], [9, 10], [8, 10]],
     [[10, 9], [10, 9], [10, 10], [10, 9], [8, 10], [10, 8]]],
    [0, 1]),
   ['majority draw', None, ['57-57', '55-55', '58-54']]),
  ('variant scenario 1',
   ([[[9, 10], [10, 9], [10, 9], [8, 10], [10, 10], [10, 8]],
     [[10, 8], [9, 10], [10, 9], [8, 10], [8, 10], [10, 9]],
     [[10, 8], [8, 10], [10, 8], [10, 10], [10, 8], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['57-56', '55-56', '58-52']]),
  ('variant scenario 2',
   ([[[10, 9],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 8],
      [10, 8],
      [9, 10],
      [10, 8],
      [10, 10],
      [10, 9]],
     [[8, 10],
      [8, 10],
      [9, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [8, 10],
      [8, 10],
      [8, 10],
      [10, 9],
      [10, 8],
      [10, 10]],
     [[10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [9, 10],
      [10, 8],
      [8, 10],
      [10, 10],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 8]]],
    [0, 1]),
   ['split decision', 'A', ['119-106', '108-113', '115-110']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [10, 8]],
     [[9, 10],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 9],
      [10, 8],
      [10, 9]],
     [[10, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 8]]],
    [0, 1]),
   ['unanimous decision', 'A', ['110-109', '118-107', '117-107']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [10, 8], [9, 10], [10, 10], [10, 10]],
     [[10, 10], [10, 9], [10, 9], [10, 8], [10, 10], [10, 9]],
     [[10, 10], [10, 8], [10, 9], [10, 8], [10, 10], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['59-57', '60-55', '60-54']]),
  ('variant scenario 2',
   ([[[9, 10],
      [8, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 9],
      [10, 10],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [8, 10]],
     [[8, 10],
      [9, 10],
      [9, 10],
      [9, 10],
      [8, 10],
      [10, 10],
      [10, 9],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [10, 10]],
     [[8, 10],
      [9, 10],
      [9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [10, 8],
      [10, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [8, 10]]],
    [0, 0]),
   ['unanimous decision', 'B', ['114-115', '112-116', '109-113']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8], [10, 8], [10, 9], [10, 10], [10, 9], [8, 10]],
     [[10, 9], [10, 8], [10, 9], [10, 8], [9, 10], [10, 9]],
     [[10, 8], [10, 10], [10, 8], [8, 10], [9, 10], [10, 10]]],
    [2, 0]),
   ['split decision', 'A', ['56-54', '57-53', '55-56']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [8, 10], [10, 10], [9, 10], [10, 10]],
     [[10, 10], [10, 8], [10, 8], [10, 10], [9, 10], [10, 10]],
     [[9, 10], [10, 8], [8, 10], [10, 8], [10, 9], [10, 8]]],
    [0, 0]),
   ['majority decision', 'A', ['57-57', '59-56', '57-53']]),
  ('variant scenario 2',
   ([[[10, 9], [9, 10], [8, 10], [10, 10]],
     [[10, 8], [10, 9], [10, 8], [10, 9]],
     [[9, 10], [9, 10], [10, 9], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['37-39', '40-34', '38-37']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[9, 10], [10, 10], [10, 10], [10, 8]],
     [[10, 9], [10, 8], [8, 10], [8, 10]],
     [[10, 9], [8, 10], [8, 10], [8, 10]]],
    [1, 0]),
   ['majority decision', 'B', ['38-38', '35-37', '33-39']]),
  ('variant scenario 1',
   ([[[8, 10], [10, 8], [10, 8], [10, 9]],
     [[8, 10], [9, 10], [10, 8], [10, 9]],
     [[8, 10], [10, 8], [8, 10], [9, 10]]],
    [0, 0]),
   ['split draw', None, ['38-35', '37-37', '35-38']]),
  ('variant scenario 2',
   ([[[10, 8], [10, 9], [9, 10], [10, 10]],
     [[10, 9], [9, 10], [10, 9], [8, 10]],
     [[8, 10], [10, 10], [10, 9], [10, 9]]],
    [1, 0]),
   ['split decision', 'B', ['38-37', '36-38', '37-38']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8],
      [9, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [8, 10],
      [10, 8]],
     [[9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 8],
      [10, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9]],
     [[10, 10],
      [10, 9],
      [8, 10],
      [10, 10],
      [10, 8],
      [9, 10],
      [10, 10],
      [9, 10],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 9]]],
    [0, 1]),
   ['majority draw', None, ['112-112', '111-113', '114-114']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 8], [10, 8], [8, 10], [9, 10], [10, 8]],
     [[10, 8], [10, 10], [10, 9], [8, 10], [10, 10], [10, 10]],
     [[9, 10], [8, 10], [10, 9], [8, 10], [8, 10], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['57-53', '58-57', '53-57']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 8], [10, 8], [10, 9]],
     [[10, 10], [10, 8], [8, 10], [8, 10]],
     [[10, 9], [9, 10], [8, 10], [10, 10]]],
    [0, 0]),
   ['split decision', 'B', ['40-35', '36-38', '37-39']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card)
        tb = sum(r[1] for r in card)
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        elif d == 1:
            kind = 'majority decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    elif d == 2:
        kind = 'majority draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 9], [10, 10], [10, 10], [8, 10], [9, 10], [10, 9]],
     [[10, 9], [10, 9], [8, 10], [10, 8], [9, 10], [8, 10]],
     [[10, 9], [10, 9], [10, 10], [10, 9], [8, 10], [10, 8]]],
    [0, 1]),
   ['majority draw', None, ['57-57', '55-55', '58-54']]),
  ('variant scenario 1',
   ([[[9, 10], [10, 9], [10, 9], [8, 10], [10, 10], [10, 8]],
     [[10, 8], [9, 10], [10, 9], [8, 10], [8, 10], [10, 9]],
     [[10, 8], [8, 10], [10, 8], [10, 10], [10, 8], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['57-56', '55-56', '58-52']]),
  ('variant scenario 2',
   ([[[10, 9],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 8],
      [10, 8],
      [9, 10],
      [10, 8],
      [10, 10],
      [10, 9]],
     [[8, 10],
      [8, 10],
      [9, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [8, 10],
      [8, 10],
      [8, 10],
      [10, 9],
      [10, 8],
      [10, 10]],
     [[10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [9, 10],
      [10, 8],
      [8, 10],
      [10, 10],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 8]]],
    [0, 1]),
   ['split decision', 'A', ['119-106', '108-113', '115-110']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [10, 8]],
     [[9, 10],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 9],
      [10, 8],
      [10, 9]],
     [[10, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 9],
      [10, 9],
      [10, 8],
      [10, 8]]],
    [0, 1]),
   ['unanimous decision', 'A', ['110-109', '118-107', '117-107']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [10, 8], [9, 10], [10, 10], [10, 10]],
     [[10, 10], [10, 9], [10, 9], [10, 8], [10, 10], [10, 9]],
     [[10, 10], [10, 8], [10, 9], [10, 8], [10, 10], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['59-57', '60-55', '60-54']]),
  ('variant scenario 2',
   ([[[9, 10],
      [8, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 9],
      [10, 10],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [8, 10]],
     [[8, 10],
      [9, 10],
      [9, 10],
      [9, 10],
      [8, 10],
      [10, 10],
      [10, 9],
      [10, 10],
      [9, 10],
      [10, 8],
      [10, 9],
      [10, 10]],
     [[8, 10],
      [9, 10],
      [9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [10, 8],
      [10, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [8, 10]]],
    [0, 0]),
   ['unanimous decision', 'B', ['114-115', '112-116', '109-113']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8], [10, 8], [10, 9], [10, 10], [10, 9], [8, 10]],
     [[10, 9], [10, 8], [10, 9], [10, 8], [9, 10], [10, 9]],
     [[10, 8], [10, 10], [10, 8], [8, 10], [9, 10], [10, 10]]],
    [2, 0]),
   ['split decision', 'A', ['56-54', '57-53', '55-56']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [8, 10], [10, 10], [9, 10], [10, 10]],
     [[10, 10], [10, 8], [10, 8], [10, 10], [9, 10], [10, 10]],
     [[9, 10], [10, 8], [8, 10], [10, 8], [10, 9], [10, 8]]],
    [0, 0]),
   ['majority decision', 'A', ['57-57', '59-56', '57-53']]),
  ('variant scenario 2',
   ([[[10, 9], [9, 10], [8, 10], [10, 10]],
     [[10, 8], [10, 9], [10, 8], [10, 9]],
     [[9, 10], [9, 10], [10, 9], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['37-39', '40-34', '38-37']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[9, 10], [10, 10], [10, 10], [10, 8]],
     [[10, 9], [10, 8], [8, 10], [8, 10]],
     [[10, 9], [8, 10], [8, 10], [8, 10]]],
    [1, 0]),
   ['majority decision', 'B', ['38-38', '35-37', '33-39']]),
  ('variant scenario 1',
   ([[[8, 10], [10, 8], [10, 8], [10, 9]],
     [[8, 10], [9, 10], [10, 8], [10, 9]],
     [[8, 10], [10, 8], [8, 10], [9, 10]]],
    [0, 0]),
   ['split draw', None, ['38-35', '37-37', '35-38']]),
  ('variant scenario 2',
   ([[[10, 8], [10, 9], [9, 10], [10, 10]],
     [[10, 9], [9, 10], [10, 9], [8, 10]],
     [[8, 10], [10, 10], [10, 9], [10, 9]]],
    [1, 0]),
   ['split decision', 'B', ['38-37', '36-38', '37-38']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: deduction owner',
   ([[[10, 8],
      [9, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [8, 10],
      [10, 8]],
     [[9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 8],
      [10, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9]],
     [[10, 10],
      [10, 9],
      [8, 10],
      [10, 10],
      [10, 8],
      [9, 10],
      [10, 10],
      [9, 10],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 9]]],
    [0, 1]),
   ['majority draw', None, ['112-112', '111-113', '114-114']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 8], [10, 8], [8, 10], [9, 10], [10, 8]],
     [[10, 8], [10, 10], [10, 9], [8, 10], [10, 10], [10, 10]],
     [[9, 10], [8, 10], [10, 9], [8, 10], [8, 10], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['57-53', '58-57', '53-57']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 8], [10, 8], [10, 9]],
     [[10, 10], [10, 8], [8, 10], [8, 10]],
     [[10, 9], [9, 10], [8, 10], [10, 10]]],
    [0, 0]),
   ['split decision', 'B', ['40-35', '36-38', '37-39']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 fighter penalised for fouls gains ground on the cards.

Ten-point-must decision. cards is three judge cards, each a list of [a_points, b_points] per round; deductions is [a_deducted, b_deducted] applied to every judge's totals. Each judge favours the higher total or scores a draw. Two or more judges for one fighter: "unanimous decision" if the other two agree, "split decision" if one judge favours the opponent, "majority decision" if one judge scores a draw. Otherwise: three draws "unanimous draw", two draws "majority draw", else "split draw". Return [result, winner or None, ["a-b" totals per judge]].

split: open-access


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

N = 1
observations = []
def solve(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card) - deductions[0]
        tb = sum(r[1] for r in card) - deductions[1]
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    elif d == 2:
        kind = 'majority draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 9], [9, 10], [10, 10], [10, 8], [10, 10], [9, 10], [10, 9], [10, 10], [8, 10]],
     [[10, 8], [10, 10], [10, 8], [10, 9], [8, 10], [8, 10], [8, 10], [9, 10], [8, 10], [9, 10]],
     [[8, 10], [10, 9], [10, 8], [8, 10], [8, 10], [8, 10], [10, 10], [8, 10], [10, 8], [8, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['96-96', '90-95', '88-95']]),
  ('variant scenario 1',
   ([[[9, 10], [10, 8], [10, 8], [8, 10], [10, 9], [10, 10], [10, 8], [10, 9], [10, 8], [10, 10]],
     [[8, 10], [10, 10], [8, 10], [8, 10], [9, 10], [10, 10], [10, 10], [10, 10], [10, 9], [8, 10]],
     [[10, 10], [10, 8], [8, 10], [10, 10], [10, 9], [10, 10], [9, 10], [10, 9], [10, 8], [9, 10]]],
    [1, 1]),
   ['split decision', 'A', ['96-89', '90-98', '95-93']]),
  ('variant scenario 2',
   ([[[10, 8],
      [10, 9],
      [10, 10],
      [8, 10],
      [10, 8],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 8],
      [10, 10],
      [10, 10],
      [8, 10]],
     [[10, 8],
      [10, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10]],
     [[10, 8],
      [10, 10],
      [10, 8],
      [9, 10],
      [10, 10],
      [10, 9],
      [8, 10],
      [10, 8],
      [10, 10],
      [10, 9],
      [8, 10],
      [9, 10]]],
    [2, 1]),
   ['unanimous decision', 'A', ['112-110', '114-112', '112-111']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 8], [10, 9], [9, 10], [10, 8], [10, 9], [10, 9], [9, 10], [10, 10], [9, 10]],
     [[10, 9], [10, 8], [10, 9], [9, 10], [10, 9], [10, 9], [10, 10], [8, 10], [9, 10], [9, 10]],
     [[10, 10], [10, 9], [8, 10], [8, 10], [8, 10], [8, 10], [10, 8], [10, 10], [10, 8], [10, 8]]],
    [0, 1]),
   ['majority decision', 'A', ['97-92', '95-93', '92-92']]),
  ('variant scenario 1',
   ([[[8, 10],
      [8, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8],
      [8, 10]],
     [[10, 9],
      [10, 10],
      [10, 8],
      [8, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [10, 10],
      [10, 10],
      [10, 8],
      [8, 10],
      [10, 9]],
     [[10, 8],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8],
      [10, 9],
      [8, 10]]],
    [0, 0]),
   ['split decision', 'A', ['109-114', '116-112', '115-111']]),
  ('variant scenario 2',
   ([[[10, 9], [8, 10], [10, 8], [8, 10], [10, 9], [10, 8]],
     [[10, 9], [10, 8], [10, 9], [9, 10], [10, 8], [10, 9]],
     [[9, 10], [8, 10], [9, 10], [10, 9], [8, 10], [10, 8]]],
    [0, 1]),
   ['split decision', 'A', ['56-53', '59-52', '54-56']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 10], [8, 10], [10, 9], [8, 10], [10, 10]],
     [[8, 10], [10, 9], [9, 10], [10, 9], [10, 8], [9, 10]],
     [[8, 10], [10, 9], [8, 10], [9, 10], [8, 10], [10, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['56-59', '56-56', '53-59']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [9, 10], [10, 9], [9, 10], [8, 10], [10, 8], [10, 8], [8, 10], [10, 10]],
     [[10, 8], [9, 10], [8, 10], [10, 9], [10, 9], [10, 10], [10, 9], [10, 9], [8, 10], [8, 10]],
     [[8, 10], [8, 10], [8, 10], [9, 10], [10, 8], [10, 8], [10, 8], [10, 9], [10, 10], [9, 10]]],
    [0, 1]),
   ['majority draw', None, ['94-93', '93-93', '92-92']]),
  ('variant scenario 2',
   ([[[10, 9], [10, 10], [8, 10], [10, 8], [8, 10], [10, 9]],
     [[8, 10], [10, 8], [9, 10], [10, 10], [8, 10], [10, 8]],
     [[10, 9], [10, 8], [10, 10], [10, 10], [10, 8], [10, 8]]],
    [0, 0]),
   ['split draw', None, ['56-56', '55-56', '60-53']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[8, 10], [8, 10], [10, 10], [10, 9]],
     [[10, 10], [10, 10], [10, 10], [10, 10]],
     [[9, 10], [10, 9], [8, 10], [8, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['36-39', '40-40', '35-39']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [10, 8], [8, 10]],
     [[9, 10], [10, 9], [9, 10], [8, 10]],
     [[8, 10], [10, 10], [10, 10], [10, 9]]],
    [0, 1]),
   ['split draw', None, ['38-36', '36-38', '38-38']]),
  ('variant scenario 2',
   ([[[10, 8], [9, 10], [9, 10], [10, 8], [10, 8], [10, 9], [10, 8], [10, 8], [9, 10], [10, 8]],
     [[8, 10], [8, 10], [10, 10], [10, 9], [10, 10], [10, 9], [9, 10], [10, 8], [8, 10], [10, 10]],
     [[10, 9],
      [10, 10],
      [10, 8],
      [10, 10],
      [10, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 10],
      [8, 10]]],
    [2, 1]),
   ['split decision', 'A', ['95-86', '91-95', '95-94']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 9], [10, 8], [10, 8]],
     [[10, 8], [10, 10], [10, 10], [9, 10]],
     [[10, 9], [9, 10], [10, 8], [8, 10]]],
    [0, 0]),
   ['majority decision', 'A', ['40-35', '39-38', '37-37']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [8, 10], [10, 10]],
     [[10, 9], [10, 10], [10, 9], [8, 10]],
     [[10, 8], [8, 10], [10, 10], [10, 10]]],
    [0, 0]),
   ['majority draw', None, ['38-37', '38-38', '38-38']]),
  ('variant scenario 2',
   ([[[10, 8], [10, 8], [10, 9], [8, 10]],
     [[9, 10], [10, 8], [10, 9], [10, 8]],
     [[10, 9], [10, 10], [8, 10], [10, 9]]],
    [0, 0]),
   ['majority decision', 'A', ['38-35', '39-35', '38-38']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card) - deductions[0]
        tb = sum(r[1] for r in card) - deductions[1]
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        elif d == 1:
            kind = 'split decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    elif d == 2:
        kind = 'majority draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 9], [9, 10], [10, 10], [10, 8], [10, 10], [9, 10], [10, 9], [10, 10], [8, 10]],
     [[10, 8], [10, 10], [10, 8], [10, 9], [8, 10], [8, 10], [8, 10], [9, 10], [8, 10], [9, 10]],
     [[8, 10], [10, 9], [10, 8], [8, 10], [8, 10], [8, 10], [10, 10], [8, 10], [10, 8], [8, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['96-96', '90-95', '88-95']]),
  ('variant scenario 1',
   ([[[9, 10], [10, 8], [10, 8], [8, 10], [10, 9], [10, 10], [10, 8], [10, 9], [10, 8], [10, 10]],
     [[8, 10], [10, 10], [8, 10], [8, 10], [9, 10], [10, 10], [10, 10], [10, 10], [10, 9], [8, 10]],
     [[10, 10], [10, 8], [8, 10], [10, 10], [10, 9], [10, 10], [9, 10], [10, 9], [10, 8], [9, 10]]],
    [1, 1]),
   ['split decision', 'A', ['96-89', '90-98', '95-93']]),
  ('variant scenario 2',
   ([[[10, 8],
      [10, 9],
      [10, 10],
      [8, 10],
      [10, 8],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 8],
      [10, 10],
      [10, 10],
      [8, 10]],
     [[10, 8],
      [10, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10]],
     [[10, 8],
      [10, 10],
      [10, 8],
      [9, 10],
      [10, 10],
      [10, 9],
      [8, 10],
      [10, 8],
      [10, 10],
      [10, 9],
      [8, 10],
      [9, 10]]],
    [2, 1]),
   ['unanimous decision', 'A', ['112-110', '114-112', '112-111']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 8], [10, 9], [9, 10], [10, 8], [10, 9], [10, 9], [9, 10], [10, 10], [9, 10]],
     [[10, 9], [10, 8], [10, 9], [9, 10], [10, 9], [10, 9], [10, 10], [8, 10], [9, 10], [9, 10]],
     [[10, 10], [10, 9], [8, 10], [8, 10], [8, 10], [8, 10], [10, 8], [10, 10], [10, 8], [10, 8]]],
    [0, 1]),
   ['majority decision', 'A', ['97-92', '95-93', '92-92']]),
  ('variant scenario 1',
   ([[[8, 10],
      [8, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8],
      [8, 10]],
     [[10, 9],
      [10, 10],
      [10, 8],
      [8, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [10, 10],
      [10, 10],
      [10, 8],
      [8, 10],
      [10, 9]],
     [[10, 8],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 9],
      [9, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8],
      [10, 9],
      [8, 10]]],
    [0, 0]),
   ['split decision', 'A', ['109-114', '116-112', '115-111']]),
  ('variant scenario 2',
   ([[[10, 9], [8, 10], [10, 8], [8, 10], [10, 9], [10, 8]],
     [[10, 9], [10, 8], [10, 9], [9, 10], [10, 8], [10, 9]],
     [[9, 10], [8, 10], [9, 10], [10, 9], [8, 10], [10, 8]]],
    [0, 1]),
   ['split decision', 'A', ['56-53', '59-52', '54-56']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 10], [8, 10], [10, 9], [8, 10], [10, 10]],
     [[8, 10], [10, 9], [9, 10], [10, 9], [10, 8], [9, 10]],
     [[8, 10], [10, 9], [8, 10], [9, 10], [8, 10], [10, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['56-59', '56-56', '53-59']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [9, 10], [10, 9], [9, 10], [8, 10], [10, 8], [10, 8], [8, 10], [10, 10]],
     [[10, 8], [9, 10], [8, 10], [10, 9], [10, 9], [10, 10], [10, 9], [10, 9], [8, 10], [8, 10]],
     [[8, 10], [8, 10], [8, 10], [9, 10], [10, 8], [10, 8], [10, 8], [10, 9], [10, 10], [9, 10]]],
    [0, 1]),
   ['majority draw', None, ['94-93', '93-93', '92-92']]),
  ('variant scenario 2',
   ([[[10, 9], [10, 10], [8, 10], [10, 8], [8, 10], [10, 9]],
     [[8, 10], [10, 8], [9, 10], [10, 10], [8, 10], [10, 8]],
     [[10, 9], [10, 8], [10, 10], [10, 10], [10, 8], [10, 8]]],
    [0, 0]),
   ['split draw', None, ['56-56', '55-56', '60-53']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[8, 10], [8, 10], [10, 10], [10, 9]],
     [[10, 10], [10, 10], [10, 10], [10, 10]],
     [[9, 10], [10, 9], [8, 10], [8, 10]]],
    [0, 0]),
   ['majority decision', 'B', ['36-39', '40-40', '35-39']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 10], [10, 8], [8, 10]],
     [[9, 10], [10, 9], [9, 10], [8, 10]],
     [[8, 10], [10, 10], [10, 10], [10, 9]]],
    [0, 1]),
   ['split draw', None, ['38-36', '36-38', '38-38']]),
  ('variant scenario 2',
   ([[[10, 8], [9, 10], [9, 10], [10, 8], [10, 8], [10, 9], [10, 8], [10, 8], [9, 10], [10, 8]],
     [[8, 10], [8, 10], [10, 10], [10, 9], [10, 10], [10, 9], [9, 10], [10, 8], [8, 10], [10, 10]],
     [[10, 9],
      [10, 10],
      [10, 8],
      [10, 10],
      [10, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 10],
      [8, 10]]],
    [2, 1]),
   ['split decision', 'A', ['95-86', '91-95', '95-94']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: majority decision label',
   ([[[10, 10], [10, 9], [10, 8], [10, 8]],
     [[10, 8], [10, 10], [10, 10], [9, 10]],
     [[10, 9], [9, 10], [10, 8], [8, 10]]],
    [0, 0]),
   ['majority decision', 'A', ['40-35', '39-38', '37-37']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [8, 10], [10, 10]],
     [[10, 9], [10, 10], [10, 9], [8, 10]],
     [[10, 8], [8, 10], [10, 10], [10, 10]]],
    [0, 0]),
   ['majority draw', None, ['38-37', '38-38', '38-38']]),
  ('variant scenario 2',
   ([[[10, 8], [10, 8], [10, 9], [8, 10]],
     [[9, 10], [10, 8], [10, 9], [10, 8]],
     [[10, 9], [10, 10], [8, 10], [10, 9]]],
    [0, 0]),
   ['majority decision', 'A', ['38-35', '39-35', '38-38']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 win with one judge scoring a draw is announced as unanimous or split.

Ten-point-must decision. cards is three judge cards, each a list of [a_points, b_points] per round; deductions is [a_deducted, b_deducted] applied to every judge's totals. Each judge favours the higher total or scores a draw. Two or more judges for one fighter: "unanimous decision" if the other two agree, "split decision" if one judge favours the opponent, "majority decision" if one judge scores a draw. Otherwise: three draws "unanimous draw", two draws "majority draw", else "split draw". Return [result, winner or None, ["a-b" totals per judge]].

split: open-access


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

N = 1
observations = []
def solve(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card) - deductions[0]
        tb = sum(r[1] for r in card) - deductions[1]
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        elif d == 1:
            kind = 'majority decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[10, 9],
      [8, 10],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 9],
      [10, 10],
      [8, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8]],
     [[8, 10],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10],
      [9, 10]],
     [[10, 8],
      [8, 10],
      [10, 10],
      [10, 8],
      [10, 10],
      [9, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 8],
      [10, 9],
      [10, 8]]],
    [0, 0]),
   ['split draw', None, ['112-112', '114-115', '116-109']]),
  ('regression: draw labels',
   ([[[9, 10], [9, 10], [10, 10], [9, 10]],
     [[10, 10], [10, 9], [8, 10], [10, 10]],
     [[10, 9], [9, 10], [8, 10], [10, 9]]],
    [0, 1]),
   ['majority draw', None, ['37-39', '38-38', '37-37']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [10, 8], [9, 10]],
     [[8, 10], [10, 9], [9, 10], [8, 10]],
     [[10, 8], [8, 10], [9, 10], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['39-35', '35-39', '37-36']]),
  ('variant scenario 2',
   ([[[10, 10], [9, 10], [8, 10], [10, 10]],
     [[8, 10], [10, 8], [8, 10], [10, 9]],
     [[10, 10], [10, 10], [9, 10], [10, 9]]],
    [0, 0]),
   ['majority decision', 'B', ['37-40', '36-37', '39-39']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[8, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 10]],
     [[10, 9],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 8],
      [10, 10],
      [8, 10]],
     [[9, 10],
      [10, 9],
      [8, 10],
      [8, 10],
      [10, 9],
      [9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [9, 10],
      [10, 8]]],
    [0, 1]),
   ['split draw', None, ['113-113', '117-111', '108-113']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 10], [10, 10], [10, 8]],
     [[8, 10], [10, 9], [10, 9], [10, 10]],
     [[9, 10], [9, 10], [10, 9], [10, 9]]],
    [0, 0]),
   ['majority draw', None, ['39-38', '38-38', '38-38']]),
  ('variant scenario 1',
   ([[[8, 10], [10, 9], [10, 10], [10, 9]],
     [[10, 9], [10, 8], [10, 9], [10, 9]],
     [[10, 9], [10, 10], [10, 10], [10, 9]]],
    [1, 1]),
   ['majority decision', 'A', ['37-37', '39-34', '39-37']]),
  ('variant scenario 2',
   ([[[9, 10],
      [8, 10],
      [10, 8],
      [8, 10],
      [10, 8],
      [10, 9],
      [9, 10],
      [8, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 10]],
     [[10, 8],
      [10, 8],
      [10, 9],
      [10, 10],
      [8, 10],
      [8, 10],
      [9, 10],
      [8, 10],
      [10, 9],
      [10, 9],
      [10, 10],
      [10, 10]],
     [[9, 10],
      [10, 10],
      [9, 10],
      [10, 9],
      [10, 8],
      [9, 10],
      [10, 8],
      [9, 10],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 10]]],
    [1, 1]),
   ['split draw', None, ['108-113', '112-112', '115-111']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 10], [10, 9], [10, 9], [9, 10], [10, 8]],
     [[10, 9], [9, 10], [10, 8], [9, 10], [9, 10], [10, 9]],
     [[9, 10], [10, 8], [10, 10], [10, 10], [8, 10], [10, 8]]],
    [1, 0]),
   ['majority draw', None, ['57-56', '56-56', '56-56']]),
  ('regression: draw labels',
   ([[[10, 8], [10, 8], [8, 10], [10, 9], [9, 10], [10, 9], [8, 10], [8, 10], [8, 10], [10, 10]],
     [[8, 10], [10, 8], [10, 10], [8, 10], [10, 10], [10, 9], [9, 10], [9, 10], [10, 8], [10, 10]],
     [[10, 10], [10, 9], [10, 9], [10, 8], [8, 10], [10, 8], [10, 10], [10, 10], [10, 8], [9, 10]]],
    [0, 1]),
   ['split draw', None, ['91-93', '94-94', '97-91']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 9], [10, 8], [10, 9]],
     [[9, 10], [10, 8], [10, 9], [9, 10]],
     [[8, 10], [8, 10], [10, 10], [10, 10]]],
    [0, 0]),
   ['split decision', 'A', ['40-35', '38-37', '36-40']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 9], [10, 10], [10, 9], [10, 9], [10, 9], [9, 10], [8, 10], [10, 8], [10, 9]],
     [[10, 8], [10, 9], [10, 9], [10, 8], [9, 10], [8, 10], [8, 10], [9, 10], [10, 10], [9, 10]],
     [[8, 10], [10, 8], [10, 10], [10, 8], [10, 9], [10, 10], [10, 9], [10, 9], [10, 9], [10, 9]]],
    [1, 0]),
   ['split decision', 'A', ['96-93', '92-94', '97-91']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 9], [8, 10], [8, 10], [10, 10], [9, 10]],
     [[10, 9], [9, 10], [10, 9], [10, 10], [10, 9], [9, 10]],
     [[10, 9], [9, 10], [10, 8], [10, 8], [10, 10], [10, 8]]],
    [1, 0]),
   ['split draw', None, ['53-59', '57-57', '58-53']]),
  ('regression: draw labels',
   ([[[10, 9], [8, 10], [10, 9], [10, 8], [10, 10], [10, 10], [10, 8], [8, 10], [10, 10], [9, 10]],
     [[10, 10], [10, 8], [10, 9], [10, 9], [10, 9], [9, 10], [8, 10], [10, 9], [10, 10], [10, 8]],
     [[10, 9], [9, 10], [10, 9], [10, 9], [10, 9], [10, 9], [10, 10], [8, 10], [9, 10], [10, 10]]],
    [1, 0]),
   ['majority draw', None, ['94-94', '96-92', '95-95']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 8], [10, 9], [10, 9]],
     [[10, 8], [8, 10], [8, 10], [8, 10]],
     [[10, 10], [10, 9], [10, 8], [10, 10]]],
    [1, 1]),
   ['split decision', 'A', ['39-34', '33-37', '39-36']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 9], [10, 8], [8, 10], [9, 10], [10, 8]],
     [[10, 8], [10, 10], [10, 8], [8, 10], [10, 8], [10, 9]],
     [[10, 10], [10, 8], [10, 8], [8, 10], [10, 8], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['57-55', '58-53', '58-53']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[8, 10], [9, 10], [8, 10], [10, 9], [10, 9], [9, 10]],
     [[10, 10], [8, 10], [10, 9], [9, 10], [10, 9], [10, 9]],
     [[10, 9], [10, 10], [10, 8], [10, 8], [8, 10], [10, 9]]],
    [0, 0]),
   ['split draw', None, ['54-58', '57-57', '58-54']]),
  ('regression: draw labels',
   ([[[10, 9]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['majority draw', None, ['10-9', '10-10', '10-10']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 8], [9, 10], [9, 10], [8, 10], [9, 10]],
     [[10, 8], [10, 9], [10, 9], [10, 8], [8, 10], [10, 9]],
     [[10, 10], [10, 10], [10, 10], [10, 8], [10, 8], [8, 10]]],
    [1, 0]),
   ['split decision', 'A', ['54-56', '57-53', '57-56']]),
  ('variant scenario 2',
   ([[[10, 9], [10, 8], [10, 9], [9, 10], [10, 9], [10, 10], [9, 10], [10, 10], [10, 9], [10, 10]],
     [[9, 10], [10, 9], [8, 10], [10, 9], [10, 10], [8, 10], [8, 10], [10, 10], [10, 8], [8, 10]],
     [[10, 8], [9, 10], [8, 10], [9, 10], [9, 10], [10, 10], [10, 9], [10, 9], [9, 10], [10, 9]]],
    [2, 0]),
   ['split decision', 'B', ['96-94', '89-96', '92-95']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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(cards, deductions):
    verdicts = []
    strs = []
    for card in cards:
        ta = sum(r[0] for r in card) - deductions[0]
        tb = sum(r[1] for r in card) - deductions[1]
        verdicts.append('A' if ta > tb else ('B' if tb > ta else 'D'))
        strs.append('%d-%d' % (ta, tb))
    a = verdicts.count('A')
    b = verdicts.count('B')
    d = verdicts.count('D')
    if a >= 2 or b >= 2:
        w = 'A' if a >= 2 else 'B'
        loser_votes = b if w == 'A' else a
        if loser_votes == 1:
            kind = 'split decision'
        elif d == 1:
            kind = 'majority decision'
        else:
            kind = 'unanimous decision'
        return [kind, w, strs]
    if d == 3:
        kind = 'unanimous draw'
    elif d >= 1:
        kind = 'majority draw'
    else:
        kind = 'split draw'
    return [kind, None, strs]
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[10, 9],
      [8, 10],
      [10, 9],
      [8, 10],
      [10, 9],
      [10, 9],
      [10, 10],
      [8, 10],
      [10, 9],
      [10, 9],
      [8, 10],
      [10, 8]],
     [[8, 10],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 9],
      [9, 10],
      [9, 10],
      [10, 9],
      [10, 9],
      [10, 9],
      [10, 10],
      [9, 10]],
     [[10, 8],
      [8, 10],
      [10, 10],
      [10, 8],
      [10, 10],
      [9, 10],
      [9, 10],
      [10, 10],
      [10, 8],
      [10, 8],
      [10, 9],
      [10, 8]]],
    [0, 0]),
   ['split draw', None, ['112-112', '114-115', '116-109']]),
  ('regression: draw labels',
   ([[[9, 10], [9, 10], [10, 10], [9, 10]],
     [[10, 10], [10, 9], [8, 10], [10, 10]],
     [[10, 9], [9, 10], [8, 10], [10, 9]]],
    [0, 1]),
   ['majority draw', None, ['37-39', '38-38', '37-37']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 9], [10, 8], [9, 10]],
     [[8, 10], [10, 9], [9, 10], [8, 10]],
     [[10, 8], [8, 10], [9, 10], [10, 8]]],
    [0, 0]),
   ['split decision', 'A', ['39-35', '35-39', '37-36']]),
  ('variant scenario 2',
   ([[[10, 10], [9, 10], [8, 10], [10, 10]],
     [[8, 10], [10, 8], [8, 10], [10, 9]],
     [[10, 10], [10, 10], [9, 10], [10, 9]]],
    [0, 0]),
   ['majority decision', 'B', ['37-40', '36-37', '39-39']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[8, 10],
      [10, 9],
      [10, 8],
      [8, 10],
      [8, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [10, 10],
      [10, 9],
      [9, 10],
      [10, 10]],
     [[10, 9],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 9],
      [9, 10],
      [10, 10],
      [10, 10],
      [10, 9],
      [10, 8],
      [10, 10],
      [8, 10]],
     [[9, 10],
      [10, 9],
      [8, 10],
      [8, 10],
      [10, 9],
      [9, 10],
      [8, 10],
      [9, 10],
      [10, 8],
      [8, 10],
      [9, 10],
      [10, 8]]],
    [0, 1]),
   ['split draw', None, ['113-113', '117-111', '108-113']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 10], [10, 10], [10, 8]],
     [[8, 10], [10, 9], [10, 9], [10, 10]],
     [[9, 10], [9, 10], [10, 9], [10, 9]]],
    [0, 0]),
   ['majority draw', None, ['39-38', '38-38', '38-38']]),
  ('variant scenario 1',
   ([[[8, 10], [10, 9], [10, 10], [10, 9]],
     [[10, 9], [10, 8], [10, 9], [10, 9]],
     [[10, 9], [10, 10], [10, 10], [10, 9]]],
    [1, 1]),
   ['majority decision', 'A', ['37-37', '39-34', '39-37']]),
  ('variant scenario 2',
   ([[[9, 10],
      [8, 10],
      [10, 8],
      [8, 10],
      [10, 8],
      [10, 9],
      [9, 10],
      [8, 10],
      [10, 9],
      [8, 10],
      [9, 10],
      [10, 10]],
     [[10, 8],
      [10, 8],
      [10, 9],
      [10, 10],
      [8, 10],
      [8, 10],
      [9, 10],
      [8, 10],
      [10, 9],
      [10, 9],
      [10, 10],
      [10, 10]],
     [[9, 10],
      [10, 10],
      [9, 10],
      [10, 9],
      [10, 8],
      [9, 10],
      [10, 8],
      [9, 10],
      [10, 9],
      [10, 10],
      [10, 8],
      [10, 10]]],
    [1, 1]),
   ['split draw', None, ['108-113', '112-112', '115-111']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 10], [10, 9], [10, 9], [9, 10], [10, 8]],
     [[10, 9], [9, 10], [10, 8], [9, 10], [9, 10], [10, 9]],
     [[9, 10], [10, 8], [10, 10], [10, 10], [8, 10], [10, 8]]],
    [1, 0]),
   ['majority draw', None, ['57-56', '56-56', '56-56']]),
  ('regression: draw labels',
   ([[[10, 8], [10, 8], [8, 10], [10, 9], [9, 10], [10, 9], [8, 10], [8, 10], [8, 10], [10, 10]],
     [[8, 10], [10, 8], [10, 10], [8, 10], [10, 10], [10, 9], [9, 10], [9, 10], [10, 8], [10, 10]],
     [[10, 10], [10, 9], [10, 9], [10, 8], [8, 10], [10, 8], [10, 10], [10, 10], [10, 8], [9, 10]]],
    [0, 1]),
   ['split draw', None, ['91-93', '94-94', '97-91']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 9], [10, 8], [10, 9]],
     [[9, 10], [10, 8], [10, 9], [9, 10]],
     [[8, 10], [8, 10], [10, 10], [10, 10]]],
    [0, 0]),
   ['split decision', 'A', ['40-35', '38-37', '36-40']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 9], [10, 10], [10, 9], [10, 9], [10, 9], [9, 10], [8, 10], [10, 8], [10, 9]],
     [[10, 8], [10, 9], [10, 9], [10, 8], [9, 10], [8, 10], [8, 10], [9, 10], [10, 10], [9, 10]],
     [[8, 10], [10, 8], [10, 10], [10, 8], [10, 9], [10, 10], [10, 9], [10, 9], [10, 9], [10, 9]]],
    [1, 0]),
   ['split decision', 'A', ['96-93', '92-94', '97-91']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[9, 10], [10, 9], [8, 10], [8, 10], [10, 10], [9, 10]],
     [[10, 9], [9, 10], [10, 9], [10, 10], [10, 9], [9, 10]],
     [[10, 9], [9, 10], [10, 8], [10, 8], [10, 10], [10, 8]]],
    [1, 0]),
   ['split draw', None, ['53-59', '57-57', '58-53']]),
  ('regression: draw labels',
   ([[[10, 9], [8, 10], [10, 9], [10, 8], [10, 10], [10, 10], [10, 8], [8, 10], [10, 10], [9, 10]],
     [[10, 10], [10, 8], [10, 9], [10, 9], [10, 9], [9, 10], [8, 10], [10, 9], [10, 10], [10, 8]],
     [[10, 9], [9, 10], [10, 9], [10, 9], [10, 9], [10, 9], [10, 10], [8, 10], [9, 10], [10, 10]]],
    [1, 0]),
   ['majority draw', None, ['94-94', '96-92', '95-95']]),
  ('variant scenario 1',
   ([[[10, 9], [10, 8], [10, 9], [10, 9]],
     [[10, 8], [8, 10], [8, 10], [8, 10]],
     [[10, 10], [10, 9], [10, 8], [10, 10]]],
    [1, 1]),
   ['split decision', 'A', ['39-34', '33-37', '39-36']]),
  ('variant scenario 2',
   ([[[10, 10], [10, 9], [10, 8], [8, 10], [9, 10], [10, 8]],
     [[10, 8], [10, 10], [10, 8], [8, 10], [10, 8], [10, 9]],
     [[10, 10], [10, 8], [10, 8], [8, 10], [10, 8], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['57-55', '58-53', '58-53']])],
 [('control unanimous',
   ([[[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]], [[10, 9], [10, 9], [10, 9]]],
    [0, 0]),
   ['unanimous decision', 'A', ['30-27', '30-27', '30-27']]),
  ('boundary split decision',
   ([[[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [10, 9]], [[10, 9], [9, 10], [9, 10]]],
    [0, 0]),
   ['split decision', 'A', ['29-28', '29-28', '28-29']]),
  ('boundary deduction creates draw',
   ([[[10, 9], [10, 9]], [[10, 9], [10, 9]], [[10, 9], [9, 10]]], [2, 0]),
   ['majority draw', None, ['18-18', '18-18', '17-19']]),
  ('control split draw',
   ([[[10, 9]], [[9, 10]], [[10, 10]]], [0, 0]),
   ['split draw', None, ['10-9', '9-10', '10-10']]),
  ('control unanimous draw',
   ([[[10, 10]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['unanimous draw', None, ['10-10', '10-10', '10-10']]),
  ('regression: draw labels',
   ([[[8, 10], [9, 10], [8, 10], [10, 9], [10, 9], [9, 10]],
     [[10, 10], [8, 10], [10, 9], [9, 10], [10, 9], [10, 9]],
     [[10, 9], [10, 10], [10, 8], [10, 8], [8, 10], [10, 9]]],
    [0, 0]),
   ['split draw', None, ['54-58', '57-57', '58-54']]),
  ('regression: draw labels',
   ([[[10, 9]], [[10, 10]], [[10, 10]]], [0, 0]),
   ['majority draw', None, ['10-9', '10-10', '10-10']]),
  ('variant scenario 1',
   ([[[10, 8], [10, 8], [9, 10], [9, 10], [8, 10], [9, 10]],
     [[10, 8], [10, 9], [10, 9], [10, 8], [8, 10], [10, 9]],
     [[10, 10], [10, 10], [10, 10], [10, 8], [10, 8], [8, 10]]],
    [1, 0]),
   ['split decision', 'A', ['54-56', '57-53', '57-56']]),
  ('variant scenario 2',
   ([[[10, 9], [10, 8], [10, 9], [9, 10], [10, 9], [10, 10], [9, 10], [10, 10], [10, 9], [10, 10]],
     [[9, 10], [10, 9], [8, 10], [10, 9], [10, 10], [8, 10], [8, 10], [10, 10], [10, 8], [8, 10]],
     [[10, 8], [9, 10], [8, 10], [9, 10], [9, 10], [10, 10], [10, 9], [10, 9], [9, 10], [10, 9]]],
    [2, 0]),
   ['split decision', 'B', ['96-94', '89-96', '92-95']])]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 1-0-2 card is announced as a split draw.

Ten-point-must decision. cards is three judge cards, each a list of [a_points, b_points] per round; deductions is [a_deducted, b_deducted] applied to every judge's totals. Each judge favours the higher total or scores a draw. Two or more judges for one fighter: "unanimous decision" if the other two agree, "split decision" if one judge favours the opponent, "majority decision" if one judge scores a draw. Otherwise: three draws "unanimous draw", two draws "majority draw", else "split draw". Return [result, winner or None, ["a-b" totals per judge]].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d > 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('1.08',), '-1250'),
  ('variant scenario 2', ('2.125',), '+113')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.11',), '+511'),
  ('variant scenario 2', ('5.20',), '+420')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.85',), '+585'),
  ('variant scenario 2', ('4.10',), '+310')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.35',), '+535'),
  ('variant scenario 2', ('2.806',), '+181')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('8.36',), '+736'),
  ('variant scenario 2', ('5.69',), '+469')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d == 2:
        return '100'
    if d > 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('1.08',), '-1250'),
  ('variant scenario 2', ('2.125',), '+113')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.11',), '+511'),
  ('variant scenario 2', ('5.20',), '+420')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.85',), '+585'),
  ('variant scenario 2', ('4.10',), '+310')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('6.35',), '+535'),
  ('variant scenario 2', ('2.806',), '+181')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: evens branch', ('2.00',), '+100'),
  ('variant scenario 1', ('8.36',), '+736'),
  ('variant scenario 2', ('5.69',), '+469')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 2.00 price is displayed as -100 instead of +100.

Convert a decimal price string to an American moneyline string. Prices at or below 1 return "invalid". For d >= 2 the line is "+" followed by 100 * (d - 1); for d < 2 it is "-" followed by 100 / (d - 1). The magnitude is computed exactly from the decimal text and rounded half up to an integer. Evens (2.00) is "+100".

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = int(v)
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.217',), '+122'),
  ('regression: magnitude rounding', ('2.005',), '+101'),
  ('variant scenario 1', ('11.70',), '+1070'),
  ('variant scenario 2', ('2.00',), '+100')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.005',), '+101'),
  ('variant scenario 1', ('1.078',), '-1282'),
  ('variant scenario 2', ('11.34',), '+1034')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.125',), '+113'),
  ('variant scenario 1', ('7.99',), '+699'),
  ('variant scenario 2', ('9.28',), '+828')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('3.125',), '+213'),
  ('variant scenario 1', ('7.98',), '+698'),
  ('variant scenario 2', ('2.77',), '+177')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('1.538',), '-186'),
  ('regression: magnitude rounding', ('2.125',), '+113'),
  ('variant scenario 1', ('2.490',), '+149'),
  ('variant scenario 2', ('1.074',), '-1351')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = round(v)
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.217',), '+122'),
  ('regression: magnitude rounding', ('2.005',), '+101'),
  ('variant scenario 1', ('11.70',), '+1070'),
  ('variant scenario 2', ('2.00',), '+100')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.005',), '+101'),
  ('variant scenario 1', ('1.078',), '-1282'),
  ('variant scenario 2', ('11.34',), '+1034')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('2.125',), '+113'),
  ('variant scenario 1', ('7.99',), '+699'),
  ('variant scenario 2', ('9.28',), '+828')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('3.125',), '+213'),
  ('variant scenario 1', ('7.98',), '+698'),
  ('variant scenario 2', ('2.77',), '+177')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: magnitude rounding', ('1.538',), '-186'),
  ('regression: magnitude rounding', ('2.125',), '+113'),
  ('variant scenario 1', ('2.490',), '+149'),
  ('variant scenario 2', ('1.074',), '-1351')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 2.005 price shows +100 instead of +101.

Convert a decimal price string to an American moneyline string. Prices at or below 1 return "invalid". For d >= 2 the line is "+" followed by 100 * (d - 1); for d < 2 it is "-" followed by 100 / (d - 1). The magnitude is computed exactly from the decimal text and rounded half up to an integer. Evens (2.00) is "+100".

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = (d - 1) * 100
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.393',), '-254'),
  ('variant scenario 1', ('2.638',), '+164'),
  ('variant scenario 2', ('6.44',), '+544')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.600',), '-167'),
  ('variant scenario 1', ('2.82',), '+182'),
  ('variant scenario 2', ('5.11',), '+411')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.13',), '-769'),
  ('variant scenario 1', ('2.98',), '+198'),
  ('variant scenario 2', ('6.10',), '+510')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.64',), '-156'),
  ('variant scenario 1', ('13.76',), '+1276'),
  ('variant scenario 2', ('11.19',), '+1019')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.108',), '-926'),
  ('variant scenario 1', ('4.59',), '+359'),
  ('variant scenario 2', ('5.05',), '+405')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / d
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.393',), '-254'),
  ('variant scenario 1', ('2.638',), '+164'),
  ('variant scenario 2', ('6.44',), '+544')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.600',), '-167'),
  ('variant scenario 1', ('2.82',), '+182'),
  ('variant scenario 2', ('5.11',), '+411')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.13',), '-769'),
  ('variant scenario 1', ('2.98',), '+198'),
  ('variant scenario 2', ('6.10',), '+510')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.64',), '-156'),
  ('variant scenario 1', ('13.76',), '+1276'),
  ('variant scenario 2', ('11.19',), '+1019')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: favourite formula', ('1.108',), '-926'),
  ('variant scenario 1', ('4.59',), '+359'),
  ('variant scenario 2', ('5.05',), '+405')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 1.50 price is shown as -50 instead of -200.

Convert a decimal price string to an American moneyline string. Prices at or below 1 return "invalid". For d >= 2 the line is "+" followed by 100 * (d - 1); for d < 2 it is "-" followed by 100 / (d - 1). The magnitude is computed exactly from the decimal text and rounded half up to an integer. Evens (2.00) is "+100".

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d < 1:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.125',), '+113'),
  ('variant scenario 2', ('2.56',), '+156')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('9.66',), '+866'),
  ('variant scenario 2', ('3.95',), '+295')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.00',), '+100'),
  ('variant scenario 2', ('1.82',), '-122')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('8.63',), '+763'),
  ('variant scenario 2', ('1.916',), '-109')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('1.188',), '-532'),
  ('variant scenario 2', ('3.17',), '+217')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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
from fractions import Fraction
import math
N = 1
observations = []
def solve(decimal):
    d = Fraction(decimal)
    if d <= 0:
        return 'invalid'
    if d >= 2:
        v = (d - 1) * 100
        sign = '+'
    else:
        v = 100 / (d - 1)
        sign = '-'
    n = math.floor(v + Fraction(1, 2))
    return sign + str(n)
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
def run(args):
    try:
        return solve(*args)
    except Exception as exc:
        return 'raised ' + type(exc).__name__
cases = [[('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.125',), '+113'),
  ('variant scenario 2', ('2.56',), '+156')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('9.66',), '+866'),
  ('variant scenario 2', ('3.95',), '+295')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('2.00',), '+100'),
  ('variant scenario 2', ('1.82',), '-122')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('8.63',), '+763'),
  ('variant scenario 2', ('1.916',), '-109')],
 [('control underdog', ('2.50',), '+150'),
  ('control favourite', ('1.50',), '-200'),
  ('boundary evens', ('2.00',), '+100'),
  ('boundary half-cent rounds up', ('2.005',), '+101'),
  ('boundary no-profit price', ('1.00',), 'invalid'),
  ('control short favourite', ('1.08',), '-1250'),
  ('regression: no profit guard', ('0.95',), 'invalid'),
  ('regression: no profit guard', ('1.00',), 'invalid'),
  ('variant scenario 1', ('1.188',), '-532'),
  ('variant scenario 2', ('3.17',), '+217')]]
for label, args, expected in cases[N - 1]:
    check(label, run(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 1.00 price raises a division error instead of returning invalid.

Convert a decimal price string to an American moneyline string. Prices at or below 1 return "invalid". For d >= 2 the line is "+" followed by 100 * (d - 1); for d < 2 it is "-" followed by 100 / (d - 1). The magnitude is computed exactly from the decimal text and rounded half up to an integer. Evens (2.00) is "+100".

split: open-access