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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] == 'ACTIVE']
    eligible.sort(key=lambda p: (-p[2], p[0]))
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] in ('RB', 'WR', 'TE'):
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: questionable eligibility',
   [[['max', 'RB', 70, 'OUT'], ['fay', 'RB', 100, 'Q'], ['ada', 'TE', 70, 'Q'], ['gus', 'WR', 70, 'ACTIVE'],
     ['jo', 'RB', 150, 'ACTIVE'], ['kai', 'K', 120, 'OUT'], ['dee', 'QB', 85, 'ACTIVE'],
     ['ned', 'RB', 70, 'ACTIVE'], ['lu', 'K', 70, 'ACTIVE'], ['eli', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['dee'], 'RB': ['eli', 'jo'], 'TE': ['ada'], 'WR': ['gus']},
    'total': 625}),
  ('partial repair probe: questionable eligibility',
   [[['jo', 'WR', 150, 'OUT'], ['gus', 'WR', 100, 'ACTIVE'], ['ned', 'K', 70, 'OUT'],
     ['kai', 'RB', 120, 'ACTIVE'], ['max', 'WR', 70, 'BYE'], ['dee', 'TE', 70, 'Q'], ['pia', 'RB', 150, 'Q'],
     ['oz', 'RB', 85, 'ACTIVE'], ['hal', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': ['pia', 'kai'], 'TE': ['dee'], 'WR': ['gus']}, 'total': 525}),
  ('second regression',
   [[['eli', 'TE', 120, 'ACTIVE'], ['bo', 'RB', 70, 'ACTIVE'], ['ivy', 'QB', 120, 'OUT'],
     ['ada', 'K', 120, 'BYE'], ['hal', 'WR', 40, 'Q'], ['kai', 'RB', 100, 'Q'], ['max', 'QB', 150, 'ACTIVE'],
     ['jo', 'TE', 55, 'ACTIVE'], ['dee', 'RB', 100, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['max'], 'RB': ['kai', 'bo'], 'TE': ['eli'], 'WR': ['hal']},
    'total': 535}),
  ('normal control 1',
   [[['bo', 'WR', 120, 'ACTIVE'], ['pia', 'WR', 70, 'ACTIVE'], ['jo', 'WR', 70, 'OUT'],
     ['dee', 'QB', 100, 'ACTIVE'], ['kai', 'QB', 40, 'ACTIVE'], ['ned', 'RB', 120, 'ACTIVE'],
     ['gus', 'K', 70, 'ACTIVE'], ['cy', 'WR', 100, 'ACTIVE'], ['eli', 'WR', 55, 'BYE'],
     ['ada', 'WR', 70, 'ACTIVE'], ['lu', 'TE', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['dee'], 'RB': ['ned'], 'TE': ['lu'], 'WR': ['bo', 'cy']},
    'total': 595}),
  ('normal control 2',
   [[['oz', 'TE', 150, 'ACTIVE'], ['lu', 'K', 120, 'ACTIVE'], ['fay', 'WR', 55, 'OUT'],
     ['eli', 'K', 40, 'ACTIVE'], ['bo', 'RB', 100, 'ACTIVE'], ['ada', 'TE', 85, 'ACTIVE'],
     ['gus', 'K', 70, 'OUT']]],
   {'lineup': {'FLEX': ['ada'], 'QB': [], 'RB': ['bo'], 'TE': ['oz'], 'WR': []}, 'total': 335}),
  ('normal control 3',
   [[['gus', 'QB', 150, 'OUT'], ['hal', 'TE', 70, 'OUT'], ['kai', 'QB', 85, 'ACTIVE'],
     ['dee', 'TE', 70, 'ACTIVE'], ['lu', 'RB', 85, 'ACTIVE'], ['oz', 'K', 120, 'ACTIVE'],
     ['ivy', 'QB', 70, 'ACTIVE'], ['fay', 'K', 85, 'ACTIVE'], ['ada', 'K', 150, 'ACTIVE'],
     ['max', 'RB', 100, 'OUT'], ['bo', 'TE', 40, 'ACTIVE'], ['ned', 'K', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['bo'], 'QB': ['kai'], 'RB': ['lu'], 'TE': ['dee'], 'WR': []}, 'total': 280}),
  ('normal control 4',
   [[['fay', 'RB', 150, 'ACTIVE'], ['kai', 'K', 120, 'ACTIVE'], ['bo', 'K', 40, 'ACTIVE'],
     ['max', 'K', 100, 'Q'], ['ned', 'RB', 150, 'ACTIVE'], ['hal', 'QB', 150, 'ACTIVE'],
     ['pia', 'WR', 100, 'ACTIVE'], ['oz', 'K', 120, 'ACTIVE'], ['ada', 'RB', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['hal'], 'RB': ['fay', 'ned'], 'TE': [], 'WR': ['pia']},
    'total': 605})],
 [('regression: questionable eligibility',
   [[['oz', 'RB', 85, 'BYE'], ['ivy', 'K', 85, 'Q'], ['ned', 'RB', 70, 'BYE'], ['fay', 'WR', 40, 'OUT'],
     ['max', 'QB', 100, 'OUT'], ['eli', 'RB', 100, 'BYE'], ['kai', 'RB', 150, 'ACTIVE'],
     ['bo', 'WR', 120, 'Q'], ['pia', 'WR', 70, 'OUT'], ['cy', 'QB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['cy'], 'RB': ['kai'], 'TE': [], 'WR': ['bo']}, 'total': 340}),
  ('partial repair probe: questionable eligibility',
   [[['ned', 'RB', 70, 'ACTIVE'], ['ivy', 'RB', 85, 'ACTIVE'], ['bo', 'TE', 150, 'BYE'],
     ['max', 'TE', 85, 'ACTIVE'], ['ada', 'RB', 120, 'ACTIVE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['hal', 'RB', 55, 'OUT'], ['cy', 'TE', 100, 'BYE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': [], 'RB': ['ada', 'ivy'], 'TE': ['max'], 'WR': ['dee']}, 'total': 430}),
  ('second regression',
   [[['jo', 'QB', 85, 'Q'], ['kai', 'TE', 150, 'OUT'], ['max', 'RB', 55, 'ACTIVE'], ['gus', 'WR', 120, 'Q'],
     ['fay', 'WR', 100, 'ACTIVE'], ['dee', 'RB', 100, 'ACTIVE'], ['pia', 'WR', 70, 'ACTIVE'],
     ['bo', 'TE', 55, 'Q'], ['ned', 'K', 100, 'BYE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': ['jo'], 'RB': ['dee', 'max'], 'TE': ['bo'], 'WR': ['gus', 'fay']},
    'total': 585}),
  ('normal control 1',
   [[['bo', 'WR', 85, 'ACTIVE'], ['fay', 'WR', 150, 'ACTIVE'], ['lu', 'K', 100, 'Q'],
     ['kai', 'K', 55, 'ACTIVE'], ['ivy', 'WR', 85, 'OUT'], ['max', 'RB', 70, 'ACTIVE'],
     ['jo', 'TE', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['max'], 'TE': [], 'WR': ['fay', 'bo']}, 'total': 305}),
  ('normal control 2',
   [[['bo', 'RB', 100, 'OUT'], ['oz', 'WR', 150, 'ACTIVE'], ['pia', 'QB', 70, 'BYE'],
     ['ivy', 'QB', 100, 'BYE'], ['lu', 'TE', 55, 'ACTIVE'], ['ada', 'K', 55, 'ACTIVE'],
     ['hal', 'TE', 100, 'ACTIVE'], ['eli', 'RB', 70, 'ACTIVE'], ['cy', 'QB', 120, 'ACTIVE'],
     ['kai', 'TE', 40, 'BYE']]],
   {'lineup': {'FLEX': ['lu'], 'QB': ['cy'], 'RB': ['eli'], 'TE': ['hal'], 'WR': ['oz']}, 'total': 495}),
  ('normal control 3',
   [[['lu', 'K', 100, 'BYE'], ['cy', 'WR', 100, 'ACTIVE'], ['bo', 'RB', 70, 'OUT'],
     ['fay', 'RB', 85, 'ACTIVE'], ['ivy', 'WR', 55, 'ACTIVE'], ['dee', 'TE', 70, 'OUT'],
     ['ada', 'RB', 55, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['fay'], 'TE': [], 'WR': ['cy', 'ivy']}, 'total': 240}),
  ('normal control 4',
   [[['ivy', 'K', 70, 'OUT'], ['fay', 'RB', 55, 'ACTIVE'], ['gus', 'WR', 85, 'ACTIVE'],
     ['cy', 'WR', 40, 'BYE'], ['lu', 'WR', 70, 'ACTIVE'], ['ned', 'K', 55, 'Q'],
     ['dee', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['lu'], 'QB': [], 'RB': ['fay'], 'TE': [], 'WR': ['dee', 'gus']}, 'total': 310})],
 [('regression: questionable eligibility',
   [[['lu', 'RB', 150, 'Q'], ['kai', 'WR', 70, 'ACTIVE'], ['dee', 'QB', 120, 'ACTIVE'],
     ['hal', 'WR', 150, 'OUT'], ['ada', 'RB', 55, 'ACTIVE'], ['jo', 'RB', 55, 'ACTIVE'],
     ['ned', 'K', 55, 'Q'], ['gus', 'RB', 55, 'BYE'], ['fay', 'TE', 70, 'ACTIVE'],
     ['bo', 'TE', 120, 'ACTIVE'], ['pia', 'RB', 40, 'ACTIVE'], ['max', 'WR', 100, 'BYE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['dee'], 'RB': ['lu', 'ada'], 'TE': ['bo'], 'WR': ['kai']},
    'total': 585}),
  ('partial repair probe: questionable eligibility',
   [[['hal', 'QB', 70, 'ACTIVE'], ['lu', 'WR', 70, 'BYE'], ['dee', 'QB', 70, 'ACTIVE'],
     ['eli', 'WR', 100, 'BYE'], ['bo', 'QB', 40, 'Q'], ['ada', 'WR', 70, 'ACTIVE'], ['oz', 'TE', 100, 'OUT'],
     ['ivy', 'QB', 150, 'Q'], ['cy', 'RB', 70, 'ACTIVE'], ['jo', 'WR', 70, 'ACTIVE'],
     ['gus', 'TE', 40, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['ivy'], 'RB': ['cy'], 'TE': [], 'WR': ['ada', 'jo']}, 'total': 360}),
  ('second regression',
   [[['cy', 'WR', 55, 'ACTIVE'], ['eli', 'QB', 40, 'BYE'], ['fay', 'WR', 70, 'BYE'], ['kai', 'WR', 120, 'Q'],
     ['jo', 'WR', 70, 'OUT'], ['max', 'RB', 85, 'OUT'], ['pia', 'TE', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': ['pia'], 'WR': ['kai', 'cy']}, 'total': 245}),
  ('normal control 1',
   [[['cy', 'WR', 55, 'OUT'], ['bo', 'WR', 70, 'ACTIVE'], ['kai', 'K', 40, 'OUT'],
     ['ivy', 'K', 100, 'ACTIVE'], ['dee', 'RB', 150, 'ACTIVE'], ['jo', 'WR', 120, 'ACTIVE'],
     ['lu', 'TE', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['dee'], 'TE': ['lu'], 'WR': ['jo', 'bo']}, 'total': 440}),
  ('normal control 2',
   [[['ada', 'K', 40, 'ACTIVE'], ['ivy', 'QB', 70, 'OUT'], ['eli', 'K', 150, 'Q'],
     ['dee', 'RB', 85, 'ACTIVE'], ['bo', 'WR', 150, 'ACTIVE'], ['gus', 'RB', 100, 'ACTIVE'],
     ['oz', 'RB', 100, 'ACTIVE'], ['max', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': ['gus', 'oz'], 'TE': [], 'WR': ['bo']}, 'total': 435}),
  ('normal control 3',
   [[['max', 'RB', 70, 'ACTIVE'], ['lu', 'WR', 40, 'OUT'], ['dee', 'WR', 70, 'ACTIVE'],
     ['oz', 'RB', 70, 'ACTIVE'], ['pia', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'],
     ['jo', 'K', 55, 'BYE'], ['kai', 'RB', 55, 'OUT']]],
   {'lineup': {'FLEX': ['fay'], 'QB': [], 'RB': ['max', 'oz'], 'TE': ['pia'], 'WR': ['dee']}, 'total': 320}),
  ('normal control 4',
   [[['kai', 'RB', 120, 'ACTIVE'], ['jo', 'WR', 150, 'ACTIVE'], ['hal', 'RB', 85, 'ACTIVE'],
     ['ned', 'WR', 120, 'ACTIVE'], ['fay', 'K', 55, 'ACTIVE'], ['eli', 'RB', 85, 'ACTIVE'],
     ['lu', 'TE', 70, 'BYE'], ['cy', 'RB', 70, 'ACTIVE'], ['oz', 'RB', 150, 'ACTIVE'],
     ['bo', 'TE', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['eli'], 'QB': [], 'RB': ['oz', 'kai'], 'TE': ['bo'], 'WR': ['jo', 'ned']},
    'total': 745})],
 [('regression: questionable eligibility',
   [[['fay', 'RB', 120, 'ACTIVE'], ['ada', 'K', 70, 'ACTIVE'], ['dee', 'QB', 85, 'Q'],
     ['eli', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 120, 'BYE'], ['pia', 'RB', 120, 'ACTIVE'],
     ['jo', 'WR', 70, 'ACTIVE'], ['bo', 'WR', 120, 'OUT'], ['oz', 'QB', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['dee'], 'RB': ['fay', 'pia'], 'TE': [], 'WR': ['eli', 'jo']},
    'total': 465}),
  ('partial repair probe: questionable eligibility',
   [[['cy', 'K', 120, 'OUT'], ['gus', 'WR', 120, 'ACTIVE'], ['dee', 'WR', 85, 'ACTIVE'],
     ['bo', 'K', 55, 'ACTIVE'], ['ned', 'WR', 120, 'ACTIVE'], ['ivy', 'QB', 40, 'BYE'],
     ['oz', 'WR', 120, 'ACTIVE'], ['hal', 'K', 70, 'Q']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': [], 'TE': [], 'WR': ['gus', 'ned']}, 'total': 360}),
  ('second regression',
   [[['kai', 'TE', 150, 'Q'], ['dee', 'RB', 120, 'ACTIVE'], ['gus', 'RB', 55, 'ACTIVE'],
     ['cy', 'TE', 85, 'ACTIVE'], ['ned', 'QB', 55, 'ACTIVE'], ['lu', 'RB', 70, 'OUT'],
     ['max', 'RB', 120, 'ACTIVE'], ['bo', 'WR', 150, 'OUT']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['ned'], 'RB': ['dee', 'max'], 'TE': ['kai'], 'WR': []}, 'total': 530}),
  ('normal control 1',
   [[['max', 'RB', 40, 'ACTIVE'], ['gus', 'WR', 70, 'ACTIVE'], ['ada', 'TE', 55, 'OUT'],
     ['dee', 'RB', 150, 'ACTIVE'], ['jo', 'QB', 120, 'ACTIVE'], ['bo', 'K', 120, 'Q'],
     ['pia', 'RB', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['jo'], 'RB': ['dee', 'pia'], 'TE': [], 'WR': ['gus']}, 'total': 465}),
  ('normal control 2',
   [[['max', 'WR', 85, 'ACTIVE'], ['dee', 'WR', 70, 'ACTIVE'], ['eli', 'RB', 55, 'OUT'],
     ['jo', 'WR', 120, 'ACTIVE'], ['ivy', 'QB', 55, 'ACTIVE'], ['bo', 'K', 100, 'OUT']]],
   {'lineup': {'FLEX': ['dee'], 'QB': ['ivy'], 'RB': [], 'TE': [], 'WR': ['jo', 'max']}, 'total': 330}),
  ('normal control 3',
   [[['oz', 'RB', 70, 'ACTIVE'], ['ivy', 'K', 70, 'ACTIVE'], ['fay', 'RB', 150, 'ACTIVE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['gus', 'QB', 120, 'ACTIVE'], ['pia', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['gus'], 'RB': ['fay', 'oz'], 'TE': ['eli'], 'WR': []}, 'total': 410}),
  ('normal control 4',
   [[['ivy', 'RB', 100, 'OUT'], ['ada', 'K', 150, 'ACTIVE'], ['oz', 'RB', 70, 'ACTIVE'],
     ['jo', 'WR', 100, 'ACTIVE'], ['kai', 'QB', 100, 'BYE'], ['fay', 'QB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': ['oz'], 'TE': [], 'WR': ['jo']}, 'total': 320})],
 [('regression: questionable eligibility',
   [[['jo', 'K', 120, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['gus', 'QB', 120, 'ACTIVE'],
     ['lu', 'K', 55, 'BYE'], ['oz', 'TE', 100, 'ACTIVE'], ['ivy', 'QB', 85, 'ACTIVE'],
     ['ned', 'RB', 100, 'ACTIVE'], ['fay', 'QB', 100, 'OUT'], ['max', 'WR', 100, 'ACTIVE'],
     ['dee', 'TE', 150, 'Q'], ['pia', 'WR', 100, 'OUT']]],
   {'lineup': {'FLEX': ['oz'], 'QB': ['gus'], 'RB': ['ned'], 'TE': ['dee'], 'WR': ['max', 'bo']},
    'total': 640}),
  ('partial repair probe: questionable eligibility',
   [[['kai', 'TE', 150, 'OUT'], ['ada', 'RB', 70, 'BYE'], ['max', 'QB', 120, 'ACTIVE'],
     ['jo', 'K', 120, 'ACTIVE'], ['eli', 'WR', 150, 'ACTIVE'], ['cy', 'RB', 55, 'OUT'],
     ['fay', 'K', 70, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': [], 'TE': [], 'WR': ['eli']}, 'total': 270}),
  ('second regression',
   [[['jo', 'QB', 70, 'Q'], ['ivy', 'QB', 120, 'BYE'], ['max', 'RB', 85, 'Q'], ['kai', 'WR', 70, 'Q'],
     ['lu', 'RB', 120, 'ACTIVE'], ['ned', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['lu', 'max'], 'TE': [], 'WR': ['kai', 'ned']}, 'total': 385}),
  ('normal control 1',
   [[['pia', 'TE', 100, 'ACTIVE'], ['oz', 'WR', 120, 'ACTIVE'], ['dee', 'QB', 150, 'ACTIVE'],
     ['eli', 'WR', 55, 'ACTIVE'], ['jo', 'RB', 70, 'Q'], ['kai', 'RB', 150, 'ACTIVE'],
     ['bo', 'RB', 55, 'ACTIVE'], ['ned', 'RB', 85, 'ACTIVE'], ['ada', 'WR', 150, 'ACTIVE'],
     ['lu', 'TE', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': ['dee'], 'RB': ['kai', 'ned'], 'TE': ['lu'], 'WR': ['ada', 'oz']},
    'total': 905}),
  ('normal control 2',
   [[['dee', 'RB', 120, 'ACTIVE'], ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'TE', 55, 'ACTIVE'],
     ['cy', 'TE', 70, 'OUT'], ['hal', 'WR', 85, 'ACTIVE'], ['max', 'WR', 150, 'ACTIVE'],
     ['gus', 'TE', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['kai'], 'QB': [], 'RB': ['dee', 'pia'], 'TE': ['gus'], 'WR': ['max', 'hal']},
    'total': 565}),
  ('normal control 3',
   [[['dee', 'TE', 55, 'ACTIVE'], ['fay', 'RB', 40, 'OUT'], ['cy', 'RB', 120, 'ACTIVE'],
     ['ned', 'TE', 55, 'ACTIVE'], ['kai', 'WR', 100, 'ACTIVE'], ['bo', 'RB', 55, 'ACTIVE'],
     ['pia', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': ['ned'], 'QB': [], 'RB': ['cy', 'bo'], 'TE': ['dee'], 'WR': ['kai']}, 'total': 385}),
  ('normal control 4',
   [[['hal', 'K', 40, 'BYE'], ['ada', 'K', 85, 'OUT'], ['ivy', 'RB', 85, 'ACTIVE'], ['bo', 'K', 85, 'OUT'],
     ['oz', 'K', 100, 'ACTIVE'], ['lu', 'TE', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['ivy'], 'TE': ['lu'], 'WR': []}, 'total': 140})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] != 'OUT']
    eligible.sort(key=lambda p: (-p[2], p[0]))
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] in ('RB', 'WR', 'TE'):
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: questionable eligibility',
   [[['max', 'RB', 70, 'OUT'], ['fay', 'RB', 100, 'Q'], ['ada', 'TE', 70, 'Q'], ['gus', 'WR', 70, 'ACTIVE'],
     ['jo', 'RB', 150, 'ACTIVE'], ['kai', 'K', 120, 'OUT'], ['dee', 'QB', 85, 'ACTIVE'],
     ['ned', 'RB', 70, 'ACTIVE'], ['lu', 'K', 70, 'ACTIVE'], ['eli', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['dee'], 'RB': ['eli', 'jo'], 'TE': ['ada'], 'WR': ['gus']},
    'total': 625}),
  ('partial repair probe: questionable eligibility',
   [[['jo', 'WR', 150, 'OUT'], ['gus', 'WR', 100, 'ACTIVE'], ['ned', 'K', 70, 'OUT'],
     ['kai', 'RB', 120, 'ACTIVE'], ['max', 'WR', 70, 'BYE'], ['dee', 'TE', 70, 'Q'], ['pia', 'RB', 150, 'Q'],
     ['oz', 'RB', 85, 'ACTIVE'], ['hal', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': ['pia', 'kai'], 'TE': ['dee'], 'WR': ['gus']}, 'total': 525}),
  ('second regression',
   [[['eli', 'TE', 120, 'ACTIVE'], ['bo', 'RB', 70, 'ACTIVE'], ['ivy', 'QB', 120, 'OUT'],
     ['ada', 'K', 120, 'BYE'], ['hal', 'WR', 40, 'Q'], ['kai', 'RB', 100, 'Q'], ['max', 'QB', 150, 'ACTIVE'],
     ['jo', 'TE', 55, 'ACTIVE'], ['dee', 'RB', 100, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['max'], 'RB': ['kai', 'bo'], 'TE': ['eli'], 'WR': ['hal']},
    'total': 535}),
  ('normal control 1',
   [[['bo', 'WR', 120, 'ACTIVE'], ['pia', 'WR', 70, 'ACTIVE'], ['jo', 'WR', 70, 'OUT'],
     ['dee', 'QB', 100, 'ACTIVE'], ['kai', 'QB', 40, 'ACTIVE'], ['ned', 'RB', 120, 'ACTIVE'],
     ['gus', 'K', 70, 'ACTIVE'], ['cy', 'WR', 100, 'ACTIVE'], ['eli', 'WR', 55, 'BYE'],
     ['ada', 'WR', 70, 'ACTIVE'], ['lu', 'TE', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['dee'], 'RB': ['ned'], 'TE': ['lu'], 'WR': ['bo', 'cy']},
    'total': 595}),
  ('normal control 2',
   [[['oz', 'TE', 150, 'ACTIVE'], ['lu', 'K', 120, 'ACTIVE'], ['fay', 'WR', 55, 'OUT'],
     ['eli', 'K', 40, 'ACTIVE'], ['bo', 'RB', 100, 'ACTIVE'], ['ada', 'TE', 85, 'ACTIVE'],
     ['gus', 'K', 70, 'OUT']]],
   {'lineup': {'FLEX': ['ada'], 'QB': [], 'RB': ['bo'], 'TE': ['oz'], 'WR': []}, 'total': 335}),
  ('normal control 3',
   [[['gus', 'QB', 150, 'OUT'], ['hal', 'TE', 70, 'OUT'], ['kai', 'QB', 85, 'ACTIVE'],
     ['dee', 'TE', 70, 'ACTIVE'], ['lu', 'RB', 85, 'ACTIVE'], ['oz', 'K', 120, 'ACTIVE'],
     ['ivy', 'QB', 70, 'ACTIVE'], ['fay', 'K', 85, 'ACTIVE'], ['ada', 'K', 150, 'ACTIVE'],
     ['max', 'RB', 100, 'OUT'], ['bo', 'TE', 40, 'ACTIVE'], ['ned', 'K', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['bo'], 'QB': ['kai'], 'RB': ['lu'], 'TE': ['dee'], 'WR': []}, 'total': 280}),
  ('normal control 4',
   [[['fay', 'RB', 150, 'ACTIVE'], ['kai', 'K', 120, 'ACTIVE'], ['bo', 'K', 40, 'ACTIVE'],
     ['max', 'K', 100, 'Q'], ['ned', 'RB', 150, 'ACTIVE'], ['hal', 'QB', 150, 'ACTIVE'],
     ['pia', 'WR', 100, 'ACTIVE'], ['oz', 'K', 120, 'ACTIVE'], ['ada', 'RB', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['hal'], 'RB': ['fay', 'ned'], 'TE': [], 'WR': ['pia']},
    'total': 605})],
 [('regression: questionable eligibility',
   [[['oz', 'RB', 85, 'BYE'], ['ivy', 'K', 85, 'Q'], ['ned', 'RB', 70, 'BYE'], ['fay', 'WR', 40, 'OUT'],
     ['max', 'QB', 100, 'OUT'], ['eli', 'RB', 100, 'BYE'], ['kai', 'RB', 150, 'ACTIVE'],
     ['bo', 'WR', 120, 'Q'], ['pia', 'WR', 70, 'OUT'], ['cy', 'QB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['cy'], 'RB': ['kai'], 'TE': [], 'WR': ['bo']}, 'total': 340}),
  ('partial repair probe: questionable eligibility',
   [[['ned', 'RB', 70, 'ACTIVE'], ['ivy', 'RB', 85, 'ACTIVE'], ['bo', 'TE', 150, 'BYE'],
     ['max', 'TE', 85, 'ACTIVE'], ['ada', 'RB', 120, 'ACTIVE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['hal', 'RB', 55, 'OUT'], ['cy', 'TE', 100, 'BYE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': [], 'RB': ['ada', 'ivy'], 'TE': ['max'], 'WR': ['dee']}, 'total': 430}),
  ('second regression',
   [[['jo', 'QB', 85, 'Q'], ['kai', 'TE', 150, 'OUT'], ['max', 'RB', 55, 'ACTIVE'], ['gus', 'WR', 120, 'Q'],
     ['fay', 'WR', 100, 'ACTIVE'], ['dee', 'RB', 100, 'ACTIVE'], ['pia', 'WR', 70, 'ACTIVE'],
     ['bo', 'TE', 55, 'Q'], ['ned', 'K', 100, 'BYE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': ['jo'], 'RB': ['dee', 'max'], 'TE': ['bo'], 'WR': ['gus', 'fay']},
    'total': 585}),
  ('normal control 1',
   [[['bo', 'WR', 85, 'ACTIVE'], ['fay', 'WR', 150, 'ACTIVE'], ['lu', 'K', 100, 'Q'],
     ['kai', 'K', 55, 'ACTIVE'], ['ivy', 'WR', 85, 'OUT'], ['max', 'RB', 70, 'ACTIVE'],
     ['jo', 'TE', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['max'], 'TE': [], 'WR': ['fay', 'bo']}, 'total': 305}),
  ('normal control 2',
   [[['bo', 'RB', 100, 'OUT'], ['oz', 'WR', 150, 'ACTIVE'], ['pia', 'QB', 70, 'BYE'],
     ['ivy', 'QB', 100, 'BYE'], ['lu', 'TE', 55, 'ACTIVE'], ['ada', 'K', 55, 'ACTIVE'],
     ['hal', 'TE', 100, 'ACTIVE'], ['eli', 'RB', 70, 'ACTIVE'], ['cy', 'QB', 120, 'ACTIVE'],
     ['kai', 'TE', 40, 'BYE']]],
   {'lineup': {'FLEX': ['lu'], 'QB': ['cy'], 'RB': ['eli'], 'TE': ['hal'], 'WR': ['oz']}, 'total': 495}),
  ('normal control 3',
   [[['lu', 'K', 100, 'BYE'], ['cy', 'WR', 100, 'ACTIVE'], ['bo', 'RB', 70, 'OUT'],
     ['fay', 'RB', 85, 'ACTIVE'], ['ivy', 'WR', 55, 'ACTIVE'], ['dee', 'TE', 70, 'OUT'],
     ['ada', 'RB', 55, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['fay'], 'TE': [], 'WR': ['cy', 'ivy']}, 'total': 240}),
  ('normal control 4',
   [[['ivy', 'K', 70, 'OUT'], ['fay', 'RB', 55, 'ACTIVE'], ['gus', 'WR', 85, 'ACTIVE'],
     ['cy', 'WR', 40, 'BYE'], ['lu', 'WR', 70, 'ACTIVE'], ['ned', 'K', 55, 'Q'],
     ['dee', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['lu'], 'QB': [], 'RB': ['fay'], 'TE': [], 'WR': ['dee', 'gus']}, 'total': 310})],
 [('regression: questionable eligibility',
   [[['lu', 'RB', 150, 'Q'], ['kai', 'WR', 70, 'ACTIVE'], ['dee', 'QB', 120, 'ACTIVE'],
     ['hal', 'WR', 150, 'OUT'], ['ada', 'RB', 55, 'ACTIVE'], ['jo', 'RB', 55, 'ACTIVE'],
     ['ned', 'K', 55, 'Q'], ['gus', 'RB', 55, 'BYE'], ['fay', 'TE', 70, 'ACTIVE'],
     ['bo', 'TE', 120, 'ACTIVE'], ['pia', 'RB', 40, 'ACTIVE'], ['max', 'WR', 100, 'BYE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['dee'], 'RB': ['lu', 'ada'], 'TE': ['bo'], 'WR': ['kai']},
    'total': 585}),
  ('partial repair probe: questionable eligibility',
   [[['hal', 'QB', 70, 'ACTIVE'], ['lu', 'WR', 70, 'BYE'], ['dee', 'QB', 70, 'ACTIVE'],
     ['eli', 'WR', 100, 'BYE'], ['bo', 'QB', 40, 'Q'], ['ada', 'WR', 70, 'ACTIVE'], ['oz', 'TE', 100, 'OUT'],
     ['ivy', 'QB', 150, 'Q'], ['cy', 'RB', 70, 'ACTIVE'], ['jo', 'WR', 70, 'ACTIVE'],
     ['gus', 'TE', 40, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['ivy'], 'RB': ['cy'], 'TE': [], 'WR': ['ada', 'jo']}, 'total': 360}),
  ('second regression',
   [[['cy', 'WR', 55, 'ACTIVE'], ['eli', 'QB', 40, 'BYE'], ['fay', 'WR', 70, 'BYE'], ['kai', 'WR', 120, 'Q'],
     ['jo', 'WR', 70, 'OUT'], ['max', 'RB', 85, 'OUT'], ['pia', 'TE', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': ['pia'], 'WR': ['kai', 'cy']}, 'total': 245}),
  ('normal control 1',
   [[['cy', 'WR', 55, 'OUT'], ['bo', 'WR', 70, 'ACTIVE'], ['kai', 'K', 40, 'OUT'],
     ['ivy', 'K', 100, 'ACTIVE'], ['dee', 'RB', 150, 'ACTIVE'], ['jo', 'WR', 120, 'ACTIVE'],
     ['lu', 'TE', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['dee'], 'TE': ['lu'], 'WR': ['jo', 'bo']}, 'total': 440}),
  ('normal control 2',
   [[['ada', 'K', 40, 'ACTIVE'], ['ivy', 'QB', 70, 'OUT'], ['eli', 'K', 150, 'Q'],
     ['dee', 'RB', 85, 'ACTIVE'], ['bo', 'WR', 150, 'ACTIVE'], ['gus', 'RB', 100, 'ACTIVE'],
     ['oz', 'RB', 100, 'ACTIVE'], ['max', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': ['gus', 'oz'], 'TE': [], 'WR': ['bo']}, 'total': 435}),
  ('normal control 3',
   [[['max', 'RB', 70, 'ACTIVE'], ['lu', 'WR', 40, 'OUT'], ['dee', 'WR', 70, 'ACTIVE'],
     ['oz', 'RB', 70, 'ACTIVE'], ['pia', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'],
     ['jo', 'K', 55, 'BYE'], ['kai', 'RB', 55, 'OUT']]],
   {'lineup': {'FLEX': ['fay'], 'QB': [], 'RB': ['max', 'oz'], 'TE': ['pia'], 'WR': ['dee']}, 'total': 320}),
  ('normal control 4',
   [[['kai', 'RB', 120, 'ACTIVE'], ['jo', 'WR', 150, 'ACTIVE'], ['hal', 'RB', 85, 'ACTIVE'],
     ['ned', 'WR', 120, 'ACTIVE'], ['fay', 'K', 55, 'ACTIVE'], ['eli', 'RB', 85, 'ACTIVE'],
     ['lu', 'TE', 70, 'BYE'], ['cy', 'RB', 70, 'ACTIVE'], ['oz', 'RB', 150, 'ACTIVE'],
     ['bo', 'TE', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['eli'], 'QB': [], 'RB': ['oz', 'kai'], 'TE': ['bo'], 'WR': ['jo', 'ned']},
    'total': 745})],
 [('regression: questionable eligibility',
   [[['fay', 'RB', 120, 'ACTIVE'], ['ada', 'K', 70, 'ACTIVE'], ['dee', 'QB', 85, 'Q'],
     ['eli', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 120, 'BYE'], ['pia', 'RB', 120, 'ACTIVE'],
     ['jo', 'WR', 70, 'ACTIVE'], ['bo', 'WR', 120, 'OUT'], ['oz', 'QB', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['dee'], 'RB': ['fay', 'pia'], 'TE': [], 'WR': ['eli', 'jo']},
    'total': 465}),
  ('partial repair probe: questionable eligibility',
   [[['cy', 'K', 120, 'OUT'], ['gus', 'WR', 120, 'ACTIVE'], ['dee', 'WR', 85, 'ACTIVE'],
     ['bo', 'K', 55, 'ACTIVE'], ['ned', 'WR', 120, 'ACTIVE'], ['ivy', 'QB', 40, 'BYE'],
     ['oz', 'WR', 120, 'ACTIVE'], ['hal', 'K', 70, 'Q']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': [], 'TE': [], 'WR': ['gus', 'ned']}, 'total': 360}),
  ('second regression',
   [[['kai', 'TE', 150, 'Q'], ['dee', 'RB', 120, 'ACTIVE'], ['gus', 'RB', 55, 'ACTIVE'],
     ['cy', 'TE', 85, 'ACTIVE'], ['ned', 'QB', 55, 'ACTIVE'], ['lu', 'RB', 70, 'OUT'],
     ['max', 'RB', 120, 'ACTIVE'], ['bo', 'WR', 150, 'OUT']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['ned'], 'RB': ['dee', 'max'], 'TE': ['kai'], 'WR': []}, 'total': 530}),
  ('normal control 1',
   [[['max', 'RB', 40, 'ACTIVE'], ['gus', 'WR', 70, 'ACTIVE'], ['ada', 'TE', 55, 'OUT'],
     ['dee', 'RB', 150, 'ACTIVE'], ['jo', 'QB', 120, 'ACTIVE'], ['bo', 'K', 120, 'Q'],
     ['pia', 'RB', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['jo'], 'RB': ['dee', 'pia'], 'TE': [], 'WR': ['gus']}, 'total': 465}),
  ('normal control 2',
   [[['max', 'WR', 85, 'ACTIVE'], ['dee', 'WR', 70, 'ACTIVE'], ['eli', 'RB', 55, 'OUT'],
     ['jo', 'WR', 120, 'ACTIVE'], ['ivy', 'QB', 55, 'ACTIVE'], ['bo', 'K', 100, 'OUT']]],
   {'lineup': {'FLEX': ['dee'], 'QB': ['ivy'], 'RB': [], 'TE': [], 'WR': ['jo', 'max']}, 'total': 330}),
  ('normal control 3',
   [[['oz', 'RB', 70, 'ACTIVE'], ['ivy', 'K', 70, 'ACTIVE'], ['fay', 'RB', 150, 'ACTIVE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['gus', 'QB', 120, 'ACTIVE'], ['pia', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['gus'], 'RB': ['fay', 'oz'], 'TE': ['eli'], 'WR': []}, 'total': 410}),
  ('normal control 4',
   [[['ivy', 'RB', 100, 'OUT'], ['ada', 'K', 150, 'ACTIVE'], ['oz', 'RB', 70, 'ACTIVE'],
     ['jo', 'WR', 100, 'ACTIVE'], ['kai', 'QB', 100, 'BYE'], ['fay', 'QB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': ['oz'], 'TE': [], 'WR': ['jo']}, 'total': 320})],
 [('regression: questionable eligibility',
   [[['jo', 'K', 120, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['gus', 'QB', 120, 'ACTIVE'],
     ['lu', 'K', 55, 'BYE'], ['oz', 'TE', 100, 'ACTIVE'], ['ivy', 'QB', 85, 'ACTIVE'],
     ['ned', 'RB', 100, 'ACTIVE'], ['fay', 'QB', 100, 'OUT'], ['max', 'WR', 100, 'ACTIVE'],
     ['dee', 'TE', 150, 'Q'], ['pia', 'WR', 100, 'OUT']]],
   {'lineup': {'FLEX': ['oz'], 'QB': ['gus'], 'RB': ['ned'], 'TE': ['dee'], 'WR': ['max', 'bo']},
    'total': 640}),
  ('partial repair probe: questionable eligibility',
   [[['kai', 'TE', 150, 'OUT'], ['ada', 'RB', 70, 'BYE'], ['max', 'QB', 120, 'ACTIVE'],
     ['jo', 'K', 120, 'ACTIVE'], ['eli', 'WR', 150, 'ACTIVE'], ['cy', 'RB', 55, 'OUT'],
     ['fay', 'K', 70, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': [], 'TE': [], 'WR': ['eli']}, 'total': 270}),
  ('second regression',
   [[['jo', 'QB', 70, 'Q'], ['ivy', 'QB', 120, 'BYE'], ['max', 'RB', 85, 'Q'], ['kai', 'WR', 70, 'Q'],
     ['lu', 'RB', 120, 'ACTIVE'], ['ned', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['lu', 'max'], 'TE': [], 'WR': ['kai', 'ned']}, 'total': 385}),
  ('normal control 1',
   [[['pia', 'TE', 100, 'ACTIVE'], ['oz', 'WR', 120, 'ACTIVE'], ['dee', 'QB', 150, 'ACTIVE'],
     ['eli', 'WR', 55, 'ACTIVE'], ['jo', 'RB', 70, 'Q'], ['kai', 'RB', 150, 'ACTIVE'],
     ['bo', 'RB', 55, 'ACTIVE'], ['ned', 'RB', 85, 'ACTIVE'], ['ada', 'WR', 150, 'ACTIVE'],
     ['lu', 'TE', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': ['dee'], 'RB': ['kai', 'ned'], 'TE': ['lu'], 'WR': ['ada', 'oz']},
    'total': 905}),
  ('normal control 2',
   [[['dee', 'RB', 120, 'ACTIVE'], ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'TE', 55, 'ACTIVE'],
     ['cy', 'TE', 70, 'OUT'], ['hal', 'WR', 85, 'ACTIVE'], ['max', 'WR', 150, 'ACTIVE'],
     ['gus', 'TE', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['kai'], 'QB': [], 'RB': ['dee', 'pia'], 'TE': ['gus'], 'WR': ['max', 'hal']},
    'total': 565}),
  ('normal control 3',
   [[['dee', 'TE', 55, 'ACTIVE'], ['fay', 'RB', 40, 'OUT'], ['cy', 'RB', 120, 'ACTIVE'],
     ['ned', 'TE', 55, 'ACTIVE'], ['kai', 'WR', 100, 'ACTIVE'], ['bo', 'RB', 55, 'ACTIVE'],
     ['pia', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': ['ned'], 'QB': [], 'RB': ['cy', 'bo'], 'TE': ['dee'], 'WR': ['kai']}, 'total': 385}),
  ('normal control 4',
   [[['hal', 'K', 40, 'BYE'], ['ada', 'K', 85, 'OUT'], ['ivy', 'RB', 85, 'ACTIVE'], ['bo', 'K', 85, 'OUT'],
     ['oz', 'K', 100, 'ACTIVE'], ['lu', 'TE', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['ivy'], 'TE': ['lu'], 'WR': []}, 'total': 140})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A questionable star is benched in favor of a lower-projected healthy player.

Players are [name, position, projection tenths, status]. OUT and BYE players are ineligible; Q (questionable) players are eligible. Rank by projection descending, name ascending on ties. Fill QB x1, RB x2, WR x2, TE x1, then one FLEX from the best remaining RB/WR/TE (kickers and QBs never flex). Return the slot lists and the total projection.

split: open-access


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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] not in ('OUT', 'BYE')]
    eligible.sort(key=lambda p: -p[2])
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] in ('RB', 'WR', 'TE'):
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: projection tie order',
   [[['fay', 'QB', 70, 'OUT'], ['ivy', 'K', 70, 'ACTIVE'], ['ned', 'WR', 70, 'ACTIVE'],
     ['hal', 'TE', 70, 'ACTIVE'], ['oz', 'K', 55, 'Q'], ['jo', 'RB', 70, 'ACTIVE'],
     ['max', 'WR', 70, 'ACTIVE'], ['eli', 'WR', 70, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['jo'], 'TE': ['hal'], 'WR': ['max', 'ned']}, 'total': 280}),
  ('partial repair probe: projection tie order',
   [[['fay', 'TE', 85, 'ACTIVE'], ['hal', 'QB', 120, 'OUT'], ['eli', 'K', 150, 'ACTIVE'],
     ['dee', 'RB', 85, 'ACTIVE'], ['cy', 'K', 85, 'ACTIVE'], ['pia', 'RB', 100, 'ACTIVE'],
     ['gus', 'RB', 40, 'ACTIVE'], ['ada', 'QB', 40, 'ACTIVE'], ['jo', 'RB', 70, 'ACTIVE'],
     ['ned', 'RB', 100, 'Q'], ['lu', 'WR', 70, 'Q'], ['kai', 'WR', 120, 'BYE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': ['ada'], 'RB': ['ned', 'pia'], 'TE': ['fay'], 'WR': ['lu']},
    'total': 480}),
  ('second regression',
   [[['cy', 'QB', 55, 'OUT'], ['max', 'QB', 70, 'ACTIVE'], ['hal', 'QB', 70, 'Q'], ['jo', 'WR', 100, 'Q'],
     ['bo', 'RB', 100, 'ACTIVE'], ['pia', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['hal'], 'RB': ['pia', 'bo'], 'TE': [], 'WR': ['jo']}, 'total': 390}),
  ('normal control 1',
   [[['ned', 'QB', 70, 'OUT'], ['max', 'QB', 70, 'ACTIVE'], ['bo', 'TE', 40, 'ACTIVE'],
     ['gus', 'WR', 100, 'BYE'], ['eli', 'RB', 40, 'ACTIVE'], ['dee', 'RB', 150, 'OUT'],
     ['fay', 'WR', 55, 'ACTIVE'], ['jo', 'RB', 40, 'OUT'], ['ivy', 'TE', 120, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': ['eli'], 'TE': ['bo'], 'WR': ['fay']}, 'total': 205}),
  ('normal control 2',
   [[['kai', 'WR', 70, 'ACTIVE'], ['ivy', 'QB', 55, 'ACTIVE'], ['gus', 'K', 120, 'BYE'],
     ['eli', 'RB', 120, 'OUT'], ['ned', 'WR', 40, 'ACTIVE'], ['hal', 'TE', 40, 'ACTIVE'],
     ['dee', 'K', 150, 'BYE'], ['max', 'K', 85, 'ACTIVE'], ['pia', 'QB', 70, 'Q'], ['fay', 'QB', 55, 'BYE'],
     ['oz', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': ['pia'], 'RB': [], 'TE': ['hal'], 'WR': ['kai', 'ned']}, 'total': 260}),
  ('normal control 3',
   [[['ned', 'K', 120, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'], ['oz', 'WR', 70, 'ACTIVE'],
     ['ada', 'RB', 70, 'ACTIVE'], ['cy', 'TE', 85, 'ACTIVE'], ['bo', 'QB', 85, 'ACTIVE'],
     ['jo', 'TE', 70, 'ACTIVE'], ['eli', 'RB', 100, 'BYE'], ['max', 'QB', 55, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['bo'], 'RB': ['ada'], 'TE': ['cy'], 'WR': ['dee', 'oz']},
    'total': 450}),
  ('normal control 4',
   [[['dee', 'K', 70, 'ACTIVE'], ['gus', 'WR', 85, 'ACTIVE'], ['lu', 'QB', 40, 'ACTIVE'],
     ['oz', 'RB', 150, 'BYE'], ['eli', 'RB', 85, 'Q'], ['ned', 'RB', 40, 'OUT'],
     ['bo', 'RB', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['lu'], 'RB': ['eli', 'bo'], 'TE': [], 'WR': ['gus']}, 'total': 265})],
 [('regression: projection tie order',
   [[['cy', 'QB', 70, 'ACTIVE'], ['gus', 'RB', 55, 'ACTIVE'], ['oz', 'K', 100, 'Q'],
     ['dee', 'K', 150, 'ACTIVE'], ['max', 'K', 70, 'ACTIVE'], ['fay', 'QB', 55, 'BYE'],
     ['ada', 'RB', 55, 'ACTIVE'], ['pia', 'QB', 85, 'ACTIVE'], ['eli', 'K', 70, 'OUT'],
     ['hal', 'WR', 70, 'ACTIVE'], ['jo', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['pia'], 'RB': ['ada', 'gus'], 'TE': [], 'WR': ['hal']}, 'total': 305}),
  ('partial repair probe: projection tie order',
   [[['fay', 'WR', 100, 'ACTIVE'], ['gus', 'RB', 85, 'BYE'], ['hal', 'TE', 100, 'BYE'],
     ['ivy', 'K', 150, 'OUT'], ['bo', 'WR', 40, 'ACTIVE'], ['cy', 'QB', 150, 'BYE'],
     ['kai', 'WR', 70, 'ACTIVE'], ['dee', 'RB', 40, 'BYE'], ['ned', 'WR', 150, 'ACTIVE'],
     ['max', 'WR', 150, 'ACTIVE'], ['ada', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': [], 'RB': ['ada'], 'TE': [], 'WR': ['max', 'ned']}, 'total': 550}),
  ('second regression',
   [[['gus', 'WR', 55, 'OUT'], ['lu', 'RB', 120, 'ACTIVE'], ['cy', 'WR', 85, 'ACTIVE'],
     ['jo', 'QB', 120, 'ACTIVE'], ['fay', 'WR', 55, 'Q'], ['dee', 'RB', 150, 'ACTIVE'],
     ['ned', 'QB', 40, 'ACTIVE'], ['max', 'TE', 150, 'ACTIVE'], ['eli', 'TE', 55, 'ACTIVE'],
     ['ada', 'RB', 120, 'OUT'], ['kai', 'RB', 55, 'ACTIVE'], ['bo', 'WR', 55, 'Q']]],
   {'lineup': {'FLEX': ['eli'], 'QB': ['jo'], 'RB': ['dee', 'lu'], 'TE': ['max'], 'WR': ['cy', 'bo']},
    'total': 735}),
  ('normal control 1',
   [[['ada', 'RB', 55, 'ACTIVE'], ['lu', 'QB', 40, 'ACTIVE'], ['ivy', 'RB', 120, 'BYE'],
     ['oz', 'RB', 120, 'Q'], ['bo', 'WR', 40, 'OUT'], ['dee', 'K', 150, 'ACTIVE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 55, 'OUT'], ['hal', 'RB', 70, 'ACTIVE'],
     ['kai', 'WR', 70, 'ACTIVE'], ['jo', 'QB', 55, 'OUT'], ['gus', 'WR', 55, 'Q']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['lu'], 'RB': ['oz', 'hal'], 'TE': ['eli'], 'WR': ['kai', 'gus']},
    'total': 480}),
  ('normal control 2',
   [[['dee', 'QB', 120, 'ACTIVE'], ['eli', 'K', 85, 'ACTIVE'], ['cy', 'RB', 100, 'OUT'],
     ['lu', 'TE', 150, 'ACTIVE'], ['bo', 'TE', 40, 'ACTIVE'], ['hal', 'RB', 55, 'OUT'],
     ['ivy', 'WR', 100, 'Q']]],
   {'lineup': {'FLEX': ['bo'], 'QB': ['dee'], 'RB': [], 'TE': ['lu'], 'WR': ['ivy']}, 'total': 410}),
  ('normal control 3',
   [[['gus', 'WR', 55, 'ACTIVE'], ['ada', 'WR', 85, 'Q'], ['ivy', 'WR', 120, 'BYE'],
     ['max', 'WR', 70, 'ACTIVE'], ['cy', 'TE', 100, 'ACTIVE'], ['lu', 'K', 120, 'Q'],
     ['dee', 'TE', 100, 'ACTIVE'], ['jo', 'WR', 100, 'OUT']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': [], 'TE': ['cy'], 'WR': ['ada', 'max']}, 'total': 355}),
  ('normal control 4',
   [[['ivy', 'TE', 100, 'Q'], ['jo', 'RB', 70, 'BYE'], ['lu', 'WR', 70, 'OUT'], ['fay', 'K', 55, 'BYE'],
     ['kai', 'RB', 120, 'OUT'], ['bo', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['bo'], 'TE': ['ivy'], 'WR': []}, 'total': 170})],
 [('regression: projection tie order',
   [[['gus', 'WR', 55, 'BYE'], ['eli', 'WR', 100, 'ACTIVE'], ['bo', 'WR', 40, 'OUT'],
     ['ivy', 'TE', 150, 'ACTIVE'], ['ned', 'TE', 55, 'ACTIVE'], ['max', 'RB', 120, 'Q'],
     ['oz', 'RB', 85, 'ACTIVE'], ['cy', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': ['cy', 'max'], 'TE': ['ivy'], 'WR': ['eli']}, 'total': 575}),
  ('partial repair probe: projection tie order',
   [[['max', 'WR', 70, 'BYE'], ['ada', 'K', 150, 'BYE'], ['kai', 'QB', 70, 'ACTIVE'], ['ivy', 'RB', 40, 'Q'],
     ['jo', 'QB', 70, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['eli', 'K', 85, 'Q'], ['cy', 'RB', 120, 'Q'],
     ['oz', 'RB', 70, 'OUT'], ['ned', 'WR', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['cy', 'ivy'], 'TE': [], 'WR': ['bo', 'ned']}, 'total': 370}),
  ('second regression',
   [[['hal', 'QB', 120, 'OUT'], ['bo', 'WR', 40, 'OUT'], ['ned', 'RB', 40, 'BYE'],
     ['pia', 'WR', 100, 'ACTIVE'], ['kai', 'TE', 55, 'BYE'], ['oz', 'WR', 120, 'BYE'],
     ['eli', 'WR', 100, 'ACTIVE'], ['fay', 'TE', 40, 'ACTIVE'], ['dee', 'K', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': ['fay'], 'WR': ['eli', 'pia']}, 'total': 240}),
  ('normal control 1',
   [[['ivy', 'K', 70, 'ACTIVE'], ['dee', 'WR', 85, 'ACTIVE'], ['cy', 'WR', 55, 'OUT'],
     ['bo', 'WR', 70, 'ACTIVE'], ['ned', 'TE', 85, 'BYE'], ['fay', 'WR', 150, 'Q'],
     ['lu', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': ['bo'], 'QB': [], 'RB': [], 'TE': [], 'WR': ['fay', 'dee']}, 'total': 305}),
  ('normal control 2',
   [[['hal', 'RB', 100, 'ACTIVE'], ['jo', 'K', 85, 'OUT'], ['bo', 'RB', 85, 'ACTIVE'],
     ['max', 'WR', 85, 'BYE'], ['ivy', 'K', 120, 'Q'], ['kai', 'TE', 55, 'ACTIVE'],
     ['cy', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 150, 'ACTIVE'], ['dee', 'RB', 100, 'BYE'],
     ['pia', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['lu'], 'RB': ['hal', 'bo'], 'TE': ['kai'], 'WR': ['pia', 'cy']},
    'total': 610}),
  ('normal control 3',
   [[['jo', 'QB', 100, 'Q'], ['dee', 'TE', 120, 'ACTIVE'], ['max', 'RB', 70, 'BYE'], ['hal', 'TE', 100, 'Q'],
     ['fay', 'WR', 55, 'Q'], ['cy', 'WR', 120, 'Q'], ['bo', 'K', 70, 'BYE'], ['oz', 'TE', 85, 'ACTIVE'],
     ['ivy', 'RB', 40, 'BYE'], ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['jo'], 'RB': ['pia', 'kai'], 'TE': ['dee'], 'WR': ['cy', 'fay']},
    'total': 605}),
  ('normal control 4',
   [[['ned', 'TE', 120, 'BYE'], ['bo', 'WR', 55, 'ACTIVE'], ['cy', 'WR', 70, 'BYE'],
     ['ivy', 'QB', 55, 'ACTIVE'], ['fay', 'K', 40, 'ACTIVE'], ['dee', 'WR', 55, 'BYE'],
     ['gus', 'K', 70, 'ACTIVE'], ['eli', 'QB', 40, 'Q'], ['jo', 'QB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': [], 'TE': [], 'WR': ['bo']}, 'total': 175})],
 [('regression: projection tie order',
   [[['oz', 'TE', 85, 'ACTIVE'], ['ned', 'WR', 55, 'ACTIVE'], ['gus', 'RB', 70, 'BYE'],
     ['eli', 'RB', 40, 'ACTIVE'], ['pia', 'QB', 70, 'ACTIVE'], ['jo', 'QB', 55, 'ACTIVE'],
     ['ivy', 'WR', 55, 'ACTIVE'], ['lu', 'WR', 70, 'BYE'], ['ada', 'TE', 100, 'OUT'],
     ['fay', 'RB', 150, 'ACTIVE'], ['bo', 'QB', 70, 'Q'], ['max', 'RB', 85, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['bo'], 'RB': ['fay', 'eli'], 'TE': ['oz'], 'WR': ['ivy', 'ned']},
    'total': 455}),
  ('partial repair probe: projection tie order',
   [[['hal', 'RB', 70, 'ACTIVE'], ['ned', 'TE', 85, 'Q'], ['oz', 'QB', 40, 'ACTIVE'],
     ['fay', 'RB', 100, 'BYE'], ['jo', 'TE', 85, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'],
     ['cy', 'RB', 100, 'ACTIVE'], ['eli', 'K', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': ['ada'], 'RB': ['cy', 'hal'], 'TE': ['jo'], 'WR': []}, 'total': 410}),
  ('second regression',
   [[['max', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 120, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['gus', 'RB', 100, 'BYE'], ['jo', 'RB', 40, 'BYE'], ['ivy', 'TE', 85, 'Q'], ['ada', 'WR', 70, 'ACTIVE'],
     ['fay', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['fay'], 'TE': ['ivy'], 'WR': ['ada', 'dee']}, 'total': 445}),
  ('normal control 1',
   [[['lu', 'WR', 55, 'ACTIVE'], ['oz', 'WR', 120, 'ACTIVE'], ['dee', 'RB', 120, 'BYE'],
     ['ivy', 'K', 70, 'BYE'], ['kai', 'TE', 55, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'],
     ['ned', 'TE', 120, 'ACTIVE'], ['cy', 'QB', 150, 'Q'], ['pia', 'WR', 150, 'Q'],
     ['max', 'QB', 120, 'ACTIVE'], ['hal', 'WR', 85, 'Q']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['cy'], 'RB': ['fay'], 'TE': ['ned'], 'WR': ['pia', 'oz']},
    'total': 665}),
  ('normal control 2',
   [[['ada', 'K', 150, 'ACTIVE'], ['jo', 'K', 70, 'Q'], ['fay', 'RB', 40, 'BYE'],
     ['eli', 'WR', 120, 'ACTIVE'], ['hal', 'K', 100, 'ACTIVE'], ['cy', 'RB', 85, 'Q'],
     ['ivy', 'WR', 85, 'ACTIVE'], ['gus', 'RB', 55, 'BYE'], ['oz', 'RB', 150, 'ACTIVE'],
     ['pia', 'RB', 150, 'ACTIVE'], ['lu', 'RB', 150, 'BYE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': [], 'RB': ['oz', 'pia'], 'TE': [], 'WR': ['eli', 'ivy']}, 'total': 590}),
  ('normal control 3',
   [[['dee', 'WR', 70, 'ACTIVE'], ['cy', 'RB', 85, 'Q'], ['kai', 'WR', 85, 'ACTIVE'], ['lu', 'K', 55, 'BYE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['ada', 'WR', 120, 'OUT'], ['gus', 'TE', 55, 'ACTIVE'],
     ['pia', 'K', 55, 'Q'], ['jo', 'RB', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['gus'], 'QB': [], 'RB': ['jo', 'cy'], 'TE': ['eli'], 'WR': ['kai', 'dee']},
    'total': 465}),
  ('normal control 4',
   [[['pia', 'K', 40, 'OUT'], ['cy', 'K', 100, 'OUT'], ['eli', 'WR', 70, 'ACTIVE'], ['kai', 'WR', 120, 'Q'],
     ['ivy', 'RB', 70, 'ACTIVE'], ['gus', 'WR', 55, 'ACTIVE'], ['max', 'RB', 85, 'BYE']]],
   {'lineup': {'FLEX': ['gus'], 'QB': [], 'RB': ['ivy'], 'TE': [], 'WR': ['kai', 'eli']}, 'total': 315})],
 [('regression: projection tie order',
   [[['ivy', 'WR', 85, 'OUT'], ['jo', 'K', 55, 'Q'], ['max', 'WR', 70, 'ACTIVE'], ['cy', 'TE', 70, 'OUT'],
     ['pia', 'QB', 85, 'ACTIVE'], ['gus', 'WR', 70, 'Q'], ['ned', 'K', 70, 'ACTIVE'],
     ['oz', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['oz'], 'TE': [], 'WR': ['gus', 'max']}, 'total': 295}),
  ('partial repair probe: projection tie order',
   [[['kai', 'WR', 150, 'BYE'], ['jo', 'WR', 40, 'ACTIVE'], ['ada', 'RB', 40, 'Q'], ['bo', 'TE', 85, 'Q'],
     ['max', 'RB', 40, 'Q'], ['cy', 'WR', 70, 'Q'], ['oz', 'WR', 100, 'OUT'], ['fay', 'QB', 70, 'ACTIVE'],
     ['lu', 'TE', 55, 'ACTIVE'], ['ivy', 'TE', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['fay'], 'RB': ['ada', 'max'], 'TE': ['bo'], 'WR': ['cy', 'jo']},
    'total': 400}),
  ('second regression',
   [[['ada', 'K', 70, 'OUT'], ['max', 'WR', 85, 'ACTIVE'], ['eli', 'TE', 150, 'BYE'],
     ['bo', 'RB', 85, 'ACTIVE'], ['cy', 'K', 120, 'ACTIVE'], ['lu', 'WR', 100, 'ACTIVE'],
     ['ned', 'WR', 70, 'ACTIVE'], ['dee', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['bo'], 'TE': [], 'WR': ['dee', 'lu']}, 'total': 370}),
  ('normal control 1',
   [[['jo', 'QB', 150, 'ACTIVE'], ['dee', 'TE', 40, 'ACTIVE'], ['hal', 'WR', 70, 'ACTIVE'],
     ['eli', 'RB', 120, 'ACTIVE'], ['cy', 'QB', 100, 'Q'], ['lu', 'K', 100, 'Q'], ['ada', 'WR', 85, 'Q'],
     ['kai', 'QB', 40, 'ACTIVE'], ['bo', 'WR', 120, 'ACTIVE'], ['ivy', 'RB', 100, 'Q'],
     ['oz', 'TE', 150, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['jo'], 'RB': ['eli', 'ivy'], 'TE': ['oz'], 'WR': ['bo', 'ada']},
    'total': 795}),
  ('normal control 2',
   [[['gus', 'RB', 70, 'ACTIVE'], ['max', 'K', 150, 'ACTIVE'], ['dee', 'K', 55, 'ACTIVE'],
     ['lu', 'RB', 40, 'ACTIVE'], ['ada', 'RB', 150, 'ACTIVE'], ['oz', 'RB', 40, 'ACTIVE'],
     ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': [], 'RB': ['ada', 'gus'], 'TE': [], 'WR': ['kai']}, 'total': 440}),
  ('normal control 3',
   [[['max', 'TE', 70, 'OUT'], ['lu', 'WR', 150, 'ACTIVE'], ['pia', 'K', 85, 'BYE'],
     ['oz', 'K', 40, 'ACTIVE'], ['kai', 'K', 55, 'BYE'], ['hal', 'WR', 55, 'ACTIVE'],
     ['cy', 'RB', 55, 'ACTIVE'], ['dee', 'QB', 70, 'ACTIVE'], ['jo', 'K', 55, 'ACTIVE'],
     ['fay', 'RB', 150, 'Q'], ['bo', 'TE', 100, 'ACTIVE'], ['ivy', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['dee'], 'RB': ['fay', 'cy'], 'TE': ['bo'], 'WR': ['lu', 'hal']},
    'total': 620}),
  ('normal control 4',
   [[['ned', 'WR', 70, 'ACTIVE'], ['eli', 'WR', 85, 'ACTIVE'], ['ada', 'K', 70, 'ACTIVE'],
     ['pia', 'K', 40, 'ACTIVE'], ['fay', 'QB', 40, 'ACTIVE'], ['max', 'K', 85, 'OUT'],
     ['cy', 'WR', 150, 'ACTIVE'], ['jo', 'RB', 70, 'BYE'], ['oz', 'RB', 100, 'ACTIVE'],
     ['hal', 'TE', 100, 'Q'], ['gus', 'WR', 150, 'ACTIVE'], ['bo', 'RB', 85, 'OUT']]],
   {'lineup': {'FLEX': ['eli'], 'QB': ['fay'], 'RB': ['oz'], 'TE': ['hal'], 'WR': ['cy', 'gus']},
    'total': 625})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

meaning: Fixture-count band, not measured model difficulty

deps: stdlib

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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] not in ('OUT', 'BYE')]
    eligible.sort(key=lambda p: (-p[2], p[1]))
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] in ('RB', 'WR', 'TE'):
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: projection tie order',
   [[['fay', 'QB', 70, 'OUT'], ['ivy', 'K', 70, 'ACTIVE'], ['ned', 'WR', 70, 'ACTIVE'],
     ['hal', 'TE', 70, 'ACTIVE'], ['oz', 'K', 55, 'Q'], ['jo', 'RB', 70, 'ACTIVE'],
     ['max', 'WR', 70, 'ACTIVE'], ['eli', 'WR', 70, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['jo'], 'TE': ['hal'], 'WR': ['max', 'ned']}, 'total': 280}),
  ('partial repair probe: projection tie order',
   [[['fay', 'TE', 85, 'ACTIVE'], ['hal', 'QB', 120, 'OUT'], ['eli', 'K', 150, 'ACTIVE'],
     ['dee', 'RB', 85, 'ACTIVE'], ['cy', 'K', 85, 'ACTIVE'], ['pia', 'RB', 100, 'ACTIVE'],
     ['gus', 'RB', 40, 'ACTIVE'], ['ada', 'QB', 40, 'ACTIVE'], ['jo', 'RB', 70, 'ACTIVE'],
     ['ned', 'RB', 100, 'Q'], ['lu', 'WR', 70, 'Q'], ['kai', 'WR', 120, 'BYE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': ['ada'], 'RB': ['ned', 'pia'], 'TE': ['fay'], 'WR': ['lu']},
    'total': 480}),
  ('second regression',
   [[['cy', 'QB', 55, 'OUT'], ['max', 'QB', 70, 'ACTIVE'], ['hal', 'QB', 70, 'Q'], ['jo', 'WR', 100, 'Q'],
     ['bo', 'RB', 100, 'ACTIVE'], ['pia', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['hal'], 'RB': ['pia', 'bo'], 'TE': [], 'WR': ['jo']}, 'total': 390}),
  ('normal control 1',
   [[['ned', 'QB', 70, 'OUT'], ['max', 'QB', 70, 'ACTIVE'], ['bo', 'TE', 40, 'ACTIVE'],
     ['gus', 'WR', 100, 'BYE'], ['eli', 'RB', 40, 'ACTIVE'], ['dee', 'RB', 150, 'OUT'],
     ['fay', 'WR', 55, 'ACTIVE'], ['jo', 'RB', 40, 'OUT'], ['ivy', 'TE', 120, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': ['eli'], 'TE': ['bo'], 'WR': ['fay']}, 'total': 205}),
  ('normal control 2',
   [[['kai', 'WR', 70, 'ACTIVE'], ['ivy', 'QB', 55, 'ACTIVE'], ['gus', 'K', 120, 'BYE'],
     ['eli', 'RB', 120, 'OUT'], ['ned', 'WR', 40, 'ACTIVE'], ['hal', 'TE', 40, 'ACTIVE'],
     ['dee', 'K', 150, 'BYE'], ['max', 'K', 85, 'ACTIVE'], ['pia', 'QB', 70, 'Q'], ['fay', 'QB', 55, 'BYE'],
     ['oz', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': ['pia'], 'RB': [], 'TE': ['hal'], 'WR': ['kai', 'ned']}, 'total': 260}),
  ('normal control 3',
   [[['ned', 'K', 120, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'], ['oz', 'WR', 70, 'ACTIVE'],
     ['ada', 'RB', 70, 'ACTIVE'], ['cy', 'TE', 85, 'ACTIVE'], ['bo', 'QB', 85, 'ACTIVE'],
     ['jo', 'TE', 70, 'ACTIVE'], ['eli', 'RB', 100, 'BYE'], ['max', 'QB', 55, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['bo'], 'RB': ['ada'], 'TE': ['cy'], 'WR': ['dee', 'oz']},
    'total': 450}),
  ('normal control 4',
   [[['dee', 'K', 70, 'ACTIVE'], ['gus', 'WR', 85, 'ACTIVE'], ['lu', 'QB', 40, 'ACTIVE'],
     ['oz', 'RB', 150, 'BYE'], ['eli', 'RB', 85, 'Q'], ['ned', 'RB', 40, 'OUT'],
     ['bo', 'RB', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['lu'], 'RB': ['eli', 'bo'], 'TE': [], 'WR': ['gus']}, 'total': 265})],
 [('regression: projection tie order',
   [[['cy', 'QB', 70, 'ACTIVE'], ['gus', 'RB', 55, 'ACTIVE'], ['oz', 'K', 100, 'Q'],
     ['dee', 'K', 150, 'ACTIVE'], ['max', 'K', 70, 'ACTIVE'], ['fay', 'QB', 55, 'BYE'],
     ['ada', 'RB', 55, 'ACTIVE'], ['pia', 'QB', 85, 'ACTIVE'], ['eli', 'K', 70, 'OUT'],
     ['hal', 'WR', 70, 'ACTIVE'], ['jo', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['pia'], 'RB': ['ada', 'gus'], 'TE': [], 'WR': ['hal']}, 'total': 305}),
  ('partial repair probe: projection tie order',
   [[['fay', 'WR', 100, 'ACTIVE'], ['gus', 'RB', 85, 'BYE'], ['hal', 'TE', 100, 'BYE'],
     ['ivy', 'K', 150, 'OUT'], ['bo', 'WR', 40, 'ACTIVE'], ['cy', 'QB', 150, 'BYE'],
     ['kai', 'WR', 70, 'ACTIVE'], ['dee', 'RB', 40, 'BYE'], ['ned', 'WR', 150, 'ACTIVE'],
     ['max', 'WR', 150, 'ACTIVE'], ['ada', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': [], 'RB': ['ada'], 'TE': [], 'WR': ['max', 'ned']}, 'total': 550}),
  ('second regression',
   [[['gus', 'WR', 55, 'OUT'], ['lu', 'RB', 120, 'ACTIVE'], ['cy', 'WR', 85, 'ACTIVE'],
     ['jo', 'QB', 120, 'ACTIVE'], ['fay', 'WR', 55, 'Q'], ['dee', 'RB', 150, 'ACTIVE'],
     ['ned', 'QB', 40, 'ACTIVE'], ['max', 'TE', 150, 'ACTIVE'], ['eli', 'TE', 55, 'ACTIVE'],
     ['ada', 'RB', 120, 'OUT'], ['kai', 'RB', 55, 'ACTIVE'], ['bo', 'WR', 55, 'Q']]],
   {'lineup': {'FLEX': ['eli'], 'QB': ['jo'], 'RB': ['dee', 'lu'], 'TE': ['max'], 'WR': ['cy', 'bo']},
    'total': 735}),
  ('normal control 1',
   [[['ada', 'RB', 55, 'ACTIVE'], ['lu', 'QB', 40, 'ACTIVE'], ['ivy', 'RB', 120, 'BYE'],
     ['oz', 'RB', 120, 'Q'], ['bo', 'WR', 40, 'OUT'], ['dee', 'K', 150, 'ACTIVE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 55, 'OUT'], ['hal', 'RB', 70, 'ACTIVE'],
     ['kai', 'WR', 70, 'ACTIVE'], ['jo', 'QB', 55, 'OUT'], ['gus', 'WR', 55, 'Q']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['lu'], 'RB': ['oz', 'hal'], 'TE': ['eli'], 'WR': ['kai', 'gus']},
    'total': 480}),
  ('normal control 2',
   [[['dee', 'QB', 120, 'ACTIVE'], ['eli', 'K', 85, 'ACTIVE'], ['cy', 'RB', 100, 'OUT'],
     ['lu', 'TE', 150, 'ACTIVE'], ['bo', 'TE', 40, 'ACTIVE'], ['hal', 'RB', 55, 'OUT'],
     ['ivy', 'WR', 100, 'Q']]],
   {'lineup': {'FLEX': ['bo'], 'QB': ['dee'], 'RB': [], 'TE': ['lu'], 'WR': ['ivy']}, 'total': 410}),
  ('normal control 3',
   [[['gus', 'WR', 55, 'ACTIVE'], ['ada', 'WR', 85, 'Q'], ['ivy', 'WR', 120, 'BYE'],
     ['max', 'WR', 70, 'ACTIVE'], ['cy', 'TE', 100, 'ACTIVE'], ['lu', 'K', 120, 'Q'],
     ['dee', 'TE', 100, 'ACTIVE'], ['jo', 'WR', 100, 'OUT']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': [], 'TE': ['cy'], 'WR': ['ada', 'max']}, 'total': 355}),
  ('normal control 4',
   [[['ivy', 'TE', 100, 'Q'], ['jo', 'RB', 70, 'BYE'], ['lu', 'WR', 70, 'OUT'], ['fay', 'K', 55, 'BYE'],
     ['kai', 'RB', 120, 'OUT'], ['bo', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['bo'], 'TE': ['ivy'], 'WR': []}, 'total': 170})],
 [('regression: projection tie order',
   [[['gus', 'WR', 55, 'BYE'], ['eli', 'WR', 100, 'ACTIVE'], ['bo', 'WR', 40, 'OUT'],
     ['ivy', 'TE', 150, 'ACTIVE'], ['ned', 'TE', 55, 'ACTIVE'], ['max', 'RB', 120, 'Q'],
     ['oz', 'RB', 85, 'ACTIVE'], ['cy', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['oz'], 'QB': [], 'RB': ['cy', 'max'], 'TE': ['ivy'], 'WR': ['eli']}, 'total': 575}),
  ('partial repair probe: projection tie order',
   [[['max', 'WR', 70, 'BYE'], ['ada', 'K', 150, 'BYE'], ['kai', 'QB', 70, 'ACTIVE'], ['ivy', 'RB', 40, 'Q'],
     ['jo', 'QB', 70, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['eli', 'K', 85, 'Q'], ['cy', 'RB', 120, 'Q'],
     ['oz', 'RB', 70, 'OUT'], ['ned', 'WR', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['cy', 'ivy'], 'TE': [], 'WR': ['bo', 'ned']}, 'total': 370}),
  ('second regression',
   [[['hal', 'QB', 120, 'OUT'], ['bo', 'WR', 40, 'OUT'], ['ned', 'RB', 40, 'BYE'],
     ['pia', 'WR', 100, 'ACTIVE'], ['kai', 'TE', 55, 'BYE'], ['oz', 'WR', 120, 'BYE'],
     ['eli', 'WR', 100, 'ACTIVE'], ['fay', 'TE', 40, 'ACTIVE'], ['dee', 'K', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': ['fay'], 'WR': ['eli', 'pia']}, 'total': 240}),
  ('normal control 1',
   [[['ivy', 'K', 70, 'ACTIVE'], ['dee', 'WR', 85, 'ACTIVE'], ['cy', 'WR', 55, 'OUT'],
     ['bo', 'WR', 70, 'ACTIVE'], ['ned', 'TE', 85, 'BYE'], ['fay', 'WR', 150, 'Q'],
     ['lu', 'WR', 70, 'OUT']]],
   {'lineup': {'FLEX': ['bo'], 'QB': [], 'RB': [], 'TE': [], 'WR': ['fay', 'dee']}, 'total': 305}),
  ('normal control 2',
   [[['hal', 'RB', 100, 'ACTIVE'], ['jo', 'K', 85, 'OUT'], ['bo', 'RB', 85, 'ACTIVE'],
     ['max', 'WR', 85, 'BYE'], ['ivy', 'K', 120, 'Q'], ['kai', 'TE', 55, 'ACTIVE'],
     ['cy', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 150, 'ACTIVE'], ['dee', 'RB', 100, 'BYE'],
     ['pia', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['lu'], 'RB': ['hal', 'bo'], 'TE': ['kai'], 'WR': ['pia', 'cy']},
    'total': 610}),
  ('normal control 3',
   [[['jo', 'QB', 100, 'Q'], ['dee', 'TE', 120, 'ACTIVE'], ['max', 'RB', 70, 'BYE'], ['hal', 'TE', 100, 'Q'],
     ['fay', 'WR', 55, 'Q'], ['cy', 'WR', 120, 'Q'], ['bo', 'K', 70, 'BYE'], ['oz', 'TE', 85, 'ACTIVE'],
     ['ivy', 'RB', 40, 'BYE'], ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['jo'], 'RB': ['pia', 'kai'], 'TE': ['dee'], 'WR': ['cy', 'fay']},
    'total': 605}),
  ('normal control 4',
   [[['ned', 'TE', 120, 'BYE'], ['bo', 'WR', 55, 'ACTIVE'], ['cy', 'WR', 70, 'BYE'],
     ['ivy', 'QB', 55, 'ACTIVE'], ['fay', 'K', 40, 'ACTIVE'], ['dee', 'WR', 55, 'BYE'],
     ['gus', 'K', 70, 'ACTIVE'], ['eli', 'QB', 40, 'Q'], ['jo', 'QB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': [], 'TE': [], 'WR': ['bo']}, 'total': 175})],
 [('regression: projection tie order',
   [[['oz', 'TE', 85, 'ACTIVE'], ['ned', 'WR', 55, 'ACTIVE'], ['gus', 'RB', 70, 'BYE'],
     ['eli', 'RB', 40, 'ACTIVE'], ['pia', 'QB', 70, 'ACTIVE'], ['jo', 'QB', 55, 'ACTIVE'],
     ['ivy', 'WR', 55, 'ACTIVE'], ['lu', 'WR', 70, 'BYE'], ['ada', 'TE', 100, 'OUT'],
     ['fay', 'RB', 150, 'ACTIVE'], ['bo', 'QB', 70, 'Q'], ['max', 'RB', 85, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['bo'], 'RB': ['fay', 'eli'], 'TE': ['oz'], 'WR': ['ivy', 'ned']},
    'total': 455}),
  ('partial repair probe: projection tie order',
   [[['hal', 'RB', 70, 'ACTIVE'], ['ned', 'TE', 85, 'Q'], ['oz', 'QB', 40, 'ACTIVE'],
     ['fay', 'RB', 100, 'BYE'], ['jo', 'TE', 85, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'],
     ['cy', 'RB', 100, 'ACTIVE'], ['eli', 'K', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': ['ada'], 'RB': ['cy', 'hal'], 'TE': ['jo'], 'WR': []}, 'total': 410}),
  ('second regression',
   [[['max', 'WR', 70, 'ACTIVE'], ['lu', 'QB', 120, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['gus', 'RB', 100, 'BYE'], ['jo', 'RB', 40, 'BYE'], ['ivy', 'TE', 85, 'Q'], ['ada', 'WR', 70, 'ACTIVE'],
     ['fay', 'RB', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['fay'], 'TE': ['ivy'], 'WR': ['ada', 'dee']}, 'total': 445}),
  ('normal control 1',
   [[['lu', 'WR', 55, 'ACTIVE'], ['oz', 'WR', 120, 'ACTIVE'], ['dee', 'RB', 120, 'BYE'],
     ['ivy', 'K', 70, 'BYE'], ['kai', 'TE', 55, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'],
     ['ned', 'TE', 120, 'ACTIVE'], ['cy', 'QB', 150, 'Q'], ['pia', 'WR', 150, 'Q'],
     ['max', 'QB', 120, 'ACTIVE'], ['hal', 'WR', 85, 'Q']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['cy'], 'RB': ['fay'], 'TE': ['ned'], 'WR': ['pia', 'oz']},
    'total': 665}),
  ('normal control 2',
   [[['ada', 'K', 150, 'ACTIVE'], ['jo', 'K', 70, 'Q'], ['fay', 'RB', 40, 'BYE'],
     ['eli', 'WR', 120, 'ACTIVE'], ['hal', 'K', 100, 'ACTIVE'], ['cy', 'RB', 85, 'Q'],
     ['ivy', 'WR', 85, 'ACTIVE'], ['gus', 'RB', 55, 'BYE'], ['oz', 'RB', 150, 'ACTIVE'],
     ['pia', 'RB', 150, 'ACTIVE'], ['lu', 'RB', 150, 'BYE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': [], 'RB': ['oz', 'pia'], 'TE': [], 'WR': ['eli', 'ivy']}, 'total': 590}),
  ('normal control 3',
   [[['dee', 'WR', 70, 'ACTIVE'], ['cy', 'RB', 85, 'Q'], ['kai', 'WR', 85, 'ACTIVE'], ['lu', 'K', 55, 'BYE'],
     ['eli', 'TE', 70, 'ACTIVE'], ['ada', 'WR', 120, 'OUT'], ['gus', 'TE', 55, 'ACTIVE'],
     ['pia', 'K', 55, 'Q'], ['jo', 'RB', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['gus'], 'QB': [], 'RB': ['jo', 'cy'], 'TE': ['eli'], 'WR': ['kai', 'dee']},
    'total': 465}),
  ('normal control 4',
   [[['pia', 'K', 40, 'OUT'], ['cy', 'K', 100, 'OUT'], ['eli', 'WR', 70, 'ACTIVE'], ['kai', 'WR', 120, 'Q'],
     ['ivy', 'RB', 70, 'ACTIVE'], ['gus', 'WR', 55, 'ACTIVE'], ['max', 'RB', 85, 'BYE']]],
   {'lineup': {'FLEX': ['gus'], 'QB': [], 'RB': ['ivy'], 'TE': [], 'WR': ['kai', 'eli']}, 'total': 315})],
 [('regression: projection tie order',
   [[['ivy', 'WR', 85, 'OUT'], ['jo', 'K', 55, 'Q'], ['max', 'WR', 70, 'ACTIVE'], ['cy', 'TE', 70, 'OUT'],
     ['pia', 'QB', 85, 'ACTIVE'], ['gus', 'WR', 70, 'Q'], ['ned', 'K', 70, 'ACTIVE'],
     ['oz', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['oz'], 'TE': [], 'WR': ['gus', 'max']}, 'total': 295}),
  ('partial repair probe: projection tie order',
   [[['kai', 'WR', 150, 'BYE'], ['jo', 'WR', 40, 'ACTIVE'], ['ada', 'RB', 40, 'Q'], ['bo', 'TE', 85, 'Q'],
     ['max', 'RB', 40, 'Q'], ['cy', 'WR', 70, 'Q'], ['oz', 'WR', 100, 'OUT'], ['fay', 'QB', 70, 'ACTIVE'],
     ['lu', 'TE', 55, 'ACTIVE'], ['ivy', 'TE', 55, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['fay'], 'RB': ['ada', 'max'], 'TE': ['bo'], 'WR': ['cy', 'jo']},
    'total': 400}),
  ('second regression',
   [[['ada', 'K', 70, 'OUT'], ['max', 'WR', 85, 'ACTIVE'], ['eli', 'TE', 150, 'BYE'],
     ['bo', 'RB', 85, 'ACTIVE'], ['cy', 'K', 120, 'ACTIVE'], ['lu', 'WR', 100, 'ACTIVE'],
     ['ned', 'WR', 70, 'ACTIVE'], ['dee', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['bo'], 'TE': [], 'WR': ['dee', 'lu']}, 'total': 370}),
  ('normal control 1',
   [[['jo', 'QB', 150, 'ACTIVE'], ['dee', 'TE', 40, 'ACTIVE'], ['hal', 'WR', 70, 'ACTIVE'],
     ['eli', 'RB', 120, 'ACTIVE'], ['cy', 'QB', 100, 'Q'], ['lu', 'K', 100, 'Q'], ['ada', 'WR', 85, 'Q'],
     ['kai', 'QB', 40, 'ACTIVE'], ['bo', 'WR', 120, 'ACTIVE'], ['ivy', 'RB', 100, 'Q'],
     ['oz', 'TE', 150, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': ['jo'], 'RB': ['eli', 'ivy'], 'TE': ['oz'], 'WR': ['bo', 'ada']},
    'total': 795}),
  ('normal control 2',
   [[['gus', 'RB', 70, 'ACTIVE'], ['max', 'K', 150, 'ACTIVE'], ['dee', 'K', 55, 'ACTIVE'],
     ['lu', 'RB', 40, 'ACTIVE'], ['ada', 'RB', 150, 'ACTIVE'], ['oz', 'RB', 40, 'ACTIVE'],
     ['pia', 'RB', 70, 'ACTIVE'], ['kai', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['pia'], 'QB': [], 'RB': ['ada', 'gus'], 'TE': [], 'WR': ['kai']}, 'total': 440}),
  ('normal control 3',
   [[['max', 'TE', 70, 'OUT'], ['lu', 'WR', 150, 'ACTIVE'], ['pia', 'K', 85, 'BYE'],
     ['oz', 'K', 40, 'ACTIVE'], ['kai', 'K', 55, 'BYE'], ['hal', 'WR', 55, 'ACTIVE'],
     ['cy', 'RB', 55, 'ACTIVE'], ['dee', 'QB', 70, 'ACTIVE'], ['jo', 'K', 55, 'ACTIVE'],
     ['fay', 'RB', 150, 'Q'], ['bo', 'TE', 100, 'ACTIVE'], ['ivy', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['dee'], 'RB': ['fay', 'cy'], 'TE': ['bo'], 'WR': ['lu', 'hal']},
    'total': 620}),
  ('normal control 4',
   [[['ned', 'WR', 70, 'ACTIVE'], ['eli', 'WR', 85, 'ACTIVE'], ['ada', 'K', 70, 'ACTIVE'],
     ['pia', 'K', 40, 'ACTIVE'], ['fay', 'QB', 40, 'ACTIVE'], ['max', 'K', 85, 'OUT'],
     ['cy', 'WR', 150, 'ACTIVE'], ['jo', 'RB', 70, 'BYE'], ['oz', 'RB', 100, 'ACTIVE'],
     ['hal', 'TE', 100, 'Q'], ['gus', 'WR', 150, 'ACTIVE'], ['bo', 'RB', 85, 'OUT']]],
   {'lineup': {'FLEX': ['eli'], 'QB': ['fay'], 'RB': ['oz'], 'TE': ['hal'], 'WR': ['cy', 'gus']},
    'total': 625})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
Two WRs projected equally swap between starter and bench depending on roster order.

Players are [name, position, projection tenths, status]. OUT and BYE players are ineligible; Q (questionable) players are eligible. Rank by projection descending, name ascending on ties. Fill QB x1, RB x2, WR x2, TE x1, then one FLEX from the best remaining RB/WR/TE (kickers and QBs never flex). Return the slot lists and the total projection.

split: open-access


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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] not in ('OUT', 'BYE')]
    eligible.sort(key=lambda p: (-p[2], p[0]))
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] in ('QB', 'RB', 'WR', 'TE'):
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flex position eligibility',
   [[['dee', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 120, 'ACTIVE'], ['kai', 'WR', 70, 'ACTIVE'],
     ['pia', 'QB', 150, 'Q'], ['jo', 'WR', 120, 'OUT'], ['bo', 'RB', 40, 'ACTIVE'],
     ['oz', 'TE', 40, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['bo'], 'TE': [], 'WR': ['dee', 'kai']}, 'total': 360}),
  ('partial repair probe: flex position eligibility',
   [[['hal', 'TE', 55, 'Q'], ['ivy', 'QB', 55, 'Q'], ['eli', 'K', 150, 'ACTIVE'], ['fay', 'WR', 40, 'ACTIVE'],
     ['ned', 'RB', 70, 'Q'], ['lu', 'K', 150, 'ACTIVE'], ['pia', 'K', 55, 'BYE'], ['ada', 'RB', 70, 'OUT'],
     ['bo', 'WR', 150, 'ACTIVE'], ['max', 'WR', 100, 'ACTIVE'], ['dee', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['ivy'], 'RB': ['dee', 'ned'], 'TE': ['hal'], 'WR': ['bo', 'max']},
    'total': 540}),
  ('second regression',
   [[['fay', 'K', 70, 'ACTIVE'], ['cy', 'QB', 70, 'ACTIVE'], ['lu', 'RB', 70, 'OUT'],
     ['dee', 'WR', 70, 'ACTIVE'], ['pia', 'RB', 55, 'ACTIVE'], ['eli', 'TE', 85, 'ACTIVE'],
     ['ned', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['cy'], 'RB': ['pia'], 'TE': ['eli'], 'WR': ['dee', 'ned']}, 'total': 320}),
  ('normal control 1',
   [[['ada', 'TE', 85, 'ACTIVE'], ['pia', 'TE', 100, 'ACTIVE'], ['max', 'TE', 100, 'ACTIVE'],
     ['cy', 'TE', 150, 'Q'], ['jo', 'WR', 150, 'Q'], ['hal', 'RB', 150, 'Q'], ['kai', 'WR', 70, 'BYE'],
     ['ivy', 'QB', 70, 'ACTIVE'], ['eli', 'TE', 40, 'Q'], ['bo', 'WR', 100, 'BYE'],
     ['dee', 'K', 85, 'BYE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['ivy'], 'RB': ['hal'], 'TE': ['cy'], 'WR': ['jo']}, 'total': 620}),
  ('normal control 2',
   [[['dee', 'TE', 150, 'ACTIVE'], ['oz', 'WR', 150, 'ACTIVE'], ['gus', 'K', 85, 'OUT'],
     ['fay', 'QB', 55, 'ACTIVE'], ['max', 'RB', 40, 'BYE'], ['ada', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': [], 'TE': ['dee'], 'WR': ['oz', 'ada']}, 'total': 455}),
  ('normal control 3',
   [[['jo', 'QB', 70, 'OUT'], ['pia', 'RB', 70, 'BYE'], ['hal', 'TE', 55, 'ACTIVE'], ['max', 'WR', 70, 'Q'],
     ['cy', 'TE', 85, 'ACTIVE'], ['ada', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': [], 'RB': [], 'TE': ['cy'], 'WR': ['ada', 'max']}, 'total': 310}),
  ('normal control 4',
   [[['cy', 'RB', 85, 'ACTIVE'], ['ivy', 'RB', 40, 'ACTIVE'], ['jo', 'RB', 120, 'OUT'],
     ['kai', 'WR', 120, 'BYE'], ['dee', 'WR', 70, 'BYE'], ['hal', 'WR', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['cy', 'ivy'], 'TE': [], 'WR': ['hal']}, 'total': 245})],
 [('regression: flex position eligibility',
   [[['ada', 'WR', 100, 'ACTIVE'], ['max', 'QB', 120, 'Q'], ['bo', 'WR', 85, 'BYE'], ['ned', 'RB', 40, 'BYE'],
     ['lu', 'RB', 150, 'OUT'], ['cy', 'WR', 55, 'OUT'], ['pia', 'WR', 150, 'Q'], ['fay', 'WR', 55, 'OUT'],
     ['ivy', 'QB', 55, 'Q'], ['dee', 'TE', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': [], 'TE': ['dee'], 'WR': ['pia', 'ada']}, 'total': 440}),
  ('partial repair probe: flex position eligibility',
   [[['lu', 'RB', 70, 'ACTIVE'], ['bo', 'TE', 120, 'BYE'], ['dee', 'TE', 70, 'Q'], ['oz', 'QB', 55, 'ACTIVE'],
     ['ivy', 'WR', 55, 'Q'], ['max', 'RB', 40, 'ACTIVE'], ['jo', 'RB', 70, 'ACTIVE'],
     ['cy', 'K', 55, 'ACTIVE'], ['kai', 'QB', 85, 'OUT'], ['pia', 'TE', 40, 'ACTIVE'],
     ['eli', 'WR', 70, 'ACTIVE'], ['hal', 'K', 100, 'BYE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['oz'], 'RB': ['jo', 'lu'], 'TE': ['dee'], 'WR': ['eli', 'ivy']},
    'total': 430}),
  ('second regression',
   [[['gus', 'WR', 40, 'BYE'], ['eli', 'RB', 70, 'ACTIVE'], ['hal', 'QB', 85, 'ACTIVE'],
     ['ada', 'RB', 150, 'Q'], ['bo', 'TE', 150, 'ACTIVE'], ['kai', 'WR', 85, 'ACTIVE'],
     ['ivy', 'TE', 40, 'ACTIVE'], ['max', 'QB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['hal'], 'RB': ['ada', 'eli'], 'TE': ['bo'], 'WR': ['kai']},
    'total': 580}),
  ('normal control 1',
   [[['jo', 'WR', 100, 'ACTIVE'], ['gus', 'RB', 85, 'ACTIVE'], ['fay', 'RB', 55, 'BYE'],
     ['cy', 'WR', 150, 'ACTIVE'], ['eli', 'WR', 150, 'ACTIVE'], ['ada', 'WR', 85, 'OUT'],
     ['max', 'RB', 55, 'BYE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': [], 'RB': ['gus'], 'TE': [], 'WR': ['cy', 'eli']}, 'total': 485}),
  ('normal control 2',
   [[['max', 'RB', 85, 'BYE'], ['hal', 'TE', 40, 'ACTIVE'], ['jo', 'RB', 70, 'Q'],
     ['gus', 'TE', 150, 'ACTIVE'], ['ada', 'RB', 100, 'Q'], ['eli', 'RB', 70, 'Q'],
     ['ivy', 'K', 55, 'ACTIVE'], ['kai', 'RB', 120, 'OUT'], ['cy', 'QB', 40, 'ACTIVE'],
     ['bo', 'RB', 85, 'BYE'], ['pia', 'RB', 120, 'OUT'], ['oz', 'WR', 85, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['cy'], 'RB': ['ada', 'eli'], 'TE': ['gus'], 'WR': []}, 'total': 430}),
  ('normal control 3',
   [[['ivy', 'WR', 85, 'ACTIVE'], ['pia', 'RB', 150, 'ACTIVE'], ['max', 'TE', 85, 'ACTIVE'],
     ['gus', 'RB', 40, 'ACTIVE'], ['kai', 'K', 40, 'OUT'], ['lu', 'TE', 100, 'ACTIVE'],
     ['hal', 'RB', 85, 'OUT'], ['fay', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['pia', 'gus'], 'TE': ['lu'], 'WR': ['fay', 'ivy']},
    'total': 560}),
  ('normal control 4',
   [[['fay', 'RB', 70, 'Q'], ['gus', 'WR', 120, 'ACTIVE'], ['oz', 'WR', 40, 'Q'],
     ['pia', 'QB', 150, 'ACTIVE'], ['ned', 'RB', 120, 'ACTIVE'], ['eli', 'K', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['ned', 'fay'], 'TE': [], 'WR': ['gus', 'oz']},
    'total': 500})],
 [('regression: flex position eligibility',
   [[['fay', 'QB', 70, 'Q'], ['cy', 'QB', 40, 'BYE'], ['ned', 'QB', 100, 'ACTIVE'],
     ['ivy', 'TE', 100, 'ACTIVE'], ['hal', 'QB', 150, 'ACTIVE'], ['dee', 'TE', 40, 'ACTIVE'],
     ['oz', 'RB', 100, 'ACTIVE'], ['ada', 'TE', 120, 'ACTIVE'], ['jo', 'WR', 85, 'OUT'],
     ['pia', 'RB', 70, 'OUT'], ['lu', 'QB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['hal'], 'RB': ['oz'], 'TE': ['ada'], 'WR': []}, 'total': 470}),
  ('partial repair probe: flex position eligibility',
   [[['oz', 'RB', 55, 'BYE'], ['ivy', 'QB', 70, 'Q'], ['ada', 'QB', 40, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['gus', 'RB', 85, 'ACTIVE'], ['max', 'K', 150, 'Q'], ['ned', 'RB', 40, 'ACTIVE'],
     ['kai', 'RB', 40, 'BYE'], ['jo', 'RB', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': ['ivy'], 'RB': ['gus', 'jo'], 'TE': [], 'WR': ['dee']}, 'total': 350}),
  ('second regression',
   [[['bo', 'WR', 40, 'ACTIVE'], ['ned', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'],
     ['oz', 'K', 85, 'Q'], ['fay', 'WR', 70, 'Q'], ['eli', 'RB', 55, 'BYE'], ['cy', 'TE', 70, 'ACTIVE'],
     ['dee', 'WR', 150, 'ACTIVE'], ['gus', 'TE', 120, 'BYE'], ['max', 'TE', 55, 'ACTIVE'],
     ['kai', 'WR', 40, 'OUT']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['ada'], 'RB': [], 'TE': ['cy'], 'WR': ['dee', 'ned']}, 'total': 460}),
  ('normal control 1',
   [[['eli', 'QB', 150, 'OUT'], ['hal', 'QB', 55, 'OUT'], ['lu', 'QB', 150, 'OUT'], ['oz', 'TE', 70, 'OUT'],
     ['max', 'TE', 70, 'BYE'], ['ned', 'TE', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': [], 'WR': []}, 'total': 0}),
  ('normal control 2',
   [[['gus', 'QB', 40, 'ACTIVE'], ['lu', 'WR', 100, 'ACTIVE'], ['cy', 'RB', 120, 'ACTIVE'],
     ['kai', 'RB', 55, 'OUT'], ['fay', 'WR', 70, 'OUT'], ['hal', 'RB', 100, 'OUT'], ['jo', 'RB', 70, 'Q'],
     ['ivy', 'WR', 85, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'], ['eli', 'TE', 55, 'ACTIVE'],
     ['bo', 'RB', 70, 'Q']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['ada'], 'RB': ['cy', 'bo'], 'TE': ['eli'], 'WR': ['lu', 'ivy']},
    'total': 570}),
  ('normal control 3',
   [[['lu', 'RB', 70, 'ACTIVE'], ['kai', 'QB', 100, 'ACTIVE'], ['max', 'WR', 70, 'ACTIVE'],
     ['gus', 'WR', 150, 'ACTIVE'], ['ned', 'RB', 55, 'OUT'], ['jo', 'TE', 120, 'ACTIVE'],
     ['eli', 'RB', 70, 'Q'], ['fay', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['kai'], 'RB': ['eli', 'lu'], 'TE': ['jo'], 'WR': ['gus', 'max']},
    'total': 620}),
  ('normal control 4',
   [[['lu', 'WR', 70, 'OUT'], ['ada', 'K', 70, 'Q'], ['max', 'RB', 55, 'ACTIVE'],
     ['gus', 'RB', 100, 'ACTIVE'], ['oz', 'WR', 70, 'ACTIVE'], ['bo', 'QB', 85, 'ACTIVE'],
     ['kai', 'WR', 85, 'ACTIVE'], ['dee', 'RB', 85, 'BYE'], ['jo', 'RB', 40, 'Q'],
     ['hal', 'WR', 100, 'ACTIVE'], ['pia', 'WR', 100, 'ACTIVE'], ['fay', 'WR', 40, 'OUT']]],
   {'lineup': {'FLEX': ['kai'], 'QB': ['bo'], 'RB': ['gus', 'max'], 'TE': [], 'WR': ['hal', 'pia']},
    'total': 525})],
 [('regression: flex position eligibility',
   [[['ada', 'WR', 40, 'BYE'], ['gus', 'K', 40, 'OUT'], ['hal', 'QB', 85, 'ACTIVE'],
     ['lu', 'QB', 100, 'ACTIVE'], ['cy', 'TE', 40, 'Q'], ['max', 'TE', 100, 'Q'], ['oz', 'K', 40, 'Q'],
     ['dee', 'RB', 85, 'OUT'], ['bo', 'QB', 40, 'ACTIVE'], ['fay', 'QB', 70, 'OUT'],
     ['jo', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['lu'], 'RB': [], 'TE': ['max'], 'WR': ['jo']}, 'total': 390}),
  ('partial repair probe: flex position eligibility',
   [[['ivy', 'TE', 55, 'ACTIVE'], ['oz', 'WR', 40, 'BYE'], ['cy', 'K', 40, 'ACTIVE'],
     ['max', 'TE', 70, 'BYE'], ['eli', 'WR', 85, 'Q'], ['hal', 'TE', 150, 'OUT'], ['ned', 'RB', 70, 'OUT'],
     ['kai', 'RB', 70, 'ACTIVE'], ['jo', 'QB', 85, 'ACTIVE'], ['gus', 'RB', 40, 'Q'], ['fay', 'K', 100, 'Q'],
     ['lu', 'WR', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['kai', 'gus'], 'TE': ['ivy'], 'WR': ['eli', 'lu']},
    'total': 405}),
  ('second regression',
   [[['ned', 'WR', 85, 'ACTIVE'], ['pia', 'K', 150, 'BYE'], ['gus', 'WR', 85, 'ACTIVE'],
     ['cy', 'WR', 55, 'BYE'], ['kai', 'K', 120, 'ACTIVE'], ['oz', 'WR', 100, 'ACTIVE'],
     ['fay', 'QB', 150, 'BYE'], ['dee', 'QB', 85, 'ACTIVE'], ['jo', 'TE', 150, 'BYE'],
     ['bo', 'WR', 150, 'ACTIVE'], ['eli', 'RB', 55, 'ACTIVE'], ['lu', 'K', 85, 'Q']]],
   {'lineup': {'FLEX': ['gus'], 'QB': ['dee'], 'RB': ['eli'], 'TE': [], 'WR': ['bo', 'oz']}, 'total': 475}),
  ('normal control 1',
   [[['oz', 'WR', 70, 'ACTIVE'], ['kai', 'TE', 70, 'ACTIVE'], ['hal', 'WR', 70, 'OUT'],
     ['ada', 'RB', 150, 'OUT'], ['max', 'WR', 70, 'ACTIVE'], ['fay', 'RB', 85, 'OUT'],
     ['pia', 'QB', 70, 'ACTIVE'], ['ned', 'WR', 150, 'OUT'], ['lu', 'K', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': [], 'TE': ['kai'], 'WR': ['max', 'oz']}, 'total': 280}),
  ('normal control 2',
   [[['ivy', 'RB', 55, 'Q'], ['jo', 'WR', 40, 'ACTIVE'], ['dee', 'TE', 70, 'ACTIVE'],
     ['ned', 'QB', 55, 'OUT'], ['ada', 'WR', 100, 'Q'], ['kai', 'TE', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': ['ivy'], 'TE': ['kai'], 'WR': ['ada', 'jo']}, 'total': 415}),
  ('normal control 3',
   [[['ada', 'RB', 120, 'ACTIVE'], ['jo', 'WR', 120, 'ACTIVE'], ['fay', 'TE', 55, 'ACTIVE'],
     ['oz', 'RB', 40, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['kai', 'RB', 40, 'ACTIVE'],
     ['max', 'WR', 100, 'Q'], ['lu', 'K', 70, 'ACTIVE'], ['dee', 'QB', 70, 'BYE'],
     ['cy', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['bo'], 'QB': [], 'RB': ['ada', 'cy'], 'TE': ['fay'], 'WR': ['jo', 'max']},
    'total': 535}),
  ('normal control 4',
   [[['kai', 'RB', 85, 'ACTIVE'], ['lu', 'K', 40, 'OUT'], ['oz', 'QB', 85, 'ACTIVE'], ['jo', 'WR', 150, 'Q'],
     ['gus', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'], ['cy', 'RB', 55, 'ACTIVE'],
     ['eli', 'WR', 100, 'ACTIVE'], ['max', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['oz'], 'RB': ['kai', 'max'], 'TE': ['gus'], 'WR': ['jo', 'eli']},
    'total': 615})],
 [('regression: flex position eligibility',
   [[['oz', 'WR', 100, 'BYE'], ['jo', 'RB', 100, 'ACTIVE'], ['fay', 'QB', 150, 'Q'], ['kai', 'QB', 70, 'BYE'],
     ['pia', 'WR', 70, 'BYE'], ['ivy', 'QB', 70, 'ACTIVE'], ['eli', 'K', 100, 'ACTIVE'],
     ['ada', 'TE', 55, 'Q'], ['max', 'WR', 120, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': ['jo'], 'TE': ['ada'], 'WR': []}, 'total': 305}),
  ('partial repair probe: flex position eligibility',
   [[['dee', 'RB', 120, 'OUT'], ['ivy', 'QB', 70, 'BYE'], ['gus', 'K', 85, 'ACTIVE'],
     ['fay', 'WR', 100, 'ACTIVE'], ['bo', 'WR', 100, 'ACTIVE'], ['kai', 'TE', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': [], 'WR': ['bo', 'fay']}, 'total': 200}),
  ('second regression',
   [[['ada', 'K', 120, 'Q'], ['max', 'TE', 120, 'ACTIVE'], ['cy', 'K', 120, 'BYE'], ['bo', 'RB', 85, 'BYE'],
     ['eli', 'TE', 85, 'OUT'], ['pia', 'RB', 100, 'ACTIVE'], ['kai', 'WR', 85, 'BYE'],
     ['ivy', 'WR', 100, 'ACTIVE'], ['ned', 'RB', 85, 'OUT'], ['dee', 'WR', 40, 'OUT'],
     ['gus', 'WR', 85, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['pia'], 'TE': ['max'], 'WR': ['ivy']}, 'total': 320}),
  ('normal control 1',
   [[['ada', 'RB', 100, 'ACTIVE'], ['kai', 'QB', 120, 'ACTIVE'], ['fay', 'RB', 100, 'ACTIVE'],
     ['lu', 'WR', 120, 'OUT'], ['pia', 'RB', 150, 'ACTIVE'], ['max', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['kai'], 'RB': ['pia', 'max'], 'TE': [], 'WR': []}, 'total': 490}),
  ('normal control 2',
   [[['max', 'TE', 55, 'ACTIVE'], ['hal', 'RB', 100, 'Q'], ['kai', 'QB', 120, 'ACTIVE'],
     ['pia', 'RB', 70, 'OUT'], ['dee', 'WR', 70, 'BYE'], ['oz', 'WR', 85, 'ACTIVE'],
     ['fay', 'RB', 40, 'ACTIVE'], ['lu', 'RB', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['kai'], 'RB': ['hal', 'lu'], 'TE': ['max'], 'WR': ['oz']},
    'total': 500}),
  ('normal control 3',
   [[['hal', 'WR', 70, 'ACTIVE'], ['jo', 'RB', 85, 'ACTIVE'], ['lu', 'K', 70, 'ACTIVE'],
     ['pia', 'K', 120, 'BYE'], ['ada', 'WR', 85, 'ACTIVE'], ['bo', 'WR', 100, 'ACTIVE'],
     ['fay', 'RB', 55, 'BYE'], ['cy', 'RB', 40, 'Q'], ['ned', 'TE', 55, 'OUT'], ['gus', 'RB', 100, 'OUT']]],
   {'lineup': {'FLEX': ['hal'], 'QB': [], 'RB': ['jo', 'cy'], 'TE': [], 'WR': ['bo', 'ada']}, 'total': 380}),
  ('normal control 4',
   [[['eli', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 120, 'OUT'], ['hal', 'TE', 85, 'Q'],
     ['gus', 'K', 150, 'BYE'], ['pia', 'RB', 150, 'OUT'], ['ivy', 'RB', 100, 'OUT'], ['jo', 'WR', 85, 'Q'],
     ['dee', 'WR', 100, 'ACTIVE'], ['max', 'QB', 85, 'Q'], ['ned', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['max'], 'RB': ['ned'], 'TE': ['hal'], 'WR': ['dee', 'eli']},
    'total': 495})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

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

N = 1
observations = []
def solve(players):
    eligible = [p for p in players if p[3] not in ('OUT', 'BYE')]
    eligible.sort(key=lambda p: (-p[2], p[0]))
    need = {'QB': 1, 'RB': 2, 'WR': 2, 'TE': 1}
    lineup = {'QB': [], 'RB': [], 'WR': [], 'TE': [], 'FLEX': []}
    bench = []
    for p in eligible:
        if p[1] in need and len(lineup[p[1]]) < need[p[1]]:
            lineup[p[1]].append(p[0])
        else:
            bench.append(p)
    for p in bench:
        if p[1] != 'QB':
            lineup['FLEX'].append(p[0])
            break
    proj = {p[0]: p[2] for p in players}
    total = sum(proj[n] for names in lineup.values() for n in names)
    return {'lineup': lineup, 'total': total}
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: flex position eligibility',
   [[['dee', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 120, 'ACTIVE'], ['kai', 'WR', 70, 'ACTIVE'],
     ['pia', 'QB', 150, 'Q'], ['jo', 'WR', 120, 'OUT'], ['bo', 'RB', 40, 'ACTIVE'],
     ['oz', 'TE', 40, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['bo'], 'TE': [], 'WR': ['dee', 'kai']}, 'total': 360}),
  ('partial repair probe: flex position eligibility',
   [[['hal', 'TE', 55, 'Q'], ['ivy', 'QB', 55, 'Q'], ['eli', 'K', 150, 'ACTIVE'], ['fay', 'WR', 40, 'ACTIVE'],
     ['ned', 'RB', 70, 'Q'], ['lu', 'K', 150, 'ACTIVE'], ['pia', 'K', 55, 'BYE'], ['ada', 'RB', 70, 'OUT'],
     ['bo', 'WR', 150, 'ACTIVE'], ['max', 'WR', 100, 'ACTIVE'], ['dee', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['ivy'], 'RB': ['dee', 'ned'], 'TE': ['hal'], 'WR': ['bo', 'max']},
    'total': 540}),
  ('second regression',
   [[['fay', 'K', 70, 'ACTIVE'], ['cy', 'QB', 70, 'ACTIVE'], ['lu', 'RB', 70, 'OUT'],
     ['dee', 'WR', 70, 'ACTIVE'], ['pia', 'RB', 55, 'ACTIVE'], ['eli', 'TE', 85, 'ACTIVE'],
     ['ned', 'WR', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['cy'], 'RB': ['pia'], 'TE': ['eli'], 'WR': ['dee', 'ned']}, 'total': 320}),
  ('normal control 1',
   [[['ada', 'TE', 85, 'ACTIVE'], ['pia', 'TE', 100, 'ACTIVE'], ['max', 'TE', 100, 'ACTIVE'],
     ['cy', 'TE', 150, 'Q'], ['jo', 'WR', 150, 'Q'], ['hal', 'RB', 150, 'Q'], ['kai', 'WR', 70, 'BYE'],
     ['ivy', 'QB', 70, 'ACTIVE'], ['eli', 'TE', 40, 'Q'], ['bo', 'WR', 100, 'BYE'],
     ['dee', 'K', 85, 'BYE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['ivy'], 'RB': ['hal'], 'TE': ['cy'], 'WR': ['jo']}, 'total': 620}),
  ('normal control 2',
   [[['dee', 'TE', 150, 'ACTIVE'], ['oz', 'WR', 150, 'ACTIVE'], ['gus', 'K', 85, 'OUT'],
     ['fay', 'QB', 55, 'ACTIVE'], ['max', 'RB', 40, 'BYE'], ['ada', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': [], 'TE': ['dee'], 'WR': ['oz', 'ada']}, 'total': 455}),
  ('normal control 3',
   [[['jo', 'QB', 70, 'OUT'], ['pia', 'RB', 70, 'BYE'], ['hal', 'TE', 55, 'ACTIVE'], ['max', 'WR', 70, 'Q'],
     ['cy', 'TE', 85, 'ACTIVE'], ['ada', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['hal'], 'QB': [], 'RB': [], 'TE': ['cy'], 'WR': ['ada', 'max']}, 'total': 310}),
  ('normal control 4',
   [[['cy', 'RB', 85, 'ACTIVE'], ['ivy', 'RB', 40, 'ACTIVE'], ['jo', 'RB', 120, 'OUT'],
     ['kai', 'WR', 120, 'BYE'], ['dee', 'WR', 70, 'BYE'], ['hal', 'WR', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['cy', 'ivy'], 'TE': [], 'WR': ['hal']}, 'total': 245})],
 [('regression: flex position eligibility',
   [[['ada', 'WR', 100, 'ACTIVE'], ['max', 'QB', 120, 'Q'], ['bo', 'WR', 85, 'BYE'], ['ned', 'RB', 40, 'BYE'],
     ['lu', 'RB', 150, 'OUT'], ['cy', 'WR', 55, 'OUT'], ['pia', 'WR', 150, 'Q'], ['fay', 'WR', 55, 'OUT'],
     ['ivy', 'QB', 55, 'Q'], ['dee', 'TE', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['max'], 'RB': [], 'TE': ['dee'], 'WR': ['pia', 'ada']}, 'total': 440}),
  ('partial repair probe: flex position eligibility',
   [[['lu', 'RB', 70, 'ACTIVE'], ['bo', 'TE', 120, 'BYE'], ['dee', 'TE', 70, 'Q'], ['oz', 'QB', 55, 'ACTIVE'],
     ['ivy', 'WR', 55, 'Q'], ['max', 'RB', 40, 'ACTIVE'], ['jo', 'RB', 70, 'ACTIVE'],
     ['cy', 'K', 55, 'ACTIVE'], ['kai', 'QB', 85, 'OUT'], ['pia', 'TE', 40, 'ACTIVE'],
     ['eli', 'WR', 70, 'ACTIVE'], ['hal', 'K', 100, 'BYE']]],
   {'lineup': {'FLEX': ['max'], 'QB': ['oz'], 'RB': ['jo', 'lu'], 'TE': ['dee'], 'WR': ['eli', 'ivy']},
    'total': 430}),
  ('second regression',
   [[['gus', 'WR', 40, 'BYE'], ['eli', 'RB', 70, 'ACTIVE'], ['hal', 'QB', 85, 'ACTIVE'],
     ['ada', 'RB', 150, 'Q'], ['bo', 'TE', 150, 'ACTIVE'], ['kai', 'WR', 85, 'ACTIVE'],
     ['ivy', 'TE', 40, 'ACTIVE'], ['max', 'QB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['hal'], 'RB': ['ada', 'eli'], 'TE': ['bo'], 'WR': ['kai']},
    'total': 580}),
  ('normal control 1',
   [[['jo', 'WR', 100, 'ACTIVE'], ['gus', 'RB', 85, 'ACTIVE'], ['fay', 'RB', 55, 'BYE'],
     ['cy', 'WR', 150, 'ACTIVE'], ['eli', 'WR', 150, 'ACTIVE'], ['ada', 'WR', 85, 'OUT'],
     ['max', 'RB', 55, 'BYE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': [], 'RB': ['gus'], 'TE': [], 'WR': ['cy', 'eli']}, 'total': 485}),
  ('normal control 2',
   [[['max', 'RB', 85, 'BYE'], ['hal', 'TE', 40, 'ACTIVE'], ['jo', 'RB', 70, 'Q'],
     ['gus', 'TE', 150, 'ACTIVE'], ['ada', 'RB', 100, 'Q'], ['eli', 'RB', 70, 'Q'],
     ['ivy', 'K', 55, 'ACTIVE'], ['kai', 'RB', 120, 'OUT'], ['cy', 'QB', 40, 'ACTIVE'],
     ['bo', 'RB', 85, 'BYE'], ['pia', 'RB', 120, 'OUT'], ['oz', 'WR', 85, 'OUT']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['cy'], 'RB': ['ada', 'eli'], 'TE': ['gus'], 'WR': []}, 'total': 430}),
  ('normal control 3',
   [[['ivy', 'WR', 85, 'ACTIVE'], ['pia', 'RB', 150, 'ACTIVE'], ['max', 'TE', 85, 'ACTIVE'],
     ['gus', 'RB', 40, 'ACTIVE'], ['kai', 'K', 40, 'OUT'], ['lu', 'TE', 100, 'ACTIVE'],
     ['hal', 'RB', 85, 'OUT'], ['fay', 'WR', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['max'], 'QB': [], 'RB': ['pia', 'gus'], 'TE': ['lu'], 'WR': ['fay', 'ivy']},
    'total': 560}),
  ('normal control 4',
   [[['fay', 'RB', 70, 'Q'], ['gus', 'WR', 120, 'ACTIVE'], ['oz', 'WR', 40, 'Q'],
     ['pia', 'QB', 150, 'ACTIVE'], ['ned', 'RB', 120, 'ACTIVE'], ['eli', 'K', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': ['ned', 'fay'], 'TE': [], 'WR': ['gus', 'oz']},
    'total': 500})],
 [('regression: flex position eligibility',
   [[['fay', 'QB', 70, 'Q'], ['cy', 'QB', 40, 'BYE'], ['ned', 'QB', 100, 'ACTIVE'],
     ['ivy', 'TE', 100, 'ACTIVE'], ['hal', 'QB', 150, 'ACTIVE'], ['dee', 'TE', 40, 'ACTIVE'],
     ['oz', 'RB', 100, 'ACTIVE'], ['ada', 'TE', 120, 'ACTIVE'], ['jo', 'WR', 85, 'OUT'],
     ['pia', 'RB', 70, 'OUT'], ['lu', 'QB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ivy'], 'QB': ['hal'], 'RB': ['oz'], 'TE': ['ada'], 'WR': []}, 'total': 470}),
  ('partial repair probe: flex position eligibility',
   [[['oz', 'RB', 55, 'BYE'], ['ivy', 'QB', 70, 'Q'], ['ada', 'QB', 40, 'BYE'], ['dee', 'WR', 70, 'ACTIVE'],
     ['gus', 'RB', 85, 'ACTIVE'], ['max', 'K', 150, 'Q'], ['ned', 'RB', 40, 'ACTIVE'],
     ['kai', 'RB', 40, 'BYE'], ['jo', 'RB', 85, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ned'], 'QB': ['ivy'], 'RB': ['gus', 'jo'], 'TE': [], 'WR': ['dee']}, 'total': 350}),
  ('second regression',
   [[['bo', 'WR', 40, 'ACTIVE'], ['ned', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'],
     ['oz', 'K', 85, 'Q'], ['fay', 'WR', 70, 'Q'], ['eli', 'RB', 55, 'BYE'], ['cy', 'TE', 70, 'ACTIVE'],
     ['dee', 'WR', 150, 'ACTIVE'], ['gus', 'TE', 120, 'BYE'], ['max', 'TE', 55, 'ACTIVE'],
     ['kai', 'WR', 40, 'OUT']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['ada'], 'RB': [], 'TE': ['cy'], 'WR': ['dee', 'ned']}, 'total': 460}),
  ('normal control 1',
   [[['eli', 'QB', 150, 'OUT'], ['hal', 'QB', 55, 'OUT'], ['lu', 'QB', 150, 'OUT'], ['oz', 'TE', 70, 'OUT'],
     ['max', 'TE', 70, 'BYE'], ['ned', 'TE', 55, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': [], 'WR': []}, 'total': 0}),
  ('normal control 2',
   [[['gus', 'QB', 40, 'ACTIVE'], ['lu', 'WR', 100, 'ACTIVE'], ['cy', 'RB', 120, 'ACTIVE'],
     ['kai', 'RB', 55, 'OUT'], ['fay', 'WR', 70, 'OUT'], ['hal', 'RB', 100, 'OUT'], ['jo', 'RB', 70, 'Q'],
     ['ivy', 'WR', 85, 'ACTIVE'], ['ada', 'QB', 70, 'ACTIVE'], ['eli', 'TE', 55, 'ACTIVE'],
     ['bo', 'RB', 70, 'Q']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['ada'], 'RB': ['cy', 'bo'], 'TE': ['eli'], 'WR': ['lu', 'ivy']},
    'total': 570}),
  ('normal control 3',
   [[['lu', 'RB', 70, 'ACTIVE'], ['kai', 'QB', 100, 'ACTIVE'], ['max', 'WR', 70, 'ACTIVE'],
     ['gus', 'WR', 150, 'ACTIVE'], ['ned', 'RB', 55, 'OUT'], ['jo', 'TE', 120, 'ACTIVE'],
     ['eli', 'RB', 70, 'Q'], ['fay', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['kai'], 'RB': ['eli', 'lu'], 'TE': ['jo'], 'WR': ['gus', 'max']},
    'total': 620}),
  ('normal control 4',
   [[['lu', 'WR', 70, 'OUT'], ['ada', 'K', 70, 'Q'], ['max', 'RB', 55, 'ACTIVE'],
     ['gus', 'RB', 100, 'ACTIVE'], ['oz', 'WR', 70, 'ACTIVE'], ['bo', 'QB', 85, 'ACTIVE'],
     ['kai', 'WR', 85, 'ACTIVE'], ['dee', 'RB', 85, 'BYE'], ['jo', 'RB', 40, 'Q'],
     ['hal', 'WR', 100, 'ACTIVE'], ['pia', 'WR', 100, 'ACTIVE'], ['fay', 'WR', 40, 'OUT']]],
   {'lineup': {'FLEX': ['kai'], 'QB': ['bo'], 'RB': ['gus', 'max'], 'TE': [], 'WR': ['hal', 'pia']},
    'total': 525})],
 [('regression: flex position eligibility',
   [[['ada', 'WR', 40, 'BYE'], ['gus', 'K', 40, 'OUT'], ['hal', 'QB', 85, 'ACTIVE'],
     ['lu', 'QB', 100, 'ACTIVE'], ['cy', 'TE', 40, 'Q'], ['max', 'TE', 100, 'Q'], ['oz', 'K', 40, 'Q'],
     ['dee', 'RB', 85, 'OUT'], ['bo', 'QB', 40, 'ACTIVE'], ['fay', 'QB', 70, 'OUT'],
     ['jo', 'WR', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['lu'], 'RB': [], 'TE': ['max'], 'WR': ['jo']}, 'total': 390}),
  ('partial repair probe: flex position eligibility',
   [[['ivy', 'TE', 55, 'ACTIVE'], ['oz', 'WR', 40, 'BYE'], ['cy', 'K', 40, 'ACTIVE'],
     ['max', 'TE', 70, 'BYE'], ['eli', 'WR', 85, 'Q'], ['hal', 'TE', 150, 'OUT'], ['ned', 'RB', 70, 'OUT'],
     ['kai', 'RB', 70, 'ACTIVE'], ['jo', 'QB', 85, 'ACTIVE'], ['gus', 'RB', 40, 'Q'], ['fay', 'K', 100, 'Q'],
     ['lu', 'WR', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': [], 'QB': ['jo'], 'RB': ['kai', 'gus'], 'TE': ['ivy'], 'WR': ['eli', 'lu']},
    'total': 405}),
  ('second regression',
   [[['ned', 'WR', 85, 'ACTIVE'], ['pia', 'K', 150, 'BYE'], ['gus', 'WR', 85, 'ACTIVE'],
     ['cy', 'WR', 55, 'BYE'], ['kai', 'K', 120, 'ACTIVE'], ['oz', 'WR', 100, 'ACTIVE'],
     ['fay', 'QB', 150, 'BYE'], ['dee', 'QB', 85, 'ACTIVE'], ['jo', 'TE', 150, 'BYE'],
     ['bo', 'WR', 150, 'ACTIVE'], ['eli', 'RB', 55, 'ACTIVE'], ['lu', 'K', 85, 'Q']]],
   {'lineup': {'FLEX': ['gus'], 'QB': ['dee'], 'RB': ['eli'], 'TE': [], 'WR': ['bo', 'oz']}, 'total': 475}),
  ('normal control 1',
   [[['oz', 'WR', 70, 'ACTIVE'], ['kai', 'TE', 70, 'ACTIVE'], ['hal', 'WR', 70, 'OUT'],
     ['ada', 'RB', 150, 'OUT'], ['max', 'WR', 70, 'ACTIVE'], ['fay', 'RB', 85, 'OUT'],
     ['pia', 'QB', 70, 'ACTIVE'], ['ned', 'WR', 150, 'OUT'], ['lu', 'K', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': ['pia'], 'RB': [], 'TE': ['kai'], 'WR': ['max', 'oz']}, 'total': 280}),
  ('normal control 2',
   [[['ivy', 'RB', 55, 'Q'], ['jo', 'WR', 40, 'ACTIVE'], ['dee', 'TE', 70, 'ACTIVE'],
     ['ned', 'QB', 55, 'OUT'], ['ada', 'WR', 100, 'Q'], ['kai', 'TE', 150, 'ACTIVE']]],
   {'lineup': {'FLEX': ['dee'], 'QB': [], 'RB': ['ivy'], 'TE': ['kai'], 'WR': ['ada', 'jo']}, 'total': 415}),
  ('normal control 3',
   [[['ada', 'RB', 120, 'ACTIVE'], ['jo', 'WR', 120, 'ACTIVE'], ['fay', 'TE', 55, 'ACTIVE'],
     ['oz', 'RB', 40, 'ACTIVE'], ['bo', 'WR', 70, 'ACTIVE'], ['kai', 'RB', 40, 'ACTIVE'],
     ['max', 'WR', 100, 'Q'], ['lu', 'K', 70, 'ACTIVE'], ['dee', 'QB', 70, 'BYE'],
     ['cy', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['bo'], 'QB': [], 'RB': ['ada', 'cy'], 'TE': ['fay'], 'WR': ['jo', 'max']},
    'total': 535}),
  ('normal control 4',
   [[['kai', 'RB', 85, 'ACTIVE'], ['lu', 'K', 40, 'OUT'], ['oz', 'QB', 85, 'ACTIVE'], ['jo', 'WR', 150, 'Q'],
     ['gus', 'TE', 70, 'ACTIVE'], ['fay', 'RB', 40, 'ACTIVE'], ['cy', 'RB', 55, 'ACTIVE'],
     ['eli', 'WR', 100, 'ACTIVE'], ['max', 'RB', 70, 'ACTIVE']]],
   {'lineup': {'FLEX': ['cy'], 'QB': ['oz'], 'RB': ['kai', 'max'], 'TE': ['gus'], 'WR': ['jo', 'eli']},
    'total': 615})],
 [('regression: flex position eligibility',
   [[['oz', 'WR', 100, 'BYE'], ['jo', 'RB', 100, 'ACTIVE'], ['fay', 'QB', 150, 'Q'], ['kai', 'QB', 70, 'BYE'],
     ['pia', 'WR', 70, 'BYE'], ['ivy', 'QB', 70, 'ACTIVE'], ['eli', 'K', 100, 'ACTIVE'],
     ['ada', 'TE', 55, 'Q'], ['max', 'WR', 120, 'BYE']]],
   {'lineup': {'FLEX': [], 'QB': ['fay'], 'RB': ['jo'], 'TE': ['ada'], 'WR': []}, 'total': 305}),
  ('partial repair probe: flex position eligibility',
   [[['dee', 'RB', 120, 'OUT'], ['ivy', 'QB', 70, 'BYE'], ['gus', 'K', 85, 'ACTIVE'],
     ['fay', 'WR', 100, 'ACTIVE'], ['bo', 'WR', 100, 'ACTIVE'], ['kai', 'TE', 70, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': [], 'TE': [], 'WR': ['bo', 'fay']}, 'total': 200}),
  ('second regression',
   [[['ada', 'K', 120, 'Q'], ['max', 'TE', 120, 'ACTIVE'], ['cy', 'K', 120, 'BYE'], ['bo', 'RB', 85, 'BYE'],
     ['eli', 'TE', 85, 'OUT'], ['pia', 'RB', 100, 'ACTIVE'], ['kai', 'WR', 85, 'BYE'],
     ['ivy', 'WR', 100, 'ACTIVE'], ['ned', 'RB', 85, 'OUT'], ['dee', 'WR', 40, 'OUT'],
     ['gus', 'WR', 85, 'OUT']]],
   {'lineup': {'FLEX': [], 'QB': [], 'RB': ['pia'], 'TE': ['max'], 'WR': ['ivy']}, 'total': 320}),
  ('normal control 1',
   [[['ada', 'RB', 100, 'ACTIVE'], ['kai', 'QB', 120, 'ACTIVE'], ['fay', 'RB', 100, 'ACTIVE'],
     ['lu', 'WR', 120, 'OUT'], ['pia', 'RB', 150, 'ACTIVE'], ['max', 'RB', 120, 'ACTIVE']]],
   {'lineup': {'FLEX': ['ada'], 'QB': ['kai'], 'RB': ['pia', 'max'], 'TE': [], 'WR': []}, 'total': 490}),
  ('normal control 2',
   [[['max', 'TE', 55, 'ACTIVE'], ['hal', 'RB', 100, 'Q'], ['kai', 'QB', 120, 'ACTIVE'],
     ['pia', 'RB', 70, 'OUT'], ['dee', 'WR', 70, 'BYE'], ['oz', 'WR', 85, 'ACTIVE'],
     ['fay', 'RB', 40, 'ACTIVE'], ['lu', 'RB', 100, 'ACTIVE']]],
   {'lineup': {'FLEX': ['fay'], 'QB': ['kai'], 'RB': ['hal', 'lu'], 'TE': ['max'], 'WR': ['oz']},
    'total': 500}),
  ('normal control 3',
   [[['hal', 'WR', 70, 'ACTIVE'], ['jo', 'RB', 85, 'ACTIVE'], ['lu', 'K', 70, 'ACTIVE'],
     ['pia', 'K', 120, 'BYE'], ['ada', 'WR', 85, 'ACTIVE'], ['bo', 'WR', 100, 'ACTIVE'],
     ['fay', 'RB', 55, 'BYE'], ['cy', 'RB', 40, 'Q'], ['ned', 'TE', 55, 'OUT'], ['gus', 'RB', 100, 'OUT']]],
   {'lineup': {'FLEX': ['hal'], 'QB': [], 'RB': ['jo', 'cy'], 'TE': [], 'WR': ['bo', 'ada']}, 'total': 380}),
  ('normal control 4',
   [[['eli', 'WR', 100, 'ACTIVE'], ['ada', 'QB', 120, 'OUT'], ['hal', 'TE', 85, 'Q'],
     ['gus', 'K', 150, 'BYE'], ['pia', 'RB', 150, 'OUT'], ['ivy', 'RB', 100, 'OUT'], ['jo', 'WR', 85, 'Q'],
     ['dee', 'WR', 100, 'ACTIVE'], ['max', 'QB', 85, 'Q'], ['ned', 'RB', 40, 'ACTIVE']]],
   {'lineup': {'FLEX': ['jo'], 'QB': ['max'], 'RB': ['ned'], 'TE': ['hal'], 'WR': ['dee', 'eli']},
    'total': 495})]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(*args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A second quarterback with a high projection occupies FLEX in a non-superflex league.

Players are [name, position, projection tenths, status]. OUT and BYE players are ineligible; Q (questionable) players are eligible. Rank by projection descending, name ascending on ties. Fill QB x1, RB x2, WR x2, TE x1, then one FLEX from the best remaining RB/WR/TE (kickers and QBs never flex). Return the slot lists and the total projection.

split: open-access