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

N = 1
observations = []
def solve(cph, band, setpoint, temps):
    period = 60 // cph
    out = []
    on_left = 0
    for minute, temp in enumerate(temps):
        if minute % period == 0:
            err = setpoint - temp
            num = max(0, min(err, band)) * period
            on = (2 * num + band) // (2 * band)
            if 0 < on < 2:
                on = 2
            if 0 < period - on < 2:
                on = period
            on_left = on
        if on_left > 0:
            on_left -= 1
        out.append(on_left > 0)
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [4,
    10,
    700,
    [673,
     669,
     665,
     669,
     667,
     665,
     664,
     662,
     659,
     662,
     661,
     659,
     660,
     656,
     659,
     660,
     656,
     652,
     654,
     652,
     656,
     657,
     653,
     653,
     653,
     653,
     654,
     653,
     650,
     650,
     650,
     650,
     651,
     654,
     651,
     650,
     650,
     650,
     650]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 2',
   [6,
    30,
    700,
    [697,
     695,
     691,
     695,
     691,
     692,
     693,
     692,
     690,
     690,
     690,
     687,
     684,
     683,
     687,
     688,
     688,
     691,
     690,
     692,
     693,
     689,
     692]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 3',
   [7,
    30,
    700,
    [693,
     691,
     695,
     691,
     695,
     698,
     697,
     700,
     702,
     704,
     706,
     708,
     709,
     707,
     706,
     702,
     702,
     701,
     698,
     701,
     700,
     704,
     703,
     702,
     702,
     699,
     695,
     694,
     696,
     699,
     696,
     692,
     694,
     693,
     694,
     697,
     700]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False]],
  ['regression: scenario 4',
   [4,
    10,
    700,
    [680,
     684,
     685,
     683,
     684,
     685,
     686,
     682,
     681,
     679,
     677,
     681,
     680,
     681,
     677,
     681,
     680,
     682,
     682,
     678,
     677,
     673,
     672,
     676,
     673,
     670,
     669,
     665,
     662]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [6,
    30,
    700,
    [690,
     689,
     690,
     691,
     689,
     685,
     682,
     686,
     682,
     680,
     684,
     687,
     690,
     693,
     692,
     689,
     688,
     685,
     683,
     685,
     687,
     683,
     684,
     688,
     691,
     689,
     686,
     683,
     679,
     679,
     682,
     680,
     680,
     684]],
   [True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True]],
  ['regression: scenario 2',
   [6,
    10,
    700,
    [686,
     687,
     685,
     682,
     682,
     678,
     681,
     677,
     676,
     673,
     674,
     676,
     672,
     670,
     669,
     673,
     674,
     676,
     675,
     673,
     675,
     672,
     673,
     674,
     670,
     672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 3',
   [6,
    20,
    700,
    [676,
     675,
     678,
     682,
     680,
     684,
     682,
     684,
     686,
     684,
     681,
     678,
     681,
     682,
     679,
     680,
     684,
     681,
     679,
     679,
     681,
     684,
     680,
     683]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    30,
    700,
    [705,
     708,
     704,
     703,
     700,
     701,
     701,
     702,
     699,
     698,
     698,
     697,
     698,
     702,
     699,
     700,
     701,
     697,
     700,
     697,
     694,
     695,
     696]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]]],
 [['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 1',
   [7,
    20,
    700,
    [688,
     691,
     689,
     691,
     692,
     691,
     687,
     691,
     692,
     691,
     695,
     695,
     692,
     689,
     688,
     684,
     682,
     681,
     679,
     678,
     682,
     682,
     680,
     682,
     686,
     689,
     687,
     687,
     690,
     686,
     687,
     691]],
   [True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False]],
  ['regression: scenario 2',
   [9,
    20,
    700,
    [702,
     703,
     707,
     703,
     700,
     697,
     699,
     698,
     696,
     693,
     696,
     695,
     694,
     690,
     692,
     695,
     697,
     700,
     698,
     699,
     701,
     704,
     708,
     712,
     710,
     709,
     713,
     709,
     710,
     714,
     711,
     711,
     707,
     706,
     706]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 3',
   [7,
    30,
    700,
    [701,
     704,
     708,
     708,
     709,
     711,
     707,
     709,
     710,
     706,
     707,
     703,
     701,
     697,
     697,
     698,
     698,
     701,
     700,
     699,
     699,
     695,
     696,
     700,
     698,
     701,
     700]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 4',
   [4,
    30,
    700,
    [675,
     676,
     675,
     674,
     673,
     676,
     674,
     672,
     673,
     672,
     674,
     677,
     674,
     671,
     668,
     664,
     668,
     667,
     668,
     670,
     668,
     670,
     672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [6,
    10,
    700,
    [702,
     699,
     703,
     707,
     704,
     708,
     705,
     701,
     698,
     700,
     703,
     703,
     700,
     697,
     696,
     697,
     697,
     701,
     703,
     703,
     704,
     705,
     708,
     704,
     706,
     705,
     702,
     706,
     707,
     704,
     708,
     707,
     703,
     706,
     707,
     703,
     703,
     706,
     707,
     706]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 2',
   [3,
    20,
    700,
    [682, 683, 684, 687, 687, 686, 682, 683, 680, 676, 680, 683, 679, 675, 674, 671, 671, 672, 670, 672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False]],
  ['regression: scenario 3',
   [4,
    10,
    700,
    [669,
     665,
     661,
     664,
     661,
     660,
     663,
     662,
     660,
     664,
     667,
     671,
     672,
     671,
     670,
     673,
     676,
     677,
     680,
     677,
     677,
     680,
     677,
     680,
     677,
     673,
     676,
     677,
     679,
     678,
     682,
     683,
     680,
     679,
     683,
     682,
     686]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    10,
    700,
    [676,
     679,
     677,
     681,
     677,
     677,
     676,
     672,
     671,
     675,
     675,
     674,
     675,
     677,
     675,
     677,
     673,
     671,
     671,
     674,
     675,
     677,
     678,
     681,
     680,
     684,
     688,
     684,
     683,
     681,
     680,
     679,
     682,
     679]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: scenario 1',
   [5,
    10,
    700,
    [698,
     700,
     702,
     701,
     700,
     700,
     699,
     697,
     694,
     696,
     698,
     694,
     697,
     697,
     694,
     698,
     700,
     698,
     699,
     700,
     703,
     707,
     708,
     706,
     708,
     712,
     710,
     706,
     702,
     700,
     696,
     696,
     692]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 3',
   [4,
    30,
    700,
    [693,
     696,
     695,
     696,
     695,
     694,
     690,
     686,
     682,
     681,
     683,
     685,
     681,
     677,
     673,
     671,
     674,
     672,
     668,
     671,
     668,
     668,
     672,
     672,
     674,
     677,
     680,
     676,
     673,
     675,
     677,
     673,
     671,
     670,
     672,
     668,
     666]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 2',
   [3,
    10,
    700,
    [669,
     665,
     665,
     665,
     666,
     665,
     663,
     665,
     667,
     665,
     667,
     663,
     663,
     667,
     667,
     668,
     664,
     664,
     664,
     663,
     661,
     661,
     661,
     664,
     666,
     664,
     668]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    20,
    700,
    [674, 675, 677, 675, 674, 677, 678, 682, 686, 686, 683, 687, 689, 690, 687, 684, 683, 687, 683, 683]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    True,
    True]]]]
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(cph, band, setpoint, temps):
    period = 60 // cph
    out = []
    on_left = 0
    for minute, temp in enumerate(temps):
        if minute % period == 0:
            err = setpoint - temp
            num = max(0, min(err, band)) * period
            on = (2 * num + band) // (2 * band)
            if 0 < on < 2:
                on = 2
            if 0 < period - on < 2:
                on = period
            on_left = on
        out.append(on_left >= 0)
        if on_left > 0:
            on_left -= 1
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [4,
    10,
    700,
    [673,
     669,
     665,
     669,
     667,
     665,
     664,
     662,
     659,
     662,
     661,
     659,
     660,
     656,
     659,
     660,
     656,
     652,
     654,
     652,
     656,
     657,
     653,
     653,
     653,
     653,
     654,
     653,
     650,
     650,
     650,
     650,
     651,
     654,
     651,
     650,
     650,
     650,
     650]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 2',
   [6,
    30,
    700,
    [697,
     695,
     691,
     695,
     691,
     692,
     693,
     692,
     690,
     690,
     690,
     687,
     684,
     683,
     687,
     688,
     688,
     691,
     690,
     692,
     693,
     689,
     692]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 3',
   [7,
    30,
    700,
    [693,
     691,
     695,
     691,
     695,
     698,
     697,
     700,
     702,
     704,
     706,
     708,
     709,
     707,
     706,
     702,
     702,
     701,
     698,
     701,
     700,
     704,
     703,
     702,
     702,
     699,
     695,
     694,
     696,
     699,
     696,
     692,
     694,
     693,
     694,
     697,
     700]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False]],
  ['regression: scenario 4',
   [4,
    10,
    700,
    [680,
     684,
     685,
     683,
     684,
     685,
     686,
     682,
     681,
     679,
     677,
     681,
     680,
     681,
     677,
     681,
     680,
     682,
     682,
     678,
     677,
     673,
     672,
     676,
     673,
     670,
     669,
     665,
     662]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [6,
    30,
    700,
    [690,
     689,
     690,
     691,
     689,
     685,
     682,
     686,
     682,
     680,
     684,
     687,
     690,
     693,
     692,
     689,
     688,
     685,
     683,
     685,
     687,
     683,
     684,
     688,
     691,
     689,
     686,
     683,
     679,
     679,
     682,
     680,
     680,
     684]],
   [True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True]],
  ['regression: scenario 2',
   [6,
    10,
    700,
    [686,
     687,
     685,
     682,
     682,
     678,
     681,
     677,
     676,
     673,
     674,
     676,
     672,
     670,
     669,
     673,
     674,
     676,
     675,
     673,
     675,
     672,
     673,
     674,
     670,
     672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 3',
   [6,
    20,
    700,
    [676,
     675,
     678,
     682,
     680,
     684,
     682,
     684,
     686,
     684,
     681,
     678,
     681,
     682,
     679,
     680,
     684,
     681,
     679,
     679,
     681,
     684,
     680,
     683]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    30,
    700,
    [705,
     708,
     704,
     703,
     700,
     701,
     701,
     702,
     699,
     698,
     698,
     697,
     698,
     702,
     699,
     700,
     701,
     697,
     700,
     697,
     694,
     695,
     696]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]]],
 [['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 1',
   [7,
    20,
    700,
    [688,
     691,
     689,
     691,
     692,
     691,
     687,
     691,
     692,
     691,
     695,
     695,
     692,
     689,
     688,
     684,
     682,
     681,
     679,
     678,
     682,
     682,
     680,
     682,
     686,
     689,
     687,
     687,
     690,
     686,
     687,
     691]],
   [True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False]],
  ['regression: scenario 2',
   [9,
    20,
    700,
    [702,
     703,
     707,
     703,
     700,
     697,
     699,
     698,
     696,
     693,
     696,
     695,
     694,
     690,
     692,
     695,
     697,
     700,
     698,
     699,
     701,
     704,
     708,
     712,
     710,
     709,
     713,
     709,
     710,
     714,
     711,
     711,
     707,
     706,
     706]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 3',
   [7,
    30,
    700,
    [701,
     704,
     708,
     708,
     709,
     711,
     707,
     709,
     710,
     706,
     707,
     703,
     701,
     697,
     697,
     698,
     698,
     701,
     700,
     699,
     699,
     695,
     696,
     700,
     698,
     701,
     700]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False]],
  ['regression: scenario 4',
   [4,
    30,
    700,
    [675,
     676,
     675,
     674,
     673,
     676,
     674,
     672,
     673,
     672,
     674,
     677,
     674,
     671,
     668,
     664,
     668,
     667,
     668,
     670,
     668,
     670,
     672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 1',
   [6,
    10,
    700,
    [702,
     699,
     703,
     707,
     704,
     708,
     705,
     701,
     698,
     700,
     703,
     703,
     700,
     697,
     696,
     697,
     697,
     701,
     703,
     703,
     704,
     705,
     708,
     704,
     706,
     705,
     702,
     706,
     707,
     704,
     708,
     707,
     703,
     706,
     707,
     703,
     703,
     706,
     707,
     706]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 2',
   [3,
    20,
    700,
    [682, 683, 684, 687, 687, 686, 682, 683, 680, 676, 680, 683, 679, 675, 674, 671, 671, 672, 670, 672]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False]],
  ['regression: scenario 3',
   [4,
    10,
    700,
    [669,
     665,
     661,
     664,
     661,
     660,
     663,
     662,
     660,
     664,
     667,
     671,
     672,
     671,
     670,
     673,
     676,
     677,
     680,
     677,
     677,
     680,
     677,
     680,
     677,
     673,
     676,
     677,
     679,
     678,
     682,
     683,
     680,
     679,
     683,
     682,
     686]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    10,
    700,
    [676,
     679,
     677,
     681,
     677,
     677,
     676,
     672,
     671,
     675,
     675,
     674,
     675,
     677,
     675,
     677,
     673,
     671,
     671,
     674,
     675,
     677,
     678,
     681,
     680,
     684,
     688,
     684,
     683,
     681,
     680,
     679,
     682,
     679]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]]],
 [['regression: scenario 1',
   [5,
    10,
    700,
    [698,
     700,
     702,
     701,
     700,
     700,
     699,
     697,
     694,
     696,
     698,
     694,
     697,
     697,
     694,
     698,
     700,
     698,
     699,
     700,
     703,
     707,
     708,
     706,
     708,
     712,
     710,
     706,
     702,
     700,
     696,
     696,
     692]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 3',
   [4,
    30,
    700,
    [693,
     696,
     695,
     696,
     695,
     694,
     690,
     686,
     682,
     681,
     683,
     685,
     681,
     677,
     673,
     671,
     674,
     672,
     668,
     671,
     668,
     668,
     672,
     672,
     674,
     677,
     680,
     676,
     673,
     675,
     677,
     673,
     671,
     670,
     672,
     668,
     666]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: three cycles',
   [5,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     700,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681,
     681]],
   [True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: seven cycles per hour',
   [7,
    20,
    700,
    [690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     690,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     685,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    True,
    True,
    False]],
  ['regression: tiny error',
   [6,
    30,
    700,
    [696, 696, 696, 696, 696, 696, 696, 696, 696, 696, 698, 698, 698, 698, 698, 698, 698, 698, 698, 698]],
   [True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: above setpoint',
   [4,
    10,
    700,
    [705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     705,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695,
     695]],
   [False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    False,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    False,
    False,
    False,
    False]],
  ['regression: scenario 2',
   [3,
    10,
    700,
    [669,
     665,
     665,
     665,
     666,
     665,
     663,
     665,
     667,
     665,
     667,
     663,
     663,
     667,
     667,
     668,
     664,
     664,
     664,
     663,
     661,
     661,
     661,
     664,
     666,
     664,
     668]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True]],
  ['regression: scenario 4',
   [9,
    20,
    700,
    [674, 675, 677, 675, 674, 677, 678, 682, 686, 686, 683, 687, 689, 690, 687, 684, 683, 687, 683, 683]],
   [True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    True,
    False,
    False,
    False,
    True,
    True]]]]
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:
Every on period is one minute shorter than computed.

Time-proportioning heating thermostat with a cycles-per-hour setting, sampled per minute. The cycle length is 60 // cph minutes. At each cycle start the error (setpoint - temp) is clamped to 0..band and the on time is error/band of the cycle rounded half up; an on time of 1 minute is extended to the 2-minute minimum, and an off time of 1 minute is eliminated (full on). The output is on for the first on-time minutes of the cycle. Return the heat output per minute.

split: open-access


prompt:
Recovery starts a minute late whenever the required time is fractional and the space is short of setpoint at occupancy.

Optimal start for a heating setback, sampled per minute from minute 0; rate is the recovery rate in tenths F per hour. While not recovering, required minutes = ceil(max(0, occ_sp - temp) * 60 / rate); recovery starts (and latches) when minutes left until occupancy <= required, but never more than 180 minutes early, and in any case at occupancy. Return the active setpoint per minute.

split: open-access


prompt:
After a very cold night the system starts recovering many hours before occupancy.

Optimal start for a heating setback, sampled per minute from minute 0; rate is the recovery rate in tenths F per hour. While not recovering, required minutes = ceil(max(0, occ_sp - temp) * 60 / rate); recovery starts (and latches) when minutes left until occupancy <= required, but never more than 180 minutes early, and in any case at occupancy. Return the active setpoint per minute.

split: open-access


prompt:
The setpoint oscillates between occupied and setback during recovery.

Optimal start for a heating setback, sampled per minute from minute 0; rate is the recovery rate in tenths F per hour. While not recovering, required minutes = ceil(max(0, occ_sp - temp) * 60 / rate); recovery starts (and latches) when minutes left until occupancy <= required, but never more than 180 minutes early, and in any case at occupancy. Return the active setpoint per minute.

split: open-access


prompt:
Recovery starts only minutes before occupancy and the space is cold when people arrive.

Optimal start for a heating setback, sampled per minute from minute 0; rate is the recovery rate in tenths F per hour. While not recovering, required minutes = ceil(max(0, occ_sp - temp) * 60 / rate); recovery starts (and latches) when minutes left until occupancy <= required, but never more than 180 minutes early, and in any case at occupancy. Return the active setpoint per minute.

split: open-access


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

N = 1
observations = []
def solve(valve_type, samples):
    valve = False
    out = []
    for call in samples:
        if call is None:
            out.append([False, valve])
            continue
        want = (call == 'heat') if valve_type == 'O' else (call == 'cool')
        changed = want != valve
        valve = want
        out.append([not changed, valve])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', None, None, 'cool', 'cool', 'heat', 'heat', 'heat', 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [True, True],
    [True, True]]],
  ['regression: scenario 2',
   ['B',
    ['heat',
     'heat',
     'cool',
     'cool',
     'heat',
     None,
     'heat',
     'cool',
     'heat',
     'heat',
     'cool',
     None,
     'heat',
     'cool']],
   [[False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', 'cool', 'heat', None, None, 'heat', 'cool', 'heat', 'heat', None, 'heat', 'heat']],
   [[False, True],
    [True, True],
    [True, True],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False]]],
  ['regression: scenario 4',
   ['B', [None, 'heat', 'cool', 'cool', 'cool', 'cool', 'heat', 'heat', None, 'cool']],
   [[False, False],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, False]]]],
 [['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: scenario 1',
   ['B', [None, None, 'heat', None, 'cool', 'cool', 'cool', 'heat', None, 'cool', None]],
   [[False, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', ['heat', 'cool', 'heat', None, 'cool', 'heat', None, 'heat', None, 'cool', None]],
   [[False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [True, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['B', [None, 'heat', None, None, None, None, 'cool', 'heat', 'heat', None]],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, True]]],
  ['regression: scenario 4',
   ['B', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat']],
   [[False, True], [False, False], [True, False], [False, True], [True, True], [False, True], [True, True]]]],
 [['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', 'cool', 'cool', None, 'cool', 'heat', 'heat', None, None, 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [True, True]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['O', [None, 'cool', 'heat', 'cool', 'heat', 'heat']],
   [[False, False], [False, True], [False, False], [False, True], [False, False], [True, False]]],
  ['regression: scenario 3',
   ['B', ['cool', 'heat', None, None, None, 'heat', 'heat', 'cool']],
   [[True, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, False]]],
  ['regression: scenario 4',
   ['O', ['heat', 'heat', 'heat', 'heat', 'heat', 'cool', None, 'cool', 'cool', None]],
   [[True, False],
    [True, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, True]]]],
 [['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 7',
   ['B', ['heat', 'heat', None, None, 'cool', None, 'cool', None, 'cool', None, None, None, 'heat', 'cool']],
   [[False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, False],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', 'cool', None, 'cool', None, None, 'cool']],
   [[True, False], [False, True], [False, True], [True, True], [False, True], [False, True], [True, True]]],
  ['regression: scenario 2',
   ['B', ['cool', 'cool', 'heat', None, 'cool', 'cool', None, 'cool']],
   [[True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'heat', 'cool', 'heat', None, 'heat', None, 'heat']],
   [[False, True],
    [True, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]]],
 [['regression: scenario 1',
   ['O', ['heat', None, 'cool', None, 'heat', 'cool', 'heat', 'cool', None, None, None]],
   [[True, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True]]],
  ['regression: scenario 7',
   ['B', ['heat', 'heat', 'cool', None, 'cool', 'heat', 'cool', 'heat', 'heat', 'cool', None]],
   [[False, True],
    [True, True],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', [None, None, None, None, 'cool', None, 'heat', 'cool', None]],
   [[False, False],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['O', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat', None, 'heat', 'heat', 'cool', 'cool']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True]]]]]
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(valve_type, samples):
    valve = False
    out = []
    for call in samples:
        if call is None:
            out.append([False, valve])
            continue
        want = call == 'cool'
        changed = want != valve
        valve = want
        out.append([not changed, valve])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', None, None, 'cool', 'cool', 'heat', 'heat', 'heat', 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [True, True],
    [True, True]]],
  ['regression: scenario 2',
   ['B',
    ['heat',
     'heat',
     'cool',
     'cool',
     'heat',
     None,
     'heat',
     'cool',
     'heat',
     'heat',
     'cool',
     None,
     'heat',
     'cool']],
   [[False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', 'cool', 'heat', None, None, 'heat', 'cool', 'heat', 'heat', None, 'heat', 'heat']],
   [[False, True],
    [True, True],
    [True, True],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False]]],
  ['regression: scenario 4',
   ['B', [None, 'heat', 'cool', 'cool', 'cool', 'cool', 'heat', 'heat', None, 'cool']],
   [[False, False],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, False]]]],
 [['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: scenario 1',
   ['B', [None, None, 'heat', None, 'cool', 'cool', 'cool', 'heat', None, 'cool', None]],
   [[False, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', ['heat', 'cool', 'heat', None, 'cool', 'heat', None, 'heat', None, 'cool', None]],
   [[False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [True, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['B', [None, 'heat', None, None, None, None, 'cool', 'heat', 'heat', None]],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, True]]],
  ['regression: scenario 4',
   ['B', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat']],
   [[False, True], [False, False], [True, False], [False, True], [True, True], [False, True], [True, True]]]],
 [['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', 'cool', 'cool', None, 'cool', 'heat', 'heat', None, None, 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [True, True]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['O', [None, 'cool', 'heat', 'cool', 'heat', 'heat']],
   [[False, False], [False, True], [False, False], [False, True], [False, False], [True, False]]],
  ['regression: scenario 3',
   ['B', ['cool', 'heat', None, None, None, 'heat', 'heat', 'cool']],
   [[True, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, False]]],
  ['regression: scenario 4',
   ['O', ['heat', 'heat', 'heat', 'heat', 'heat', 'cool', None, 'cool', 'cool', None]],
   [[True, False],
    [True, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, True]]]],
 [['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 7',
   ['B', ['heat', 'heat', None, None, 'cool', None, 'cool', None, 'cool', None, None, None, 'heat', 'cool']],
   [[False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, False],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', 'cool', None, 'cool', None, None, 'cool']],
   [[True, False], [False, True], [False, True], [True, True], [False, True], [False, True], [True, True]]],
  ['regression: scenario 2',
   ['B', ['cool', 'cool', 'heat', None, 'cool', 'cool', None, 'cool']],
   [[True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'heat', 'cool', 'heat', None, 'heat', None, 'heat']],
   [[False, True],
    [True, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]]],
 [['regression: scenario 1',
   ['O', ['heat', None, 'cool', None, 'heat', 'cool', 'heat', 'cool', None, None, None]],
   [[True, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True]]],
  ['regression: scenario 7',
   ['B', ['heat', 'heat', 'cool', None, 'cool', 'heat', 'cool', 'heat', 'heat', 'cool', None]],
   [[False, True],
    [True, True],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['regression: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', [None, None, None, None, 'cool', None, 'heat', 'cool', None]],
   [[False, False],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['O', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat', None, 'heat', 'heat', 'cool', 'cool']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True]]]]]
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:
An O-type heat pump blows cold air on a heating call.

Heat pump reversing valve output (O/B terminal) and compressor per sample; samples are the call (heat, cool or None). An O-type valve is energized for cooling, a B-type for heating. The valve is de-energized at power-up and holds its last position while idle. On a sample where the valve changes position the compressor waits (off) for pressure equalization. Return [compressor, valve_energized].

split: open-access


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

N = 1
observations = []
def solve(valve_type, samples):
    valve = False
    out = []
    for call in samples:
        if call is None:
            valve = False
            out.append([False, valve])
            continue
        want = (call == 'cool') if valve_type == 'O' else (call == 'heat')
        changed = want != valve
        valve = want
        out.append([not changed, valve])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', None, None, 'cool', 'cool', 'heat', 'heat', 'heat', 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [True, True],
    [True, True]]],
  ['regression: scenario 2',
   ['B',
    ['heat',
     'heat',
     'cool',
     'cool',
     'heat',
     None,
     'heat',
     'cool',
     'heat',
     'heat',
     'cool',
     None,
     'heat',
     'cool']],
   [[False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['control: scenario 3',
   ['O', ['cool', 'cool', 'cool', 'heat', None, None, 'heat', 'cool', 'heat', 'heat', None, 'heat', 'heat']],
   [[False, True],
    [True, True],
    [True, True],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False]]],
  ['regression: scenario 4',
   ['B', [None, 'heat', 'cool', 'cool', 'cool', 'cool', 'heat', 'heat', None, 'cool']],
   [[False, False],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, False]]]],
 [['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: scenario 1',
   ['B', [None, None, 'heat', None, 'cool', 'cool', 'cool', 'heat', None, 'cool', None]],
   [[False, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', ['heat', 'cool', 'heat', None, 'cool', 'heat', None, 'heat', None, 'cool', None]],
   [[False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [True, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['B', [None, 'heat', None, None, None, None, 'cool', 'heat', 'heat', None]],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, True]]],
  ['regression: scenario 4',
   ['B', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat']],
   [[False, True], [False, False], [True, False], [False, True], [True, True], [False, True], [True, True]]]],
 [['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', 'cool', 'cool', None, 'cool', 'heat', 'heat', None, None, 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [True, True]]],
  ['regression: scenario 3',
   ['B', ['cool', 'heat', None, None, None, 'heat', 'heat', 'cool']],
   [[True, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['control: scenario 2',
   ['O', [None, 'cool', 'heat', 'cool', 'heat', 'heat']],
   [[False, False], [False, True], [False, False], [False, True], [False, False], [True, False]]],
  ['regression: scenario 4',
   ['O', ['heat', 'heat', 'heat', 'heat', 'heat', 'cool', None, 'cool', 'cool', None]],
   [[True, False],
    [True, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, True]]]],
 [['regression: scenario 2',
   ['B', ['cool', 'cool', 'heat', None, 'cool', 'cool', None, 'cool']],
   [[True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'heat', 'cool', 'heat', None, 'heat', None, 'heat']],
   [[False, True],
    [True, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', 'cool', None, 'cool', None, None, 'cool']],
   [[True, False], [False, True], [False, True], [True, True], [False, True], [False, True], [True, True]]],
  ['regression: scenario 4',
   ['O', ['cool', None, None, 'heat', 'cool', None, 'heat', None, None, 'cool', 'cool']],
   [[False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False],
    [False, False],
    [False, True],
    [True, True]]]],
 [['regression: scenario 5',
   ['O', [None, 'cool', None, None, 'heat', 'cool', 'heat', None, 'cool', 'heat']],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: scenario 8',
   ['B',
    [None,
     'heat',
     'heat',
     'cool',
     'heat',
     'heat',
     'heat',
     'cool',
     'cool',
     'cool',
     'heat',
     'heat',
     None,
     None]],
   [[False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [True, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', None, 'cool', None, 'heat', 'cool', 'heat', 'cool', None, None, None]],
   [[True, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True]]],
  ['control: scenario 2',
   ['B', [None, None, None, None, 'cool', None, 'heat', 'cool', None]],
   [[False, False],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [False, True],
    [False, False],
    [False, False]]]]]
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(valve_type, samples):
    valve = False
    out = []
    for call in samples:
        if call is None:
            out.append([False, False])
            continue
        want = (call == 'cool') if valve_type == 'O' else (call == 'heat')
        changed = want != valve
        valve = want
        out.append([not changed, valve])
    return out
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', None, None, 'cool', 'cool', 'heat', 'heat', 'heat', 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [True, True],
    [True, True]]],
  ['regression: scenario 2',
   ['B',
    ['heat',
     'heat',
     'cool',
     'cool',
     'heat',
     None,
     'heat',
     'cool',
     'heat',
     'heat',
     'cool',
     None,
     'heat',
     'cool']],
   [[False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['control: scenario 3',
   ['O', ['cool', 'cool', 'cool', 'heat', None, None, 'heat', 'cool', 'heat', 'heat', None, 'heat', 'heat']],
   [[False, True],
    [True, True],
    [True, True],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [True, False]]],
  ['regression: scenario 4',
   ['B', [None, 'heat', 'cool', 'cool', 'cool', 'cool', 'heat', 'heat', None, 'cool']],
   [[False, False],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, False]]]],
 [['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['regression: scenario 1',
   ['B', [None, None, 'heat', None, 'cool', 'cool', 'cool', 'heat', None, 'cool', None]],
   [[False, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 2',
   ['B', ['heat', 'cool', 'heat', None, 'cool', 'heat', None, 'heat', None, 'cool', None]],
   [[False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [True, True],
    [False, True],
    [False, False],
    [False, False]]],
  ['regression: scenario 3',
   ['B', [None, 'heat', None, None, None, None, 'cool', 'heat', 'heat', None]],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [True, True],
    [False, True]]],
  ['regression: scenario 4',
   ['B', ['heat', 'cool', 'cool', 'heat', 'heat', None, 'heat']],
   [[False, True], [False, False], [True, False], [False, True], [True, True], [False, True], [True, True]]]],
 [['regression: scenario 1',
   ['B', ['cool', 'heat', 'heat', 'cool', 'cool', None, 'cool', 'heat', 'heat', None, None, 'heat']],
   [[True, False],
    [False, True],
    [True, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True],
    [True, True]]],
  ['regression: scenario 3',
   ['B', ['cool', 'heat', None, None, None, 'heat', 'heat', 'cool']],
   [[True, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['control: scenario 2',
   ['O', [None, 'cool', 'heat', 'cool', 'heat', 'heat']],
   [[False, False], [False, True], [False, False], [False, True], [False, False], [True, False]]],
  ['regression: scenario 4',
   ['O', ['heat', 'heat', 'heat', 'heat', 'heat', 'cool', None, 'cool', 'cool', None]],
   [[True, False],
    [True, False],
    [True, False],
    [True, False],
    [True, False],
    [False, True],
    [False, True],
    [True, True],
    [True, True],
    [False, True]]]],
 [['regression: scenario 2',
   ['B', ['cool', 'cool', 'heat', None, 'cool', 'cool', None, 'cool']],
   [[True, False],
    [True, False],
    [False, True],
    [False, True],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: scenario 3',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'heat', 'cool', 'heat', None, 'heat', None, 'heat']],
   [[False, True],
    [True, True],
    [False, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [True, False]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', 'cool', None, 'cool', None, None, 'cool']],
   [[True, False], [False, True], [False, True], [True, True], [False, True], [False, True], [True, True]]],
  ['regression: scenario 4',
   ['O', ['cool', None, None, 'heat', 'cool', None, 'heat', None, None, 'cool', 'cool']],
   [[False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, False],
    [False, False],
    [False, True],
    [True, True]]]],
 [['regression: scenario 5',
   ['O', [None, 'cool', None, None, 'heat', 'cool', 'heat', None, 'cool', 'heat']],
   [[False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, False],
    [False, True],
    [False, False]]],
  ['regression: scenario 8',
   ['B',
    [None,
     'heat',
     'heat',
     'cool',
     'heat',
     'heat',
     'heat',
     'cool',
     'cool',
     'cool',
     'heat',
     'heat',
     None,
     None]],
   [[False, False],
    [False, True],
    [True, True],
    [False, False],
    [False, True],
    [True, True],
    [True, True],
    [False, False],
    [True, False],
    [True, False],
    [False, True],
    [True, True],
    [False, True],
    [False, True]]],
  ['regression: O valve season change',
   ['O', ['cool', 'cool', None, 'heat', 'heat', 'cool']],
   [[False, True], [True, True], [False, True], [False, False], [True, False], [False, True]]],
  ['regression: B valve idle hold',
   ['B', ['heat', None, 'heat']],
   [[False, True], [False, True], [True, True]]],
  ['control: first call heat on O',
   ['O', ['heat', 'heat', None, 'cool']],
   [[True, False], [True, False], [False, False], [False, True]]],
  ['control: first call cool on B',
   ['B', ['cool', None, 'cool', 'heat']],
   [[True, False], [False, False], [True, False], [False, True]]],
  ['regression: scenario 1',
   ['O', ['heat', None, 'cool', None, 'heat', 'cool', 'heat', 'cool', None, None, None]],
   [[True, False],
    [False, False],
    [False, True],
    [False, True],
    [False, False],
    [False, True],
    [False, False],
    [False, True],
    [False, True],
    [False, True],
    [False, True]]],
  ['control: scenario 2',
   ['B', [None, None, None, None, 'cool', None, 'heat', 'cool', None]],
   [[False, False],
    [False, False],
    [False, False],
    [False, False],
    [True, False],
    [False, False],
    [False, True],
    [False, False],
    [False, False]]]]]
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:
The valve clicks over at the end of every cooling call and must shift back (with an equalization delay) on the next call.

Heat pump reversing valve output (O/B terminal) and compressor per sample; samples are the call (heat, cool or None). An O-type valve is energized for cooling, a B-type for heating. The valve is de-energized at power-up and holds its last position while idle. On a sample where the valve changes position the compressor waits (off) for pressure equalization. Return [compressor, valve_energized].

split: open-access