Log in to get your input and submit your answers.

Day 14: Docking Data

After traveling on the bus, you realize your laptop can no longer synchronize its data bus with the school's central server.

The communication protocol uses a data bus equipped with a 24-bit binary mask. Your puzzle input contains the raw instruction stream transmitted by the system.

Two types of instructions appear in the stream:

Part 1

In version 1 of the protocol, the mask is applied directly to the value before writing it to memory:

Example

Consider this short instruction sequence:

mask = XXXXXXXXXXXXXXXXX1XXXX0X
mem[8] = 11
mem[7] = 101
mem[8] = 0

Execution trace:

At the end of this example, the sum of all values left in memory is 101 + 64 = 165.

Execute your full input stream. What is the sum of all values left in memory after the initialization program completes?