<jupyter_start><jupyter_text>Day 14<jupyter_code>import numpy as np
from aocd.models import Puzzle<jupyter_output><empty_output><jupyter_text>Data<jupyter_code>puzzle = Puzzle(year=2020, day=14)
data = puzzle.input_data.split('\n')<jupyter_output><empty_output><jupyter_text>Part One<jupyter_code>memory = 2**16*[36*'0', ]

for d in data:
    val = d.split(' = ')
    if 'mask' in val[0]:
        mask = val[1]
    else:
        iid = int(val[0][:-1].split('[')[1])
        memory[iid] = ''.join([x if x != 'X' else y for x, y in zip(mask, f"{int(val[1]):036b}")])        

answer_a = sum([int(x, 2) for x in memory])
answer_a
puzzle.answer_a = answer_a<jupyter_output>[32mThat's the right answer!  You are one gold star closer to saving your vacation. [Continue to Part Two][0m<jupyter_text>Part Two<jupyter_code>#answer_b = int(np.prod(count))
#answer_b
#puzzle.answer_b = answer_b
import scooby
scooby.Report('aocd')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1608832807570978, 'fraction_numerical': 0.028391167192429023, 'mean_word_length': 5.222222222222222, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '485584', 'license': 'Apache-2.0', 'n_tokens_mistral': 412, 'n_tokens_neox': 390, 'n_words': 78, 'path': '2020/Day-14.ipynb', 'repo_name': 'prisae/aoc20', 'size': '951'}