FAILURE MAP
← Case archive

FA-94491 / Exam timetabling constraints / Open access

Period durations looked up with one-based indices · case 01

Each exam is checked against the previous period's length.

Verified by executionVariant 1 · 8 checks per implementationDownload source bundle ↓JSON ↗

ROOT CAUSE

The period index is shifted by one.

VERIFIED REPAIR

Periods are indexed from zero.

Unsuccessful approach: Special-casing period zero keeps the shift for every other period.

Case contract

timetable maps exam -> period index, exams exam -> duration, periods -> duration. Duration violations (exam longer than its period) are listed first by exam id; then for each constraint in order: after (a must be in a strictly later period than b), exclusion (different periods), coincidence (same period), exclusive (a must be alone in its period). Return violation rows.

Why this case matters

Hard-constraint validation gates every candidate exam timetable.

1 / The failure

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(timetable, exams, periods, cons):
    out = []
    for e in sorted(timetable):
        if exams[e] > periods[timetable[e] - 1]:
            out.append(['duration', e])
    for kind, a, b in cons:
        pa, pb = timetable[a], timetable[b]
        if kind == 'after' and not pa > pb:
            out.append([kind, a, b])
        elif kind == 'exclusion' and pa == pb:
            out.append([kind, a, b])
        elif kind == 'coincidence' and pa != pb:
            out.append([kind, a, b])
        elif kind == 'exclusive' and sum(1 for e in timetable if timetable[e] == pa) > 1:
            out.append([kind, a, b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: period index base 1',
   [{'A': 1, 'B': 0}, {'A': 120, 'B': 90}, [90, 120], [['exclusive', 'A', 'B']]], []),
  ('regression variant: period index base 2',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('partial repair guard 3',
   [{'MATH101': 2, 'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 0, 'BIO130': 0},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 180, 90, 180],
    [['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 4',
   [{'MATH101H': 1, 'MATH101': 2, 'CHEM120': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 90, 180, 180],
    [['exclusive', 'CHEM120', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101'],
     ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('normal control 5',
   [{'CHEM120': 0, 'BIO130': 0, 'MATH101H': 1, 'MATH101': 0, 'PHYS110': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 90, 120],
    [['after', 'MATH101', 'MATH101H'], ['exclusion', 'PHYS110', 'MATH101'],
     ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 6',
   [{'BIO130': 2, 'CHEM120': 1, 'MATH101H': 1, 'PHYS110': 3, 'MATH101': 1},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90}, [90, 120, 180, 180],
    [['exclusion', 'BIO130', 'CHEM120'], ['after', 'BIO130', 'MATH101H'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 7',
   [{'MATH101': 3, 'MATH101H': 0, 'CHEM120': 2, 'PHYS110': 1, 'BIO130': 0},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 180, 180],
    [['after', 'MATH101H', 'MATH101']]],
   [['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'PHYS110': 0, 'CHEM120': 3, 'MATH101': 0, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90}, [120, 120, 90, 120],
    [['coincidence', 'MATH101', 'CHEM120'], ['exclusion', 'CHEM120', 'MATH101H'],
     ['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']])],
 [('regression: period index base 1',
   [{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90}, [90, 180, 180, 120],
    [['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusion', 'CHEM120', 'PHYS110'], ['exclusion', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101'], ['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
    ['exclusion', 'CHEM120', 'PHYS110']]),
  ('regression variant: period index base 2',
   [{'PHYS110': 0, 'MATH101': 2, 'CHEM120': 2, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120, 'CHEM120': 180}, [90, 180, 120, 90],
    [['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['exclusive', 'CHEM120', 'MATH101']]),
  ('partial repair guard 3',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('boundary control 4', [{'A': 2, 'B': 1}, {'A': 90, 'B': 90}, [90, 120, 120], [['after', 'A', 'B']]], []),
  ('normal control 5',
   [{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 3}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [120, 90, 90, 180],
    [['after', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101', 'PHYS110'],
     ['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101': 2, 'CHEM120': 3, 'MATH101H': 3, 'PHYS110': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 120, 180, 90],
    [['coincidence', 'MATH101H', 'CHEM120'], ['exclusion', 'PHYS110', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'MATH101H': 0, 'PHYS110': 1, 'CHEM120': 1, 'HIST140': 0, 'MATH101': 0, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 180},
    [180, 120, 120, 180], [['exclusion', 'CHEM120', 'BIO130'], ['coincidence', 'PHYS110', 'CHEM120']]],
   []),
  ('normal control 8',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 2, 'MATH101': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120}, [180, 180, 180, 90],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'MATH101H', 'CHEM120'],
     ['after', 'CHEM120', 'MATH101H']]],
   [['duration', 'PHYS110'], ['after', 'CHEM120', 'MATH101H']])],
 [('regression: period index base 1',
   [{'CHEM120': 2, 'MATH101': 3, 'PHYS110': 2, 'MATH101H': 1},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 120}, [90, 180, 120, 90],
    [['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]),
  ('regression variant: period index base 2',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'CHEM120': 3, 'MATH101H': 1, 'MATH101': 0, 'BIO130': 3, 'PHYS110': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [120, 120, 120, 180],
    [['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'CHEM120', 'BIO130'],
     ['coincidence', 'BIO130', 'PHYS110']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'BIO130', 'PHYS110']]),
  ('boundary control 4', [{'B': 0, 'A': 1}, {'A': 180, 'B': 180}, [120, 120], []],
   [['duration', 'A'], ['duration', 'B']]),
  ('normal control 5',
   [{'MATH101H': 1, 'MATH101': 0, 'PHYS110': 0, 'BIO130': 1, 'CHEM120': 3},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'CHEM120', 'MATH101H'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]],
   [['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101H': 2, 'PHYS110': 3, 'CHEM120': 3, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 180}, [180, 120, 120, 120],
    [['exclusion', 'PHYS110', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'BIO130': 1, 'PHYS110': 0, 'MATH101': 0, 'MATH101H': 1, 'CHEM120': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [90, 90, 90, 120],
    [['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
     ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['duration', 'PHYS110'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
    ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]),
  ('normal control 8',
   [{'MATH101': 1, 'MATH101H': 2, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120}, [120, 90, 90, 180],
    [['exclusion', 'CHEM120', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110']])],
 [('regression: period index base 1',
   [{'HIST140': 1, 'CHEM120': 1, 'MATH101': 2, 'MATH101H': 3, 'PHYS110': 2, 'BIO130': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180, 'HIST140': 120},
    [90, 120, 90, 120],
    [['after', 'CHEM120', 'MATH101H'], ['coincidence', 'PHYS110', 'BIO130'], ['after', 'MATH101', 'HIST140'],
     ['coincidence', 'MATH101', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['after', 'CHEM120', 'MATH101H']]),
  ('regression variant: period index base 2',
   [{'MATH101': 1, 'CHEM120': 2, 'BIO130': 3, 'PHYS110': 3, 'MATH101H': 3},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [180, 120, 180, 120],
    [['exclusion', 'CHEM120', 'MATH101H'], ['exclusive', 'BIO130', 'MATH101'],
     ['exclusion', 'BIO130', 'MATH101H'], ['exclusion', 'CHEM120', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101'],
    ['exclusion', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'MATH101H': 2, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101'],
     ['coincidence', 'MATH101H', 'MATH101']]],
   [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('boundary control 4', [{'A': 0}, {'A': 120}, [120], []], []),
  ('normal control 5',
   [{'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 2, 'MATH101': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 90}, [120, 180, 180, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['coincidence', 'MATH101H', 'PHYS110'],
     ['coincidence', 'MATH101H', 'PHYS110'], ['exclusion', 'MATH101H', 'PHYS110']]],
   [['coincidence', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101H', 'PHYS110']]),
  ('normal control 6',
   [{'PHYS110': 1, 'MATH101H': 1, 'MATH101': 1}, {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
     ['exclusive', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('normal control 7',
   [{'MATH101H': 1, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [90, 90, 120, 180],
    [['exclusive', 'MATH101', 'MATH101H'], ['coincidence', 'MATH101H', 'MATH101'],
     ['after', 'MATH101H', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['coincidence', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'MATH101H': 0, 'PHYS110': 0, 'CHEM120': 1, 'BIO130': 1, 'MATH101': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 120, 90],
    [['exclusive', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101']])],
 [('regression: period index base 1',
   [{'BIO130': 0, 'PHYS110': 3, 'MATH101': 1, 'CHEM120': 0, 'MATH101H': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [120, 120, 180, 90],
    [['coincidence', 'CHEM120', 'BIO130'], ['after', 'CHEM120', 'BIO130'],
     ['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'CHEM120', 'BIO130'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('regression variant: period index base 2',
   [{'MATH101': 2, 'PHYS110': 3, 'MATH101H': 2}, {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180},
    [120, 180, 90, 180], [['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101']]),
  ('partial repair guard 3',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('boundary control 4', [{'A': 1, 'B': 1}, {'A': 90, 'B': 90}, [90, 120], [['after', 'A', 'B']]],
   [['after', 'A', 'B']]),
  ('normal control 5',
   [{'PHYS110': 1, 'MATH101': 2, 'CHEM120': 1, 'HIST140': 3, 'MATH101H': 3, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 90},
    [120, 120, 120, 120],
    [['after', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]],
   [['duration', 'MATH101H'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]),
  ('normal control 6',
   [{'BIO130': 3, 'MATH101H': 0, 'CHEM120': 1, 'PHYS110': 0, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 120, 120, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
     ['coincidence', 'MATH101H', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
    ['coincidence', 'MATH101H', 'CHEM120']]),
  ('normal control 7',
   [{'CHEM120': 2, 'BIO130': 3, 'MATH101H': 2, 'MATH101': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'MATH101H', 'MATH101'], ['after', 'CHEM120', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101H', 'MATH101'],
    ['after', 'CHEM120', 'PHYS110']]),
  ('normal control 8',
   [{'HIST140': 2, 'MATH101': 1, 'CHEM120': 3, 'PHYS110': 3, 'MATH101H': 2, 'BIO130': 3},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90, 'HIST140': 120},
    [90, 90, 120, 90],
    [['after', 'HIST140', 'MATH101H'], ['exclusion', 'HIST140', 'BIO130'], ['after', 'HIST140', 'MATH101']]],
   [['duration', 'MATH101'], ['after', 'HIST140', 'MATH101H']])]]
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)
Boundary fixtureActualExpectedOutcome
regression: period index base 1[['duration', 'A']][]Failed
regression variant: period index base 2[['duration', 'BIO130'], ['duration', 'MATH101H'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']][['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]Failed
partial repair guard 3[['duration', 'PHYS110'], ['coincidence', 'MATH101', 'MATH101H']][['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['coincidence', 'MATH101', 'MATH101H']]Failed
normal control 4[['duration', 'MATH101'], ['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']][['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]Failed
normal control 5[['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']][['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]Passed
normal control 6[['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]Passed
normal control 7[['after', 'MATH101H', 'MATH101']][['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]Failed
normal control 8[['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']]Passed

SHA-256 / d67a8d8d7c3e5ae8362e11d08afef36713cf2e532df787a5e9ce6e303a03d500

2 / The unsuccessful fix

Exit 1
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(timetable, exams, periods, cons):
    out = []
    for e in sorted(timetable):
        if exams[e] > periods[timetable[e] - 1] if timetable[e] else periods[0]:
            out.append(['duration', e])
    for kind, a, b in cons:
        pa, pb = timetable[a], timetable[b]
        if kind == 'after' and not pa > pb:
            out.append([kind, a, b])
        elif kind == 'exclusion' and pa == pb:
            out.append([kind, a, b])
        elif kind == 'coincidence' and pa != pb:
            out.append([kind, a, b])
        elif kind == 'exclusive' and sum(1 for e in timetable if timetable[e] == pa) > 1:
            out.append([kind, a, b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: period index base 1',
   [{'A': 1, 'B': 0}, {'A': 120, 'B': 90}, [90, 120], [['exclusive', 'A', 'B']]], []),
  ('regression variant: period index base 2',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('partial repair guard 3',
   [{'MATH101': 2, 'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 0, 'BIO130': 0},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 180, 90, 180],
    [['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 4',
   [{'MATH101H': 1, 'MATH101': 2, 'CHEM120': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 90, 180, 180],
    [['exclusive', 'CHEM120', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101'],
     ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('normal control 5',
   [{'CHEM120': 0, 'BIO130': 0, 'MATH101H': 1, 'MATH101': 0, 'PHYS110': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 90, 120],
    [['after', 'MATH101', 'MATH101H'], ['exclusion', 'PHYS110', 'MATH101'],
     ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 6',
   [{'BIO130': 2, 'CHEM120': 1, 'MATH101H': 1, 'PHYS110': 3, 'MATH101': 1},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90}, [90, 120, 180, 180],
    [['exclusion', 'BIO130', 'CHEM120'], ['after', 'BIO130', 'MATH101H'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 7',
   [{'MATH101': 3, 'MATH101H': 0, 'CHEM120': 2, 'PHYS110': 1, 'BIO130': 0},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 180, 180],
    [['after', 'MATH101H', 'MATH101']]],
   [['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'PHYS110': 0, 'CHEM120': 3, 'MATH101': 0, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90}, [120, 120, 90, 120],
    [['coincidence', 'MATH101', 'CHEM120'], ['exclusion', 'CHEM120', 'MATH101H'],
     ['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']])],
 [('regression: period index base 1',
   [{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90}, [90, 180, 180, 120],
    [['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusion', 'CHEM120', 'PHYS110'], ['exclusion', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101'], ['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
    ['exclusion', 'CHEM120', 'PHYS110']]),
  ('regression variant: period index base 2',
   [{'PHYS110': 0, 'MATH101': 2, 'CHEM120': 2, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120, 'CHEM120': 180}, [90, 180, 120, 90],
    [['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['exclusive', 'CHEM120', 'MATH101']]),
  ('partial repair guard 3',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('boundary control 4', [{'A': 2, 'B': 1}, {'A': 90, 'B': 90}, [90, 120, 120], [['after', 'A', 'B']]], []),
  ('normal control 5',
   [{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 3}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [120, 90, 90, 180],
    [['after', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101', 'PHYS110'],
     ['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101': 2, 'CHEM120': 3, 'MATH101H': 3, 'PHYS110': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 120, 180, 90],
    [['coincidence', 'MATH101H', 'CHEM120'], ['exclusion', 'PHYS110', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'MATH101H': 0, 'PHYS110': 1, 'CHEM120': 1, 'HIST140': 0, 'MATH101': 0, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 180},
    [180, 120, 120, 180], [['exclusion', 'CHEM120', 'BIO130'], ['coincidence', 'PHYS110', 'CHEM120']]],
   []),
  ('normal control 8',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 2, 'MATH101': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120}, [180, 180, 180, 90],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'MATH101H', 'CHEM120'],
     ['after', 'CHEM120', 'MATH101H']]],
   [['duration', 'PHYS110'], ['after', 'CHEM120', 'MATH101H']])],
 [('regression: period index base 1',
   [{'CHEM120': 2, 'MATH101': 3, 'PHYS110': 2, 'MATH101H': 1},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 120}, [90, 180, 120, 90],
    [['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]),
  ('regression variant: period index base 2',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'CHEM120': 3, 'MATH101H': 1, 'MATH101': 0, 'BIO130': 3, 'PHYS110': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [120, 120, 120, 180],
    [['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'CHEM120', 'BIO130'],
     ['coincidence', 'BIO130', 'PHYS110']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'BIO130', 'PHYS110']]),
  ('boundary control 4', [{'B': 0, 'A': 1}, {'A': 180, 'B': 180}, [120, 120], []],
   [['duration', 'A'], ['duration', 'B']]),
  ('normal control 5',
   [{'MATH101H': 1, 'MATH101': 0, 'PHYS110': 0, 'BIO130': 1, 'CHEM120': 3},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'CHEM120', 'MATH101H'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]],
   [['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101H': 2, 'PHYS110': 3, 'CHEM120': 3, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 180}, [180, 120, 120, 120],
    [['exclusion', 'PHYS110', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'BIO130': 1, 'PHYS110': 0, 'MATH101': 0, 'MATH101H': 1, 'CHEM120': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [90, 90, 90, 120],
    [['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
     ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['duration', 'PHYS110'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
    ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]),
  ('normal control 8',
   [{'MATH101': 1, 'MATH101H': 2, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120}, [120, 90, 90, 180],
    [['exclusion', 'CHEM120', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110']])],
 [('regression: period index base 1',
   [{'HIST140': 1, 'CHEM120': 1, 'MATH101': 2, 'MATH101H': 3, 'PHYS110': 2, 'BIO130': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180, 'HIST140': 120},
    [90, 120, 90, 120],
    [['after', 'CHEM120', 'MATH101H'], ['coincidence', 'PHYS110', 'BIO130'], ['after', 'MATH101', 'HIST140'],
     ['coincidence', 'MATH101', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['after', 'CHEM120', 'MATH101H']]),
  ('regression variant: period index base 2',
   [{'MATH101': 1, 'CHEM120': 2, 'BIO130': 3, 'PHYS110': 3, 'MATH101H': 3},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [180, 120, 180, 120],
    [['exclusion', 'CHEM120', 'MATH101H'], ['exclusive', 'BIO130', 'MATH101'],
     ['exclusion', 'BIO130', 'MATH101H'], ['exclusion', 'CHEM120', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101'],
    ['exclusion', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'MATH101H': 2, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101'],
     ['coincidence', 'MATH101H', 'MATH101']]],
   [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('boundary control 4', [{'A': 0}, {'A': 120}, [120], []], []),
  ('normal control 5',
   [{'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 2, 'MATH101': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 90}, [120, 180, 180, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['coincidence', 'MATH101H', 'PHYS110'],
     ['coincidence', 'MATH101H', 'PHYS110'], ['exclusion', 'MATH101H', 'PHYS110']]],
   [['coincidence', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101H', 'PHYS110']]),
  ('normal control 6',
   [{'PHYS110': 1, 'MATH101H': 1, 'MATH101': 1}, {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
     ['exclusive', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('normal control 7',
   [{'MATH101H': 1, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [90, 90, 120, 180],
    [['exclusive', 'MATH101', 'MATH101H'], ['coincidence', 'MATH101H', 'MATH101'],
     ['after', 'MATH101H', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['coincidence', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'MATH101H': 0, 'PHYS110': 0, 'CHEM120': 1, 'BIO130': 1, 'MATH101': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 120, 90],
    [['exclusive', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101']])],
 [('regression: period index base 1',
   [{'BIO130': 0, 'PHYS110': 3, 'MATH101': 1, 'CHEM120': 0, 'MATH101H': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [120, 120, 180, 90],
    [['coincidence', 'CHEM120', 'BIO130'], ['after', 'CHEM120', 'BIO130'],
     ['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'CHEM120', 'BIO130'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('regression variant: period index base 2',
   [{'MATH101': 2, 'PHYS110': 3, 'MATH101H': 2}, {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180},
    [120, 180, 90, 180], [['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101']]),
  ('partial repair guard 3',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('boundary control 4', [{'A': 1, 'B': 1}, {'A': 90, 'B': 90}, [90, 120], [['after', 'A', 'B']]],
   [['after', 'A', 'B']]),
  ('normal control 5',
   [{'PHYS110': 1, 'MATH101': 2, 'CHEM120': 1, 'HIST140': 3, 'MATH101H': 3, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 90},
    [120, 120, 120, 120],
    [['after', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]],
   [['duration', 'MATH101H'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]),
  ('normal control 6',
   [{'BIO130': 3, 'MATH101H': 0, 'CHEM120': 1, 'PHYS110': 0, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 120, 120, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
     ['coincidence', 'MATH101H', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
    ['coincidence', 'MATH101H', 'CHEM120']]),
  ('normal control 7',
   [{'CHEM120': 2, 'BIO130': 3, 'MATH101H': 2, 'MATH101': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'MATH101H', 'MATH101'], ['after', 'CHEM120', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101H', 'MATH101'],
    ['after', 'CHEM120', 'PHYS110']]),
  ('normal control 8',
   [{'HIST140': 2, 'MATH101': 1, 'CHEM120': 3, 'PHYS110': 3, 'MATH101H': 2, 'BIO130': 3},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90, 'HIST140': 120},
    [90, 90, 120, 90],
    [['after', 'HIST140', 'MATH101H'], ['exclusion', 'HIST140', 'BIO130'], ['after', 'HIST140', 'MATH101']]],
   [['duration', 'MATH101'], ['after', 'HIST140', 'MATH101H']])]]
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)
Boundary fixtureActualExpectedOutcome
regression: period index base 1[['duration', 'A'], ['duration', 'B']][]Failed
regression variant: period index base 2[['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']][['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]Failed
partial repair guard 3[['duration', 'BIO130'], ['duration', 'MATH101H'], ['duration', 'PHYS110'], ['coincidence', 'MATH101', 'MATH101H']][['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['coincidence', 'MATH101', 'MATH101H']]Failed
normal control 4[['duration', 'MATH101'], ['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']][['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]Failed
normal control 5[['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']][['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]Failed
normal control 6[['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]Passed
normal control 7[['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']][['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]Passed
normal control 8[['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110'], ['coincidence', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']]Failed

SHA-256 / 586c6a2cc23dea862f089d53bd9629df233eef3ab96424ed50b2d05d6fa2208b

3 / The verified repair

Exit 0
"""Failure Map reference implementation. Python standard library only."""
import json

N = 1
observations = []
def solve(timetable, exams, periods, cons):
    out = []
    for e in sorted(timetable):
        if exams[e] > periods[timetable[e]]:
            out.append(['duration', e])
    for kind, a, b in cons:
        pa, pb = timetable[a], timetable[b]
        if kind == 'after' and not pa > pb:
            out.append([kind, a, b])
        elif kind == 'exclusion' and pa == pb:
            out.append([kind, a, b])
        elif kind == 'coincidence' and pa != pb:
            out.append([kind, a, b])
        elif kind == 'exclusive' and sum(1 for e in timetable if timetable[e] == pa) > 1:
            out.append([kind, a, b])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[('regression: period index base 1',
   [{'A': 1, 'B': 0}, {'A': 120, 'B': 90}, [90, 120], [['exclusive', 'A', 'B']]], []),
  ('regression variant: period index base 2',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('partial repair guard 3',
   [{'MATH101': 2, 'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 0, 'BIO130': 0},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 180, 90, 180],
    [['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 4',
   [{'MATH101H': 1, 'MATH101': 2, 'CHEM120': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 90, 180, 180],
    [['exclusive', 'CHEM120', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101'],
     ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('normal control 5',
   [{'CHEM120': 0, 'BIO130': 0, 'MATH101H': 1, 'MATH101': 0, 'PHYS110': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 90, 120],
    [['after', 'MATH101', 'MATH101H'], ['exclusion', 'PHYS110', 'MATH101'],
     ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 6',
   [{'BIO130': 2, 'CHEM120': 1, 'MATH101H': 1, 'PHYS110': 3, 'MATH101': 1},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90}, [90, 120, 180, 180],
    [['exclusion', 'BIO130', 'CHEM120'], ['after', 'BIO130', 'MATH101H'], ['after', 'MATH101', 'CHEM120']]],
   [['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]),
  ('normal control 7',
   [{'MATH101': 3, 'MATH101H': 0, 'CHEM120': 2, 'PHYS110': 1, 'BIO130': 0},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [120, 120, 180, 180],
    [['after', 'MATH101H', 'MATH101']]],
   [['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'PHYS110': 0, 'CHEM120': 3, 'MATH101': 0, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90}, [120, 120, 90, 120],
    [['coincidence', 'MATH101', 'CHEM120'], ['exclusion', 'CHEM120', 'MATH101H'],
     ['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']])],
 [('regression: period index base 1',
   [{'MATH101': 3, 'MATH101H': 1, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90}, [90, 180, 180, 120],
    [['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusion', 'CHEM120', 'PHYS110'], ['exclusion', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101'], ['exclusion', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
    ['exclusion', 'CHEM120', 'PHYS110']]),
  ('regression variant: period index base 2',
   [{'PHYS110': 0, 'MATH101': 2, 'CHEM120': 2, 'MATH101H': 0},
    {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120, 'CHEM120': 180}, [90, 180, 120, 90],
    [['exclusive', 'CHEM120', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'PHYS110'],
    ['exclusive', 'CHEM120', 'MATH101']]),
  ('partial repair guard 3',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 0, 'BIO130': 1, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 90, 'BIO130': 180}, [90, 90, 120, 120],
    [['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]),
  ('boundary control 4', [{'A': 2, 'B': 1}, {'A': 90, 'B': 90}, [90, 120, 120], [['after', 'A', 'B']]], []),
  ('normal control 5',
   [{'MATH101': 0, 'MATH101H': 1, 'PHYS110': 3}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [120, 90, 90, 180],
    [['after', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101', 'PHYS110'],
     ['coincidence', 'MATH101', 'MATH101H']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101': 2, 'CHEM120': 3, 'MATH101H': 3, 'PHYS110': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180}, [90, 120, 180, 90],
    [['coincidence', 'MATH101H', 'CHEM120'], ['exclusion', 'PHYS110', 'MATH101']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'MATH101H': 0, 'PHYS110': 1, 'CHEM120': 1, 'HIST140': 0, 'MATH101': 0, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 180},
    [180, 120, 120, 180], [['exclusion', 'CHEM120', 'BIO130'], ['coincidence', 'PHYS110', 'CHEM120']]],
   []),
  ('normal control 8',
   [{'PHYS110': 3, 'MATH101H': 2, 'CHEM120': 2, 'MATH101': 0},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120}, [180, 180, 180, 90],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'MATH101H', 'CHEM120'],
     ['after', 'CHEM120', 'MATH101H']]],
   [['duration', 'PHYS110'], ['after', 'CHEM120', 'MATH101H']])],
 [('regression: period index base 1',
   [{'CHEM120': 2, 'MATH101': 3, 'PHYS110': 2, 'MATH101H': 1},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 120}, [90, 180, 120, 90],
    [['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]],
   [['duration', 'MATH101'], ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'PHYS110', 'CHEM120']]),
  ('regression variant: period index base 2',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'CHEM120': 3, 'MATH101H': 1, 'MATH101': 0, 'BIO130': 3, 'PHYS110': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [120, 120, 120, 180],
    [['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'CHEM120', 'BIO130'],
     ['coincidence', 'BIO130', 'PHYS110']]],
   [['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'BIO130'], ['coincidence', 'BIO130', 'PHYS110']]),
  ('boundary control 4', [{'B': 0, 'A': 1}, {'A': 180, 'B': 180}, [120, 120], []],
   [['duration', 'A'], ['duration', 'B']]),
  ('normal control 5',
   [{'MATH101H': 1, 'MATH101': 0, 'PHYS110': 0, 'BIO130': 1, 'CHEM120': 3},
    {'MATH101': 120, 'MATH101H': 120, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'CHEM120', 'MATH101H'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]],
   [['exclusive', 'MATH101', 'BIO130'], ['after', 'MATH101', 'MATH101H']]),
  ('normal control 6',
   [{'MATH101H': 2, 'PHYS110': 3, 'CHEM120': 3, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 180}, [180, 120, 120, 120],
    [['exclusion', 'PHYS110', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'PHYS110']]),
  ('normal control 7',
   [{'BIO130': 1, 'PHYS110': 0, 'MATH101': 0, 'MATH101H': 1, 'CHEM120': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120, 'BIO130': 180}, [90, 90, 90, 120],
    [['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
     ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'],
    ['duration', 'PHYS110'], ['exclusive', 'MATH101', 'BIO130'], ['after', 'PHYS110', 'MATH101H'],
    ['exclusion', 'MATH101', 'PHYS110'], ['after', 'PHYS110', 'BIO130']]),
  ('normal control 8',
   [{'MATH101': 1, 'MATH101H': 2, 'PHYS110': 1, 'CHEM120': 1},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 120, 'CHEM120': 120}, [120, 90, 90, 180],
    [['exclusion', 'CHEM120', 'MATH101H']]],
   [['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110']])],
 [('regression: period index base 1',
   [{'HIST140': 1, 'CHEM120': 1, 'MATH101': 2, 'MATH101H': 3, 'PHYS110': 2, 'BIO130': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180, 'HIST140': 120},
    [90, 120, 90, 120],
    [['after', 'CHEM120', 'MATH101H'], ['coincidence', 'PHYS110', 'BIO130'], ['after', 'MATH101', 'HIST140'],
     ['coincidence', 'MATH101', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['after', 'CHEM120', 'MATH101H']]),
  ('regression variant: period index base 2',
   [{'MATH101': 1, 'CHEM120': 2, 'BIO130': 3, 'PHYS110': 3, 'MATH101H': 3},
    {'MATH101': 90, 'MATH101H': 90, 'PHYS110': 180, 'CHEM120': 120, 'BIO130': 180}, [180, 120, 180, 120],
    [['exclusion', 'CHEM120', 'MATH101H'], ['exclusive', 'BIO130', 'MATH101'],
     ['exclusion', 'BIO130', 'MATH101H'], ['exclusion', 'CHEM120', 'BIO130']]],
   [['duration', 'BIO130'], ['duration', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101'],
    ['exclusion', 'BIO130', 'MATH101H']]),
  ('partial repair guard 3',
   [{'MATH101H': 2, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101'],
     ['coincidence', 'MATH101H', 'MATH101']]],
   [['exclusion', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]),
  ('boundary control 4', [{'A': 0}, {'A': 120}, [120], []], []),
  ('normal control 5',
   [{'PHYS110': 1, 'CHEM120': 2, 'MATH101H': 2, 'MATH101': 2},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 90}, [120, 180, 180, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['coincidence', 'MATH101H', 'PHYS110'],
     ['coincidence', 'MATH101H', 'PHYS110'], ['exclusion', 'MATH101H', 'PHYS110']]],
   [['coincidence', 'MATH101H', 'PHYS110'], ['coincidence', 'MATH101H', 'PHYS110']]),
  ('normal control 6',
   [{'PHYS110': 1, 'MATH101H': 1, 'MATH101': 1}, {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90},
    [90, 90, 180, 120],
    [['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
     ['exclusive', 'MATH101H', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]],
   [['duration', 'MATH101'], ['exclusion', 'PHYS110', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('normal control 7',
   [{'MATH101H': 1, 'PHYS110': 0, 'MATH101': 2}, {'MATH101': 180, 'MATH101H': 90, 'PHYS110': 120},
    [90, 90, 120, 180],
    [['exclusive', 'MATH101', 'MATH101H'], ['coincidence', 'MATH101H', 'MATH101'],
     ['after', 'MATH101H', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['coincidence', 'MATH101H', 'MATH101']]),
  ('normal control 8',
   [{'MATH101H': 0, 'PHYS110': 0, 'CHEM120': 1, 'BIO130': 1, 'MATH101': 3},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90}, [180, 120, 120, 90],
    [['exclusive', 'MATH101', 'PHYS110']]],
   [['duration', 'MATH101']])],
 [('regression: period index base 1',
   [{'BIO130': 0, 'PHYS110': 3, 'MATH101': 1, 'CHEM120': 0, 'MATH101H': 1},
    {'MATH101': 180, 'MATH101H': 120, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [120, 120, 180, 90],
    [['coincidence', 'CHEM120', 'BIO130'], ['after', 'CHEM120', 'BIO130'],
     ['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'CHEM120', 'BIO130'],
    ['exclusive', 'MATH101H', 'MATH101']]),
  ('regression variant: period index base 2',
   [{'MATH101': 2, 'PHYS110': 3, 'MATH101H': 2}, {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180},
    [120, 180, 90, 180], [['exclusive', 'MATH101H', 'MATH101']]],
   [['duration', 'MATH101'], ['duration', 'MATH101H'], ['exclusive', 'MATH101H', 'MATH101']]),
  ('partial repair guard 3',
   [{'CHEM120': 1, 'MATH101': 1, 'PHYS110': 0, 'MATH101H': 2, 'BIO130': 1},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 180}, [180, 90, 120, 180],
    [['exclusion', 'CHEM120', 'PHYS110'], ['coincidence', 'MATH101', 'PHYS110'],
     ['exclusive', 'BIO130', 'MATH101H']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'],
    ['coincidence', 'MATH101', 'PHYS110'], ['exclusive', 'BIO130', 'MATH101H']]),
  ('boundary control 4', [{'A': 1, 'B': 1}, {'A': 90, 'B': 90}, [90, 120], [['after', 'A', 'B']]],
   [['after', 'A', 'B']]),
  ('normal control 5',
   [{'PHYS110': 1, 'MATH101': 2, 'CHEM120': 1, 'HIST140': 3, 'MATH101H': 3, 'BIO130': 2},
    {'MATH101': 120, 'MATH101H': 180, 'PHYS110': 90, 'CHEM120': 120, 'BIO130': 90, 'HIST140': 90},
    [120, 120, 120, 120],
    [['after', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]],
   [['duration', 'MATH101H'], ['after', 'MATH101', 'BIO130'], ['coincidence', 'MATH101', 'HIST140']]),
  ('normal control 6',
   [{'BIO130': 3, 'MATH101H': 0, 'CHEM120': 1, 'PHYS110': 0, 'MATH101': 2},
    {'MATH101': 90, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 180, 'BIO130': 180}, [90, 120, 120, 120],
    [['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
     ['coincidence', 'MATH101H', 'CHEM120']]],
   [['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101H'], ['duration', 'PHYS110'],
    ['coincidence', 'CHEM120', 'MATH101'], ['after', 'MATH101', 'BIO130'],
    ['coincidence', 'MATH101H', 'CHEM120']]),
  ('normal control 7',
   [{'CHEM120': 2, 'BIO130': 3, 'MATH101H': 2, 'MATH101': 3, 'PHYS110': 3},
    {'MATH101': 180, 'MATH101H': 180, 'PHYS110': 180, 'CHEM120': 90, 'BIO130': 90}, [180, 120, 180, 120],
    [['after', 'MATH101H', 'MATH101'], ['after', 'CHEM120', 'PHYS110']]],
   [['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101H', 'MATH101'],
    ['after', 'CHEM120', 'PHYS110']]),
  ('normal control 8',
   [{'HIST140': 2, 'MATH101': 1, 'CHEM120': 3, 'PHYS110': 3, 'MATH101H': 2, 'BIO130': 3},
    {'MATH101': 120, 'MATH101H': 90, 'PHYS110': 90, 'CHEM120': 90, 'BIO130': 90, 'HIST140': 120},
    [90, 90, 120, 90],
    [['after', 'HIST140', 'MATH101H'], ['exclusion', 'HIST140', 'BIO130'], ['after', 'HIST140', 'MATH101']]],
   [['duration', 'MATH101'], ['after', 'HIST140', 'MATH101H']])]]
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)
Boundary fixtureActualExpectedOutcome
regression: period index base 1[][]Passed
regression variant: period index base 2[['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']][['duration', 'BIO130'], ['coincidence', 'MATH101H', 'CHEM120'], ['coincidence', 'PHYS110', 'BIO130']]Passed
partial repair guard 3[['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['coincidence', 'MATH101', 'MATH101H']][['duration', 'BIO130'], ['duration', 'CHEM120'], ['duration', 'MATH101'], ['duration', 'MATH101H'], ['coincidence', 'MATH101', 'MATH101H']]Passed
normal control 4[['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']][['duration', 'MATH101H'], ['exclusive', 'CHEM120', 'MATH101'], ['coincidence', 'PHYS110', 'MATH101']]Passed
normal control 5[['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']][['duration', 'BIO130'], ['duration', 'MATH101'], ['duration', 'PHYS110'], ['after', 'MATH101', 'MATH101H'], ['exclusive', 'MATH101H', 'BIO130'], ['after', 'MATH101', 'CHEM120']]Passed
normal control 6[['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['after', 'MATH101', 'CHEM120']]Passed
normal control 7[['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']][['duration', 'BIO130'], ['duration', 'MATH101H'], ['after', 'MATH101H', 'MATH101']]Passed
normal control 8[['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']][['duration', 'MATH101'], ['coincidence', 'MATH101', 'CHEM120']]Passed

SHA-256 / 01690b330ecb8f90289713d517925eabd870571c76643eabf303273b3c100921

Verification & scope

Stipulated toy exam-timetabling rule set for a bounded model; it does not claim conformance with any institution's regulations or a benchmark specification, and it performs no search or optimisation. This reproducer isolates one failure mechanism. Results cover the supplied fixtures. Variants within a family share a test contract and should remain grouped when constructing evaluation splits. Related mechanisms with a shared evaluation_group must also remain together; these controlled models are not independent production incidents.

Observations recorded using Python 3.12.14 at 2026-09-29T14:52:04.856472+00:00.

Case digest / e58ebe7c898a843696e1725834c010451fd32373e9c5e44d397098a527250621