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

N = 1
observations = []
def solve(records):
    rows = []
    nh = []
    for name, heights in records:
        cleared = [h for h, s in heights if 'O' in s]
        if not cleared:
            nh.append(name)
            continue
        best = max(cleared)
        at_best = sum(s.count('X') for h, s in heights if h == best)
        total = sum(s.count('X') for h, s in heights if h <= best)
        rows.append((-best, at_best, total, name))
    rows.sort()
    out = []
    for i, r in enumerate(rows):
        if i and rows[i - 1] == r:
            place = out[-1][0]
        else:
            place = i + 1
        out.append([place, r[3], -r[0]])
    for name in sorted(nh):
        out.append([None, name, None])
    return out
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 higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'XXO'], [192, 'O'], [195, 'O']]],
     ['Bo', [[180, 'XX-'], [183, 'XO'], [186, 'X-'], [189, 'XO'], [192, 'O'], [195, 'O']]],
     ['Ade', [[180, 'XXX']]]],),
   [[1, 'Dee', 195], [2, 'Bo', 195], [None, 'Ade', None]]),
  ('regression: shared place key',
   ([['Eli', [[180, 'O'], [183, 'XXO'], [186, 'O']]],
     ['Fay', [[180, 'XO'], [183, 'XO'], [186, 'XX-']]],
     ['Dee', [[180, 'XO'], [183, 'X-'], [186, 'X-']]],
     ['Ade', [[180, '-'], [183, '-'], [186, 'XO']]],
     ['Cy', [[180, 'XO'], [183, '-'], [186, 'XX-']]]],),
   [[1, 'Eli', 186], [2, 'Ade', 186], [3, 'Fay', 183], [4, 'Cy', 180], [4, 'Dee', 180]]),
  ('variant scenario 1',
   ([['Cy', [[180, 'X-'], [183, 'XO'], [186, 'O'], [189, '-'], [192, 'XO'], [195, 'O']]],
     ['Eli', [[180, 'XXX']]],
     ['Dee', [[180, 'XO'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Cy', 195], [2, 'Dee', 183], [None, 'Eli', None]]),
  ('variant scenario 2',
   ([['Eli', [[180, 'XX-'], [183, 'X-'], [186, 'O'], [189, 'O'], [192, 'XXO']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Eli', 192], [2, 'Fay', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'O'], [183, 'O'], [186, 'XX-'], [189, 'XX-'], [192, 'XO']]],
     ['Eli', [[180, 'O'], [183, '-'], [186, 'XXO'], [189, 'X-'], [192, 'O']]],
     ['Fay', [[180, 'X-'], [183, 'X-'], [186, 'XX-'], [189, 'O'], [192, 'XO']]]],),
   [[1, 'Eli', 192], [2, 'Bo', 192], [2, 'Fay', 192]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XO'], [183, 'XX-'], [186, 'XX-']]],
     ['Ade', [[180, 'XXX']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'O']]],
     ['Cy', [[180, 'O'], [183, 'XXO'], [186, 'O']]],
     ['Eli', [[180, 'XXO'], [183, '-'], [186, 'O']]]],),
   [[1, 'Dee', 186], [2, 'Cy', 186], [2, 'Eli', 186], [4, 'Bo', 180], [None, 'Ade', None]]),
  ('variant scenario 1',
   ([['Eli', [[180, 'XX-'], [183, 'X-'], [186, '-'], [189, 'O'], [192, 'XO']]],
     ['Ade', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'XXO'], [192, 'O']]],
     ['Bo', [[180, 'X-'], [183, 'XX-'], [186, 'XX-'], [189, '-'], [192, 'XXX']]],
     ['Cy', [[180, 'XXX']]]],),
   [[1, 'Ade', 192], [2, 'Eli', 192], [None, 'Bo', None], [None, 'Cy', None]]),
  ('variant scenario 2',
   ([['Eli', [[180, 'XO'], [183, 'X-'], [186, 'X-']]],
     ['Cy', [[180, 'X-'], [183, 'XX-'], [186, 'X-']]]],),
   [[1, 'Eli', 180], [None, 'Cy', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XO'], [183, 'O'], [186, 'XXX']]],
     ['Eli', [[180, 'XXO'], [183, 'X-'], [186, 'XXO']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'XXO']]],
     ['Ade', [[180, 'X-'], [183, 'XO'], [186, 'XX-']]]],),
   [[1, 'Dee', 186], [2, 'Eli', 186], [3, 'Bo', 183], [4, 'Ade', 183]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'XO'], [183, 'O'], [186, 'O']]],
     ['Ade', [[180, '-'], [183, 'X-'], [186, 'O']]],
     ['Eli', [[180, 'XO'], [183, 'XXX']]]],),
   [[1, 'Ade', 186], [1, 'Dee', 186], [3, 'Eli', 180]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XX-'], [183, 'O'], [186, 'XX-']]],
     ['Cy', [[180, 'O'], [183, '-'], [186, 'XX-']]],
     ['Dee', [[180, '-'], [183, '-'], [186, 'XO']]]],),
   [[1, 'Dee', 186], [2, 'Bo', 183], [3, 'Cy', 180]]),
  ('variant scenario 2',
   ([['Fay', [[180, 'XXX']]],
     ['Ade', [[180, 'XXO'], [183, '-'], [186, 'O'], [189, 'XXX']]],
     ['Cy', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'O']]]],),
   [[1, 'Cy', 189], [2, 'Ade', 186], [None, 'Fay', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'XO'], [183, 'O'], [186, '-'], [189, 'X-'], [192, 'O'], [195, 'O']]],
     ['Bo', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'O'], [186, 'XO'], [189, 'XX-'], [192, 'X-'], [195, 'XO']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, 'XO'], [189, 'O'], [192, 'O'], [195, 'XO']]],
     ['Fay', [[180, 'XXX']]]],),
   [[1, 'Dee', 195], [2, 'Ade', 195], [3, 'Eli', 195], [None, 'Bo', None], [None, 'Fay', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, '-'], [183, 'XXO'], [186, 'XXX']]],
     ['Cy', [[180, 'O'], [183, 'XXO'], [186, 'X-']]],
     ['Ade', [[180, 'X-'], [183, 'X-'], [186, 'O']]]],),
   [[1, 'Ade', 186], [2, 'Cy', 183], [2, 'Dee', 183]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XO'], [183, '-'], [186, 'O'], [189, '-']]],
     ['Cy', [[180, '-'], [183, 'XXX']]],
     ['Fay', [[180, 'XXO'], [183, 'XXX']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'O']]]],),
   [[1, 'Eli', 189], [2, 'Bo', 186], [3, 'Fay', 180], [None, 'Cy', None]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'XO'], [189, 'XXO'], [192, 'O']]],
     ['Eli', [[180, 'X-'], [183, 'XXO'], [186, '-'], [189, 'XX-'], [192, '-']]]],),
   [[1, 'Dee', 192], [2, 'Eli', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Eli', [[180, '-'], [183, 'XO'], [186, 'X-'], [189, 'XO'], [192, 'X-']]],
     ['Bo', [[180, 'O'], [183, 'X-'], [186, 'XXX']]],
     ['Dee', [[180, 'XXX']]],
     ['Ade', [[180, 'O'], [183, '-'], [186, 'O'], [189, 'O'], [192, 'O']]],
     ['Fay', [[180, 'O'], [183, 'XX-'], [186, 'XO'], [189, '-'], [192, 'O']]]],),
   [[1, 'Ade', 192], [2, 'Fay', 192], [3, 'Eli', 189], [4, 'Bo', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XXO'], [183, 'XXX']]],
     ['Ade', [[180, '-'], [183, 'XO'], [186, 'XXX']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, '-'], [189, 'O']]],
     ['Cy', [[180, '-'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'X-'], [189, 'X-']]]],),
   [[1, 'Cy', 189], [1, 'Fay', 189], [3, 'Ade', 183], [4, 'Dee', 180], [5, 'Bo', 180]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'XO'], [186, '-'], [189, 'XXO'], [192, 'XXO']]],
     ['Dee', [[180, 'XXX']]]],),
   [[1, 'Eli', 192], [None, 'Ade', None], [None, 'Dee', None]]),
  ('variant scenario 2',
   ([['Ade', [[180, 'XXX']]],
     ['Eli', [[180, 'O'], [183, 'XXO'], [186, '-']]],
     ['Cy', [[180, 'XO'], [183, 'O'], [186, 'XO']]]],),
   [[1, 'Cy', 186], [2, 'Eli', 183], [None, 'Ade', None]])]]
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(records):
    rows = []
    nh = []
    for name, heights in records:
        cleared = [h for h, s in heights if 'O' in s]
        if not cleared:
            nh.append(name)
            continue
        best = max(cleared)
        at_best = sum(s.count('X') for h, s in heights if h == best)
        total = sum(s.count('X') for h, s in heights if h <= best)
        rows.append((-best, at_best, total, name))
    rows.sort()
    out = []
    for i, r in enumerate(rows):
        if i and rows[i - 1][:2] == r[:2]:
            place = out[-1][0]
        else:
            place = i + 1
        out.append([place, r[3], -r[0]])
    for name in sorted(nh):
        out.append([None, name, None])
    return out
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 higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'XXO'], [192, 'O'], [195, 'O']]],
     ['Bo', [[180, 'XX-'], [183, 'XO'], [186, 'X-'], [189, 'XO'], [192, 'O'], [195, 'O']]],
     ['Ade', [[180, 'XXX']]]],),
   [[1, 'Dee', 195], [2, 'Bo', 195], [None, 'Ade', None]]),
  ('regression: shared place key',
   ([['Eli', [[180, 'O'], [183, 'XXO'], [186, 'O']]],
     ['Fay', [[180, 'XO'], [183, 'XO'], [186, 'XX-']]],
     ['Dee', [[180, 'XO'], [183, 'X-'], [186, 'X-']]],
     ['Ade', [[180, '-'], [183, '-'], [186, 'XO']]],
     ['Cy', [[180, 'XO'], [183, '-'], [186, 'XX-']]]],),
   [[1, 'Eli', 186], [2, 'Ade', 186], [3, 'Fay', 183], [4, 'Cy', 180], [4, 'Dee', 180]]),
  ('variant scenario 1',
   ([['Cy', [[180, 'X-'], [183, 'XO'], [186, 'O'], [189, '-'], [192, 'XO'], [195, 'O']]],
     ['Eli', [[180, 'XXX']]],
     ['Dee', [[180, 'XO'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Cy', 195], [2, 'Dee', 183], [None, 'Eli', None]]),
  ('variant scenario 2',
   ([['Eli', [[180, 'XX-'], [183, 'X-'], [186, 'O'], [189, 'O'], [192, 'XXO']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Eli', 192], [2, 'Fay', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'O'], [183, 'O'], [186, 'XX-'], [189, 'XX-'], [192, 'XO']]],
     ['Eli', [[180, 'O'], [183, '-'], [186, 'XXO'], [189, 'X-'], [192, 'O']]],
     ['Fay', [[180, 'X-'], [183, 'X-'], [186, 'XX-'], [189, 'O'], [192, 'XO']]]],),
   [[1, 'Eli', 192], [2, 'Bo', 192], [2, 'Fay', 192]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XO'], [183, 'XX-'], [186, 'XX-']]],
     ['Ade', [[180, 'XXX']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'O']]],
     ['Cy', [[180, 'O'], [183, 'XXO'], [186, 'O']]],
     ['Eli', [[180, 'XXO'], [183, '-'], [186, 'O']]]],),
   [[1, 'Dee', 186], [2, 'Cy', 186], [2, 'Eli', 186], [4, 'Bo', 180], [None, 'Ade', None]]),
  ('variant scenario 1',
   ([['Eli', [[180, 'XX-'], [183, 'X-'], [186, '-'], [189, 'O'], [192, 'XO']]],
     ['Ade', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'XXO'], [192, 'O']]],
     ['Bo', [[180, 'X-'], [183, 'XX-'], [186, 'XX-'], [189, '-'], [192, 'XXX']]],
     ['Cy', [[180, 'XXX']]]],),
   [[1, 'Ade', 192], [2, 'Eli', 192], [None, 'Bo', None], [None, 'Cy', None]]),
  ('variant scenario 2',
   ([['Eli', [[180, 'XO'], [183, 'X-'], [186, 'X-']]],
     ['Cy', [[180, 'X-'], [183, 'XX-'], [186, 'X-']]]],),
   [[1, 'Eli', 180], [None, 'Cy', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XO'], [183, 'O'], [186, 'XXX']]],
     ['Eli', [[180, 'XXO'], [183, 'X-'], [186, 'XXO']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'XXO']]],
     ['Ade', [[180, 'X-'], [183, 'XO'], [186, 'XX-']]]],),
   [[1, 'Dee', 186], [2, 'Eli', 186], [3, 'Bo', 183], [4, 'Ade', 183]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'XO'], [183, 'O'], [186, 'O']]],
     ['Ade', [[180, '-'], [183, 'X-'], [186, 'O']]],
     ['Eli', [[180, 'XO'], [183, 'XXX']]]],),
   [[1, 'Ade', 186], [1, 'Dee', 186], [3, 'Eli', 180]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XX-'], [183, 'O'], [186, 'XX-']]],
     ['Cy', [[180, 'O'], [183, '-'], [186, 'XX-']]],
     ['Dee', [[180, '-'], [183, '-'], [186, 'XO']]]],),
   [[1, 'Dee', 186], [2, 'Bo', 183], [3, 'Cy', 180]]),
  ('variant scenario 2',
   ([['Fay', [[180, 'XXX']]],
     ['Ade', [[180, 'XXO'], [183, '-'], [186, 'O'], [189, 'XXX']]],
     ['Cy', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'O']]]],),
   [[1, 'Cy', 189], [2, 'Ade', 186], [None, 'Fay', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, 'XO'], [183, 'O'], [186, '-'], [189, 'X-'], [192, 'O'], [195, 'O']]],
     ['Bo', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'O'], [186, 'XO'], [189, 'XX-'], [192, 'X-'], [195, 'XO']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, 'XO'], [189, 'O'], [192, 'O'], [195, 'XO']]],
     ['Fay', [[180, 'XXX']]]],),
   [[1, 'Dee', 195], [2, 'Ade', 195], [3, 'Eli', 195], [None, 'Bo', None], [None, 'Fay', None]]),
  ('regression: shared place key',
   ([['Dee', [[180, '-'], [183, 'XXO'], [186, 'XXX']]],
     ['Cy', [[180, 'O'], [183, 'XXO'], [186, 'X-']]],
     ['Ade', [[180, 'X-'], [183, 'X-'], [186, 'O']]]],),
   [[1, 'Ade', 186], [2, 'Cy', 183], [2, 'Dee', 183]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XO'], [183, '-'], [186, 'O'], [189, '-']]],
     ['Cy', [[180, '-'], [183, 'XXX']]],
     ['Fay', [[180, 'XXO'], [183, 'XXX']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'O']]]],),
   [[1, 'Eli', 189], [2, 'Bo', 186], [3, 'Fay', 180], [None, 'Cy', None]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'XO'], [189, 'XXO'], [192, 'O']]],
     ['Eli', [[180, 'X-'], [183, 'XXO'], [186, '-'], [189, 'XX-'], [192, '-']]]],),
   [[1, 'Dee', 192], [2, 'Eli', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Eli', [[180, '-'], [183, 'XO'], [186, 'X-'], [189, 'XO'], [192, 'X-']]],
     ['Bo', [[180, 'O'], [183, 'X-'], [186, 'XXX']]],
     ['Dee', [[180, 'XXX']]],
     ['Ade', [[180, 'O'], [183, '-'], [186, 'O'], [189, 'O'], [192, 'O']]],
     ['Fay', [[180, 'O'], [183, 'XX-'], [186, 'XO'], [189, '-'], [192, 'O']]]],),
   [[1, 'Ade', 192], [2, 'Fay', 192], [3, 'Eli', 189], [4, 'Bo', 180], [None, 'Dee', None]]),
  ('regression: shared place key',
   ([['Bo', [[180, 'XXO'], [183, 'XXX']]],
     ['Ade', [[180, '-'], [183, 'XO'], [186, 'XXX']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, '-'], [189, 'O']]],
     ['Cy', [[180, '-'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, '-'], [186, 'X-'], [189, 'X-']]]],),
   [[1, 'Cy', 189], [1, 'Fay', 189], [3, 'Ade', 183], [4, 'Dee', 180], [5, 'Bo', 180]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'XO'], [186, '-'], [189, 'XXO'], [192, 'XXO']]],
     ['Dee', [[180, 'XXX']]]],),
   [[1, 'Eli', 192], [None, 'Ade', None], [None, 'Dee', None]]),
  ('variant scenario 2',
   ([['Ade', [[180, 'XXX']]],
     ['Eli', [[180, 'O'], [183, 'XXO'], [186, '-']]],
     ['Cy', [[180, 'XO'], [183, 'O'], [186, 'XO']]]],),
   [[1, 'Cy', 186], [2, 'Eli', 183], [None, 'Ade', None]])]]
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:
Athletes identical on every criterion receive different places.

