Log in to get your input and submit your answers.

Day 16: Ticket Translation

To finalize the exam paperwork, the Bocal tasks you with verifying students' summary tickets. But the printer glitched again: the column headers are missing, leaving only comma-separated numbers on every ticket!

Fortunately, the Bocal preserved the validation rules for each field, where each rule permits two distinct valid ranges.

Your puzzle input is divided into three sections separated by blank lines:

Part 1

Some nearby tickets contain completely corrupted numbers that do not fit into any valid range of any field.

First, compute your ticket scanning error rate: sum all values on nearby tickets that are not valid for any of the rules in your input.

Example

Consider this small test dataset:

class: 1-3 or 5-7
row: 6-11 or 33-44
seat: 13-40 or 45-50

your ticket:
7,1,14

nearby tickets:
7,3,47
40,4,50
55,2,20
38,6,12

In this sample, looking at the nearby tickets:

The ticket scanning error rate is: 4 + 55 + 12 = 71.

Scan the nearby tickets in your input. What is your ticket scanning error rate?