Resolving the target's policy from the updates, each key takes its last value:

- cutoff_hour: 17 (Update 1)
- cutoff_inclusive: true (Update 1)
- lead_minutes: 30 (Update 1)
- timezone: America/New_York (Update 1)
- adjacency_allowed: true (Update 4, after false in Update 2)
- cancelled_blocks: true (Update 5, after false in Update 2)
- duplicate_policy: first (Update 5, after last in Update 2)
- duration_max: 120 (Update 4)
- capacity: 1 (Update 3)
- report_order: id (Update 3)
- blackout_day: 2026-11-01 (Update 6)
- priority_high_first: true (Update 6)

Implementation notes:

- Deduplication keeps the first row's position. With the "last" policy, the last row's value would replace it and carry its own original index.
- Invalid appointments are rejected before they reach the capacity check. Cancelled appointments that pass validation reserve capacity but are reported in blocked.
- If cancelled_blocks is false, cancelled appointments are rejected.
- Overlap counts accepted intervals that intersect the candidate, computed in UTC minutes.
- Sorting for report_order "id" uses the id, and "input" uses the retained original index.

```json
{"files": {"main.py": "from core import run\nfrom policy import POLICY\ndef evaluate(payload):\n    return run(payload, POLICY)\n", "policy.py": "POLICY = {\n    'timezone': 'America/New_York',\n    'cutoff_hour': 17,\n    'cutoff_inclusive': True,\n    'lead_minutes': 30,\n    'adjacency_allowed': True,\n    'cancelled_blocks': True,\n    'duplicate_policy': 'first',\n    'duration_max': 120,\n    'capacity': 1,\n    'report_order': 'id',\n    'blackout_day': '2026-11-01',\n    'priority_high_first': True,\n}\n", "helpers.py": "from datetime import datetime, timedelta, timezone\n\ndef parse(s):\n    if isinstance(s, str) and s.endswith('Z'):\n        s = s[:-1] + '+00:00'\n    return datetime.fromisoformat(s)\n", "core.py": "from datetime import datetime, timedelta, timezone\nfrom zoneinfo import ZoneInfo\nfrom helpers import parse\n\n\ndef run(payload, policy):\n    tz = ZoneInfo(policy['timezone'])\n    now = parse(payload['now']).astimezone(timezone.utc)\n    rows = payload.get('appointments', [])\n    kept = {}\n    order = []\n    for i, a in enumerate(rows):\n        k = a['id']\n        if k not in kept:\n            order.append(k)\n            kept[k] = (i, a)\n        elif policy['duplicate_policy'] == 'last':\n            kept[k] = (i, a)\n    items = [kept[k] for k in order]\n    hi = policy['priority_high_first']\n    items.sort(key=lambda t: (-t[1]['priority'] if hi else t[1]['priority'], t[0]))\n    accepted = []\n    selected = []\n    blocked = []\n    rejected = []\n    lead = timedelta(minutes=policy['lead_minutes'])\n    for idx, a in items:\n        ok = True\n        dur = a['duration']\n        if not (dur > 0 and dur <= policy['duration_max']):\n            ok = False\n        start = parse(a['start'])\n        su = start.astimezone(timezone.utc)\n        eu = su + timedelta(minutes=dur) if ok else su\n        if ok and su < now + lead:\n            ok = False\n        if ok:\n            ls = su.astimezone(tz)\n            if ls.date().isoformat() == policy['blackout_day']:\n                ok = False\n            else:\n                cut = datetime(ls.year, ls.month, ls.day, policy['cutoff_hour'], 0, tzinfo=tz)\n                cu = cut.astimezone(timezone.utc)\n                if policy['cutoff_inclusive']:\n                    ok = eu <= cu\n                else:\n                    ok = eu < cu\n        if ok and a.get('cancelled') and not policy['cancelled_blocks']:\n            ok = False\n        if ok:\n            n = 0\n            for s2, e2 in accepted:\n                if policy['adjacency_allowed']:\n                    ov = su < e2 and s2 < eu\n                else:\n                    ov = su <= e2 and s2 <= eu\n                if ov:\n                    n += 1\n            if n >= policy['capacity']:\n                ok = False\n        if not ok:\n            rejected.append((a['id'], idx))\n            continue\n        accepted.append((su, eu))\n        if a.get('cancelled'):\n            blocked.append((a['id'], idx))\n        else:\n            selected.append((a['id'], idx))\n\n    def fmt(lst):\n        if policy['report_order'] == 'id':\n            lst = sorted(lst, key=lambda t: t[0])\n        else:\n            lst = sorted(lst, key=lambda t: t[1])\n        return [t[0] for t in lst]\n    return {'selected': fmt(selected), 'blocked': fmt(blocked), 'rejected': fmt(rejected)}\n"}}
```