High jump placing. records rows are [name, [[height_cm, attempts], ...]] where attempts is a string of X (failure), O (clearance) or "-" (pass). Best height is the highest cleared. Rank by best height descending, then fewest failures at the best height, then fewest total failures at heights up to and including the best; athletes equal on all three share the place (the next place is skipped). Athletes without a clearance come last with place None in name order. Return [place, name, best].

split: open-access


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

N = 1
observations = []
def solve(records):
    rows = []
    nh = []
    for name, heights in records:
        cleared = [h for h, s in heights if 'X' not in s]
        if not cleared:
            nh.append(name)
            continue
        best = max(cleared)
        at_best = sum(s.count('X') for h, s in heights if h == best)
        total = sum(s.count('X') for h, s in heights if h <= best)
        rows.append((-best, at_best, total, name))
    rows.sort()
    out = []
    for i, r in enumerate(rows):
        if i and rows[i - 1][:3] == r[:3]:
            place = out[-1][0]
        else:
            place = i + 1
        out.append([place, r[3], -r[0]])
    for name in sorted(nh):
        out.append([None, name, None])
    return out
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 higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Eli', [[180, 'XXO'], [183, 'O'], [186, 'O']]],
     ['Bo', [[180, 'XXO'], [183, 'O'], [186, 'XXO']]],
     ['Ade', [[180, 'XO'], [183, 'XO'], [186, '-']]],
     ['Dee', [[180, 'XO'], [183, 'O'], [186, 'XX-']]],
     ['Cy', [[180, 'XO'], [183, 'XO'], [186, 'O']]]],),
   [[1, 'Cy', 186], [1, 'Eli', 186], [3, 'Bo', 186], [4, 'Dee', 183], [5, 'Ade', 183]]),
  ('variant scenario 1',
   ([['Cy', [[180, 'XXO'], [183, 'XO'], [186, 'XXX']]],
     ['Bo', [[180, 'O'], [183, 'XX-'], [186, 'XX-'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'XO']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Fay', [[180, '-'], [183, 'XO'], [186, 'O'], [189, 'O']]]],),
   [[1, 'Eli', 189], [1, 'Fay', 189], [3, 'Bo', 189], [4, 'Dee', 189], [5, 'Cy', 183]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]],
     ['Fay', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'XX-'], [186, 'X-'], [189, 'XXX']]],
     ['Bo', [[180, 'O'], [183, 'XXX']]]],),
   [[1, 'Dee', 189], [2, 'Bo', 180], [3, 'Eli', 180], [None, 'Fay', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Bo', [[180, 'X-'], [183, 'XXO'], [186, 'X-']]],
     ['Eli', [[180, 'O'], [183, 'O'], [186, 'XXO']]]],),
   [[1, 'Eli', 186], [2, 'Bo', 183]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XO'], [183, 'XX-'], [186, 'X-'], [189, 'X-'], [192, 'O'], [195, '-']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, 'XXO'], [189, 'O'], [192, 'O'], [195, 'XX-']]],
     ['Eli', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'X-'], [192, 'O'], [195, 'XO']]]],),
   [[1, 'Eli', 195], [2, 'Ade', 192], [2, 'Bo', 192]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'O'], [183, 'XO'], [186, 'O'], [189, '-']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, '-'], [189, '-']]],
     ['Cy', [[180, 'XXO'], [183, 'XXO'], [186, '-'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'O']]]],),
   [[1, 'Dee', 189], [2, 'Cy', 189], [3, 'Bo', 186], [4, 'Ade', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Dee', [[180, 'XO'], [183, 'X-'], [186, 'XXX']]],
     ['Fay', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'XXX']]]],),
   [[1, 'Fay', 186], [2, 'Dee', 180]]),
  ('variant scenario 1',
   ([['Eli', [[180, 'O'], [183, 'X-'], [186, 'O'], [189, 'XO']]],
     ['Fay', [[180, 'XX-'], [183, 'XXO'], [186, 'O'], [189, 'XXX']]],
     ['Ade', [[180, 'XXX']]]],),
   [[1, 'Eli', 189], [2, 'Fay', 186], [None, 'Ade', None]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'XO'], [183, 'XXO'], [186, 'XO'], [189, 'XO']]],
     ['Eli', [[180, 'XO'], [183, 'O'], [186, 'XXO'], [189, '-']]]],),
   [[1, 'Dee', 189], [2, 'Eli', 186]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Fay', [[180, 'O'], [183, 'X-'], [186, 'XX-'], [189, '-'], [192, 'XO']]],
     ['Cy', [[180, 'O'], [183, 'XXX']]],
     ['Dee', [[180, 'O'], [183, 'XXO'], [186, 'XO'], [189, 'O'], [192, 'XXX']]],
     ['Eli', [[180, '-'], [183, 'XO'], [186, 'O'], [189, 'XXX']]],
     ['Bo', [[180, 'X-'], [183, 'X-'], [186, '-'], [189, 'XX-'], [192, 'O']]]],),
   [[1, 'Bo', 192], [2, 'Fay', 192], [3, 'Dee', 189], [4, 'Eli', 186], [5, 'Cy', 180]]),
  ('regression: clearance detection',
   ([['Ade', [[180, '-'], [183, 'XX-'], [186, 'XXO'], [189, 'O']]],
     ['Bo', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]],
     ['Cy', [[180, 'XO'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Eli', [[180, '-'], [183, 'O'], [186, 'XO'], [189, '-']]]],),
   [[1, 'Cy', 189], [2, 'Ade', 189], [3, 'Bo', 189], [4, 'Eli', 186]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XO'], [183, 'O'], [186, 'O']]],
     ['Cy', [[180, 'XO'], [183, '-'], [186, 'XXX']]],
     ['Dee', [[180, 'O'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Ade', 186], [2, 'Dee', 183], [3, 'Cy', 180]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'XO'], [183, 'X-'], [186, '-']]],
     ['Ade', [[180, 'XXO'], [183, 'XXO'], [186, 'XXX']]]],),
   [[1, 'Ade', 183], [2, 'Bo', 180]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Fay', [[180, 'XO'], [183, 'XX-'], [186, '-'], [189, 'O'], [192, 'O'], [195, 'XO']]],
     ['Eli', [[180, 'XO'], [183, 'XX-'], [186, 'XXO'], [189, 'X-'], [192, 'XX-'], [195, 'XO']]],
     ['Cy', [[180, 'XXX']]],
     ['Ade', [[180, 'XX-'], [183, 'O'], [186, 'O'], [189, 'O'], [192, 'XO'], [195, 'XX-']]],
     ['Dee', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'O'], [192, 'XX-'], [195, '-']]]],),
   [[1, 'Fay', 195], [2, 'Eli', 195], [3, 'Ade', 192], [4, 'Dee', 189], [None, 'Cy', None]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XXO'], [183, 'O'], [186, '-'], [189, 'XXO']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'XXO']]],
     ['Cy', [[180, 'XXO'], [183, 'XXO'], [186, 'XX-'], [189, 'O']]]],),
   [[1, 'Cy', 189], [2, 'Eli', 189], [3, 'Ade', 189]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'XXO'], [183, 'XO'], [186, 'XO'], [189, 'XXX']]],
     ['Eli', [[180, 'XXX']]],
     ['Ade', [[180, '-'], [183, 'O'], [186, 'O'], [189, 'XX-']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]]],),
   [[1, 'Fay', 189], [2, 'Ade', 186], [3, 'Bo', 186], [None, 'Eli', None]])]]
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(records):
    rows = []
    nh = []
    for name, heights in records:
        cleared = [h for h, s in heights if s != 'XXX']
        if not cleared:
            nh.append(name)
            continue
        best = max(cleared)
        at_best = sum(s.count('X') for h, s in heights if h == best)
        total = sum(s.count('X') for h, s in heights if h <= best)
        rows.append((-best, at_best, total, name))
    rows.sort()
    out = []
    for i, r in enumerate(rows):
        if i and rows[i - 1][:3] == r[:3]:
            place = out[-1][0]
        else:
            place = i + 1
        out.append([place, r[3], -r[0]])
    for name in sorted(nh):
        out.append([None, name, None])
    return out
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 higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Eli', [[180, 'XXO'], [183, 'O'], [186, 'O']]],
     ['Bo', [[180, 'XXO'], [183, 'O'], [186, 'XXO']]],
     ['Ade', [[180, 'XO'], [183, 'XO'], [186, '-']]],
     ['Dee', [[180, 'XO'], [183, 'O'], [186, 'XX-']]],
     ['Cy', [[180, 'XO'], [183, 'XO'], [186, 'O']]]],),
   [[1, 'Cy', 186], [1, 'Eli', 186], [3, 'Bo', 186], [4, 'Dee', 183], [5, 'Ade', 183]]),
  ('variant scenario 1',
   ([['Cy', [[180, 'XXO'], [183, 'XO'], [186, 'XXX']]],
     ['Bo', [[180, 'O'], [183, 'XX-'], [186, 'XX-'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'XO']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Fay', [[180, '-'], [183, 'XO'], [186, 'O'], [189, 'O']]]],),
   [[1, 'Eli', 189], [1, 'Fay', 189], [3, 'Bo', 189], [4, 'Dee', 189], [5, 'Cy', 183]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]],
     ['Fay', [[180, 'XXX']]],
     ['Eli', [[180, 'XO'], [183, 'XX-'], [186, 'X-'], [189, 'XXX']]],
     ['Bo', [[180, 'O'], [183, 'XXX']]]],),
   [[1, 'Dee', 189], [2, 'Bo', 180], [3, 'Eli', 180], [None, 'Fay', None]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Bo', [[180, 'X-'], [183, 'XXO'], [186, 'X-']]],
     ['Eli', [[180, 'O'], [183, 'O'], [186, 'XXO']]]],),
   [[1, 'Eli', 186], [2, 'Bo', 183]]),
  ('variant scenario 1',
   ([['Bo', [[180, 'XO'], [183, 'XX-'], [186, 'X-'], [189, 'X-'], [192, 'O'], [195, '-']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, 'XXO'], [189, 'O'], [192, 'O'], [195, 'XX-']]],
     ['Eli', [[180, 'O'], [183, 'O'], [186, 'XXO'], [189, 'X-'], [192, 'O'], [195, 'XO']]]],),
   [[1, 'Eli', 195], [2, 'Ade', 192], [2, 'Bo', 192]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'O'], [183, 'XO'], [186, 'O'], [189, '-']]],
     ['Ade', [[180, 'XO'], [183, 'XXO'], [186, '-'], [189, '-']]],
     ['Cy', [[180, 'XXO'], [183, 'XXO'], [186, '-'], [189, 'O']]],
     ['Dee', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'O']]]],),
   [[1, 'Dee', 189], [2, 'Cy', 189], [3, 'Bo', 186], [4, 'Ade', 183]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Dee', [[180, 'XO'], [183, 'X-'], [186, 'XXX']]],
     ['Fay', [[180, 'O'], [183, 'XO'], [186, 'XO'], [189, 'XXX']]]],),
   [[1, 'Fay', 186], [2, 'Dee', 180]]),
  ('variant scenario 1',
   ([['Eli', [[180, 'O'], [183, 'X-'], [186, 'O'], [189, 'XO']]],
     ['Fay', [[180, 'XX-'], [183, 'XXO'], [186, 'O'], [189, 'XXX']]],
     ['Ade', [[180, 'XXX']]]],),
   [[1, 'Eli', 189], [2, 'Fay', 186], [None, 'Ade', None]]),
  ('variant scenario 2',
   ([['Dee', [[180, 'XO'], [183, 'XXO'], [186, 'XO'], [189, 'XO']]],
     ['Eli', [[180, 'XO'], [183, 'O'], [186, 'XXO'], [189, '-']]]],),
   [[1, 'Dee', 189], [2, 'Eli', 186]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Fay', [[180, 'O'], [183, 'X-'], [186, 'XX-'], [189, '-'], [192, 'XO']]],
     ['Cy', [[180, 'O'], [183, 'XXX']]],
     ['Dee', [[180, 'O'], [183, 'XXO'], [186, 'XO'], [189, 'O'], [192, 'XXX']]],
     ['Eli', [[180, '-'], [183, 'XO'], [186, 'O'], [189, 'XXX']]],
     ['Bo', [[180, 'X-'], [183, 'X-'], [186, '-'], [189, 'XX-'], [192, 'O']]]],),
   [[1, 'Bo', 192], [2, 'Fay', 192], [3, 'Dee', 189], [4, 'Eli', 186], [5, 'Cy', 180]]),
  ('regression: clearance detection',
   ([['Ade', [[180, '-'], [183, 'XX-'], [186, 'XXO'], [189, 'O']]],
     ['Bo', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]],
     ['Cy', [[180, 'XO'], [183, 'O'], [186, 'O'], [189, 'O']]],
     ['Eli', [[180, '-'], [183, 'O'], [186, 'XO'], [189, '-']]]],),
   [[1, 'Cy', 189], [2, 'Ade', 189], [3, 'Bo', 189], [4, 'Eli', 186]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XO'], [183, 'O'], [186, 'O']]],
     ['Cy', [[180, 'XO'], [183, '-'], [186, 'XXX']]],
     ['Dee', [[180, 'O'], [183, 'O'], [186, 'XXX']]]],),
   [[1, 'Ade', 186], [2, 'Dee', 183], [3, 'Cy', 180]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'XO'], [183, 'X-'], [186, '-']]],
     ['Ade', [[180, 'XXO'], [183, 'XXO'], [186, 'XXX']]]],),
   [[1, 'Ade', 183], [2, 'Bo', 180]])],
 [('control higher clearance wins',
   ([['Ade', [[180, 'O'], [183, 'XXX']]], ['Bo', [[180, 'O'], [183, 'O']]]],),
   [[1, 'Bo', 183], [2, 'Ade', 180]]),
  ('boundary fewer misses at best',
   ([['Ade', [[180, 'XO']]], ['Bo', [[180, 'O']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary total misses countback',
   ([['Ade', [[177, 'XO'], [180, 'O'], [183, 'XXX']]],
     ['Bo', [[177, 'O'], [180, 'O'], [183, 'XXX']]]],),
   [[1, 'Bo', 180], [2, 'Ade', 180]]),
  ('boundary true tie shares place',
   ([['Cy', [[180, 'XO']]], ['Ade', [[180, 'XO']]], ['Bo', [[177, 'O']]]],),
   [[1, 'Ade', 180], [1, 'Cy', 180], [3, 'Bo', 177]]),
  ('control no height',
   ([['Dee', [[180, 'XXX']]], ['Ade', [[180, 'O']]]],),
   [[1, 'Ade', 180], [None, 'Dee', None]]),
  ('regression: clearance detection',
   ([['Fay', [[180, 'XO'], [183, 'XX-'], [186, '-'], [189, 'O'], [192, 'O'], [195, 'XO']]],
     ['Eli', [[180, 'XO'], [183, 'XX-'], [186, 'XXO'], [189, 'X-'], [192, 'XX-'], [195, 'XO']]],
     ['Cy', [[180, 'XXX']]],
     ['Ade', [[180, 'XX-'], [183, 'O'], [186, 'O'], [189, 'O'], [192, 'XO'], [195, 'XX-']]],
     ['Dee', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'O'], [192, 'XX-'], [195, '-']]]],),
   [[1, 'Fay', 195], [2, 'Eli', 195], [3, 'Ade', 192], [4, 'Dee', 189], [None, 'Cy', None]]),
  ('variant scenario 1',
   ([['Ade', [[180, 'XXO'], [183, 'O'], [186, '-'], [189, 'XXO']]],
     ['Eli', [[180, 'X-'], [183, 'O'], [186, 'O'], [189, 'XXO']]],
     ['Cy', [[180, 'XXO'], [183, 'XXO'], [186, 'XX-'], [189, 'O']]]],),
   [[1, 'Cy', 189], [2, 'Eli', 189], [3, 'Ade', 189]]),
  ('variant scenario 2',
   ([['Bo', [[180, 'XXO'], [183, 'XO'], [186, 'XO'], [189, 'XXX']]],
     ['Eli', [[180, 'XXX']]],
     ['Ade', [[180, '-'], [183, 'O'], [186, 'O'], [189, 'XX-']]],
     ['Fay', [[180, 'O'], [183, 'O'], [186, 'O'], [189, 'XO']]]],),
   [[1, 'Fay', 189], [2, 'Ade', 186], [3, 'Bo', 186], [None, 'Eli', None]])]]
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 height the athlete passed, or failed three times, is treated as cleared.

High jump placing. records rows are [name, [[height_cm, attempts], ...]] where attempts is a string of X (failure), O (clearance) or "-" (pass). Best height is the highest cleared. Rank by best height descending, then fewest failures at the best height, then fewest total failures at heights up to and including the best; athletes equal on all three share the place (the next place is skipped). Athletes without a clearance come last with place None in name order. Return [place, name, best].

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(round(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('1500m', '5:09.37'), 507),
  ('regression: points truncation', ('400m', '48.73'), 874),
  ('variant scenario 1', ('long_jump', '4.80'), 345),
  ('variant scenario 2', ('100m', '10.72'), 924)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('1500m', '4:30.23'), 743),
  ('variant scenario 1', ('400m', '54.00'), 640),
  ('variant scenario 2', ('100m', '12.08'), 635)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('400m', '52.84'), 688),
  ('variant scenario 1', ('shot_put', '14.30'), 747),
  ('variant scenario 2', ('400m', '57.67'), 496)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('400m', '57.13'), 516),
  ('regression: points truncation', ('1500m', '4:24.78'), 779),
  ('variant scenario 1', ('100m', '12.43'), 569),
  ('variant scenario 2', ('long_jump', '2.34'), 5)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('shot_put', '6.39'), 272),
  ('regression: points truncation', ('long_jump', '2.50'), 16),
  ('variant scenario 1', ('high_jump', '2.16'), 953),
  ('variant scenario 2', ('400m', '47.27'), 945)]]
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
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.ceil(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('1500m', '5:09.37'), 507),
  ('regression: points truncation', ('400m', '48.73'), 874),
  ('variant scenario 1', ('long_jump', '4.80'), 345),
  ('variant scenario 2', ('100m', '10.72'), 924)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('1500m', '4:30.23'), 743),
  ('variant scenario 1', ('400m', '54.00'), 640),
  ('variant scenario 2', ('100m', '12.08'), 635)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('400m', '52.84'), 688),
  ('variant scenario 1', ('shot_put', '14.30'), 747),
  ('variant scenario 2', ('400m', '57.67'), 496)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('400m', '57.13'), 516),
  ('regression: points truncation', ('1500m', '4:24.78'), 779),
  ('variant scenario 1', ('100m', '12.43'), 569),
  ('variant scenario 2', ('long_jump', '2.34'), 5)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: points truncation', ('shot_put', '6.39'), 272),
  ('regression: points truncation', ('long_jump', '2.50'), 16),
  ('variant scenario 1', ('high_jump', '2.16'), 953),
  ('variant scenario 2', ('400m', '47.27'), 945)]]
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:
Performances just below a points boundary receive the next point.

