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

N = 1
observations = []
def solve(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32: return 'ERR_OVERWEIGHT_%d' % i
    free = 1 if x['elite'] else x['allowance']
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32: return 'ERR_OVERWEIGHT_%d' % i
    free = max(x['allowance'], 1 if x['elite'] else 0)
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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 elite traveller on a two-bag fare only gets one free bag.

Input {'bags':[kg in check-in order],'allowance','elite'}. Any bag over 32 kg -> 'ERR_OVERWEIGHT_<i>' (first, zero-based). Free bags = allowance + 1 if elite, applied to the first bags. Base fee by overall bag position: 1st 30, 2nd 40, 3rd and later 150 (only for bags beyond the free count). Each bag over 23 kg adds 100, free or not. Return total.

split: open-access


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

N = 1
observations = []
def solve(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32: return 'ERR_OVERWEIGHT_%d' % i
    free = x['allowance'] + (1 if x['elite'] else 0)
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23 and pos > free:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400], ['regression: surcharge on free pieces', {'bags': [23.3, 22.6, 23.0, 23.0], 'allowance': 2, 'elite': True}, 250]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720], ['regression: surcharge on free pieces', {'bags': [23.3, 32.0, 10.4, 23.0], 'allowance': 2, 'elite': True}, 350]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
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(x):
    for i, kg in enumerate(x['bags']):
        if kg > 32: return 'ERR_OVERWEIGHT_%d' % i
    free = x['allowance'] + (1 if x['elite'] else 0)
    sched = [30, 40]
    total = 0
    for pos, kg in enumerate(x['bags'], 1):
        if pos > free:
            total += sched[pos - 1] if pos <= len(sched) else 150
        if kg > 23 and not x['elite']:
            total += 100
    return total
def check(label, actual, expected):
    observations.append({"check": label, "actual": actual, "expected": expected, "passed": actual == expected})
fixtures = [[['basic fare three bags', {'bags': [20.0, 18.5, 22.1], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [28.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.2], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [23.3, 23.3], 'allowance': 0, 'elite': False}, 270], ['sampled case 2', {'bags': [23.0], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [23.3, 11.4, 20.9, 8.6], 'allowance': 2, 'elite': False}, 400], ['regression: surcharge on free pieces', {'bags': [23.3, 22.6, 23.0, 23.0], 'allowance': 2, 'elite': True}, 250]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.2], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [29.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.300000000000004], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [], 'allowance': 0, 'elite': True}, 0], ['sampled case 2', {'bags': [18.6, 32.0, 22.6], 'allowance': 2, 'elite': False}, 250], ['sampled case 3', {'bags': [18.1, 23.0, 32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 720], ['regression: surcharge on free pieces', {'bags': [23.3, 32.0, 10.4, 23.0], 'allowance': 2, 'elite': True}, 350]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.3], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [30.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.4], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 0], ['sampled case 1', {'bags': [32.0], 'allowance': 2, 'elite': True}, 100], ['sampled case 2', {'bags': [32.0, 23.3, 23.0], 'allowance': 0, 'elite': False}, 420], ['sampled case 3', {'bags': [], 'allowance': 1, 'elite': False}, 0]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.4], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [31.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.5], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 150], ['sampled case 1', {'bags': [32.0, 32.0, 32.0, 23.3, 23.3], 'allowance': 0, 'elite': False}, 1020], ['sampled case 2', {'bags': [], 'allowance': 1, 'elite': False}, 0], ['sampled case 3', {'bags': [20.4, 23.3], 'allowance': 1, 'elite': True}, 100]], [['basic fare three bags', {'bags': [20.0, 18.5, 22.5], 'allowance': 0, 'elite': False}, 220], ['one free bag two paid', {'bags': [23.0, 21.0, 15.0], 'allowance': 1, 'elite': False}, 190], ['elite extra bag', {'bags': [19.0, 22.0, 20.0, 12.0], 'allowance': 1, 'elite': True}, 300], ['heavy free bag', {'bags': [32.0, 10.0], 'allowance': 1, 'elite': False}, 140], ['exactly hard limit', {'bags': [32.0, 23.4], 'allowance': 0, 'elite': False}, 270], ['over hard limit', {'bags': [20.0, 32.6], 'allowance': 2, 'elite': True}, 'ERR_OVERWEIGHT_1'], ['elite with two allowance', {'bags': [23.0, 23.0, 23.0, 23.0, 23.0], 'allowance': 2, 'elite': True}, 300], ['sampled case 1', {'bags': [31.9, 23.3, 22.9, 32.0], 'allowance': 0, 'elite': False}, 670], ['sampled case 2', {'bags': [23.3, 32.0, 32.0, 23.0], 'allowance': 1, 'elite': True}, 600], ['sampled case 3', {'bags': [7.7, 32.0], 'allowance': 2, 'elite': True}, 100]]]
for label, args, expected in fixtures[N-1]:
    check(label, solve(args), expected)
print(json.dumps({"observations": observations, "passed": all(x["passed"] for x in observations)}, ensure_ascii=False))
raise SystemExit(0 if all(x["passed"] for x in observations) else 1)

prompt:
A 28 kg bag within the free allowance goes through without the weight surcharge.

Input {'bags':[kg in check-in order],'allowance','elite'}. Any bag over 32 kg -> 'ERR_OVERWEIGHT_<i>' (first, zero-based). Free bags = allowance + 1 if elite, applied to the first bags. Base fee by overall bag position: 1st 30, 2nd 40, 3rd and later 150 (only for bags beyond the free count). Each bag over 23 kg adds 100, free or not. Return total.

split: open-access


prompt:
A trip that starts inside the travel window but returns after it fails COMMENCE.

Input {'sale','first_travel','last_travel','sale_window','travel_window','complete_by'} ISO dates. Sale date within the inclusive sale window, first travel within the inclusive travel (commencement) window, last travel on or before complete_by. Return failures in order SALE, COMMENCE, COMPLETE.

split: open-access


prompt:
Sales on the advertised last day of the promotion fail.

Input {'sale','first_travel','last_travel','sale_window','travel_window','complete_by'} ISO dates. Sale date within the inclusive sale window, first travel within the inclusive travel (commencement) window, last travel on or before complete_by. Return failures in order SALE, COMMENCE, COMPLETE.

split: open-access


prompt:
Travel completed exactly on the deadline fails COMPLETE.

Input {'sale','first_travel','last_travel','sale_window','travel_window','complete_by'} ISO dates. Sale date within the inclusive sale window, first travel within the inclusive travel (commencement) window, last travel on or before complete_by. Return failures in order SALE, COMMENCE, COMPLETE.

split: open-access


prompt:
Tickets sold before the travel window opens always fail COMMENCE.

Input {'sale','first_travel','last_travel','sale_window','travel_window','complete_by'} ISO dates. Sale date within the inclusive sale window, first travel within the inclusive travel (commencement) window, last travel on or before complete_by. Return failures in order SALE, COMMENCE, COMPLETE.

split: open-access