Combined-events points. Coefficients (A, B, C, kind): 100m (25.4347, 18, 1.81, track), 400m (1.53775, 82, 1.81, track), 1500m (0.03768, 480, 1.85, track), long_jump (0.14354, 220, 1.4, jump), high_jump (0.8465, 75, 1.42, jump), shot_put (51.39, 1.5, 1.05, throw). Track performances are seconds, 1500m as "m:ss.hh"; jumps are given in metres but scored in whole centimetres (rounded); throws in metres. Track points = floor(A * (B - P) ** C), field points = floor(A * (P - B) ** C); a non-positive base scores 0.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = p
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.96'), 767),
  ('regression: jump centimetres', ('long_jump', '4.77'), 339),
  ('variant scenario 1', ('400m', '56.96'), 522),
  ('variant scenario 2', ('shot_put', '13.92'), 723)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.87'), 687),
  ('regression: jump centimetres', ('high_jump', '2.03'), 831),
  ('variant scenario 1', ('1500m', '4:51.27'), 611),
  ('variant scenario 2', ('100m', '11.99'), 653)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.83'), 653),
  ('regression: jump centimetres', ('high_jump', '2.07'), 868),
  ('variant scenario 1', ('400m', '59.82'), 419),
  ('variant scenario 2', ('100m', '12.37'), 580)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('long_jump', '5.64'), 510),
  ('regression: jump centimetres', ('long_jump', '4.02'), 209),
  ('variant scenario 1', ('shot_put', '12.10'), 612),
  ('variant scenario 2', ('high_jump', '1.75'), 585)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.76'), 593),
  ('regression: jump centimetres', ('high_jump', '2.01'), 813),
  ('variant scenario 1', ('400m', '51.67'), 739),
  ('variant scenario 2', ('high_jump', '2.18'), 973)]]
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
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = int(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.96'), 767),
  ('regression: jump centimetres', ('long_jump', '4.77'), 339),
  ('variant scenario 1', ('400m', '56.96'), 522),
  ('variant scenario 2', ('shot_put', '13.92'), 723)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.87'), 687),
  ('regression: jump centimetres', ('high_jump', '2.03'), 831),
  ('variant scenario 1', ('1500m', '4:51.27'), 611),
  ('variant scenario 2', ('100m', '11.99'), 653)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.83'), 653),
  ('regression: jump centimetres', ('high_jump', '2.07'), 868),
  ('variant scenario 1', ('400m', '59.82'), 419),
  ('variant scenario 2', ('100m', '12.37'), 580)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('long_jump', '5.64'), 510),
  ('regression: jump centimetres', ('long_jump', '4.02'), 209),
  ('variant scenario 1', ('shot_put', '12.10'), 612),
  ('variant scenario 2', ('high_jump', '1.75'), 585)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: jump centimetres', ('high_jump', '1.76'), 593),
  ('regression: jump centimetres', ('high_jump', '2.01'), 813),
  ('variant scenario 1', ('400m', '51.67'), 739),
  ('variant scenario 2', ('high_jump', '2.18'), 973)]]
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:
Every jump scores zero or is off by a point after conversion.

Combined-events points. Coefficients (A, B, C, kind): 100m (25.4347, 18, 1.81, track), 400m (1.53775, 82, 1.81, track), 1500m (0.03768, 480, 1.85, track), long_jump (0.14354, 220, 1.4, jump), high_jump (0.8465, 75, 1.42, jump), shot_put (51.39, 1.5, 1.05, throw). Track performances are seconds, 1500m as "m:ss.hh"; jumps are given in metres but scored in whole centimetres (rounded); throws in metres. Track points = floor(A * (B - P) ** C), field points = floor(A * (P - B) ** C); a non-positive base scores 0.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) + float(s)
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:56.61'), 579),
  ('variant scenario 1', ('100m', '12.05'), 641),
  ('variant scenario 2', ('100m', '11.56'), 740)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:22.46'), 795),
  ('variant scenario 1', ('100m', '11.69'), 713),
  ('variant scenario 2', ('shot_put', '10.17'), 496)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:43.13'), 661),
  ('variant scenario 1', ('400m', '48.88'), 867),
  ('variant scenario 2', ('100m', '11.55'), 742)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:13.72'), 855),
  ('variant scenario 1', ('high_jump', '1.92'), 731),
  ('variant scenario 2', ('shot_put', '8.87'), 418)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '5:02.42'), 546),
  ('variant scenario 1', ('400m', '49.41'), 842),
  ('variant scenario 2', ('shot_put', '3.75'), 120)]]
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
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + int(float(s))
        else:
            p = float(perf)
        base = B - p
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:56.61'), 579),
  ('variant scenario 1', ('100m', '12.05'), 641),
  ('variant scenario 2', ('100m', '11.56'), 740)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:22.46'), 795),
  ('variant scenario 1', ('100m', '11.69'), 713),
  ('variant scenario 2', ('shot_put', '10.17'), 496)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:43.13'), 661),
  ('variant scenario 1', ('400m', '48.88'), 867),
  ('variant scenario 2', ('100m', '11.55'), 742)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '4:13.72'), 855),
  ('variant scenario 1', ('high_jump', '1.92'), 731),
  ('variant scenario 2', ('shot_put', '8.87'), 418)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: minutes parsing', ('1500m', '5:02.42'), 546),
  ('variant scenario 1', ('400m', '49.41'), 842),
  ('variant scenario 2', ('shot_put', '3.75'), 120)]]
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 4:30.00 1500m scores as if it were 34 seconds or loses hundredths.

Combined-events points. Coefficients (A, B, C, kind): 100m (25.4347, 18, 1.81, track), 400m (1.53775, 82, 1.81, track), 1500m (0.03768, 480, 1.85, track), long_jump (0.14354, 220, 1.4, jump), high_jump (0.8465, 75, 1.42, jump), shot_put (51.39, 1.5, 1.05, throw). Track performances are seconds, 1500m as "m:ss.hh"; jumps are given in metres but scored in whole centimetres (rounded); throws in metres. Track points = floor(A * (B - P) ** C), field points = floor(A * (P - B) ** C); a non-positive base scores 0.

split: open-access


broken_source:
"""Failure Map reference implementation. Python standard library only."""
import json
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = p - B
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '50.19'), 806),
  ('regression: track orientation', ('100m', '19.20'), 0),
  ('variant scenario 1', ('shot_put', '7.58'), 341),
  ('variant scenario 2', ('1500m', '5:05.73'), 527)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '46.65'), 976),
  ('regression: track orientation', ('100m', '18.50'), 0),
  ('variant scenario 1', ('long_jump', '6.88'), 785),
  ('variant scenario 2', ('high_jump', '2.01'), 813)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('1500m', '5:00.81'), 555),
  ('regression: track orientation', ('100m', '18.77'), 0),
  ('variant scenario 1', ('shot_put', '9.22'), 439),
  ('variant scenario 2', ('100m', '12.25'), 603)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '57.81'), 491),
  ('regression: track orientation', ('100m', '18.50'), 0),
  ('variant scenario 1', ('400m', '53.57'), 657),
  ('variant scenario 2', ('1500m', '4:52.19'), 606)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('100m', '12.17'), 618),
  ('regression: track orientation', ('100m', '18.95'), 0),
  ('variant scenario 1', ('400m', '50.41'), 796),
  ('variant scenario 2', ('1500m', '4:45.49'), 646)]]
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
import math
N = 1
observations = []
def solve(event, perf):
    TABLE = {'100m': (25.4347, 18, 1.81, 'track'), '400m': (1.53775, 82, 1.81, 'track'),
             '1500m': (0.03768, 480, 1.85, 'track'), 'long_jump': (0.14354, 220, 1.4, 'jump'),
             'high_jump': (0.8465, 75, 1.42, 'jump'), 'shot_put': (51.39, 1.5, 1.05, 'throw')}
    A, B, C, kind = TABLE[event]
    if kind == 'track':
        if ':' in perf:
            m, s = perf.split(':')
            p = int(m) * 60 + float(s)
        else:
            p = float(perf)
        base = abs(B - p)
    else:
        p = float(perf)
        if kind == 'jump':
            p = round(p * 100)
        base = p - B
    if base <= 0:
        return 0
    return int(math.floor(A * base ** C))
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 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '50.19'), 806),
  ('regression: track orientation', ('100m', '19.20'), 0),
  ('variant scenario 1', ('shot_put', '7.58'), 341),
  ('variant scenario 2', ('1500m', '5:05.73'), 527)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '46.65'), 976),
  ('regression: track orientation', ('100m', '18.50'), 0),
  ('variant scenario 1', ('long_jump', '6.88'), 785),
  ('variant scenario 2', ('high_jump', '2.01'), 813)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('1500m', '5:00.81'), 555),
  ('regression: track orientation', ('100m', '18.77'), 0),
  ('variant scenario 1', ('shot_put', '9.22'), 439),
  ('variant scenario 2', ('100m', '12.25'), 603)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('400m', '57.81'), 491),
  ('regression: track orientation', ('100m', '18.50'), 0),
  ('variant scenario 1', ('400m', '53.57'), 657),
  ('variant scenario 2', ('1500m', '4:52.19'), 606)],
 [('control 100m', ('100m', '10.50'), 975),
  ('control long jump', ('long_jump', '7.50'), 935),
  ('control shot put', ('shot_put', '15.00'), 790),
  ('control 1500m', ('1500m', '4:30.00'), 745),
  ('boundary slower than base', ('100m', '18.50'), 0),
  ('control high jump', ('high_jump', '2.01'), 813),
  ('regression: track orientation', ('100m', '12.17'), 618),
  ('regression: track orientation', ('100m', '18.95'), 0),
  ('variant scenario 1', ('400m', '50.41'), 796),
  ('variant scenario 2', ('1500m', '4:45.49'), 646)]]
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:
Running events score zero or slow times still earn points.

Combined-events points. Coefficients (A, B, C, kind): 100m (25.4347, 18, 1.81, track), 400m (1.53775, 82, 1.81, track), 1500m (0.03768, 480, 1.85, track), long_jump (0.14354, 220, 1.4, jump), high_jump (0.8465, 75, 1.42, jump), shot_put (51.39, 1.5, 1.05, throw). Track performances are seconds, 1500m as "m:ss.hh"; jumps are given in metres but scored in whole centimetres (rounded); throws in metres. Track points = floor(A * (B - P) ** C), field points = floor(A * (P - B) ** C); a non-positive base scores 0.

split: open-access