Created
December 14, 2020 06:28
-
-
Save hyperneutrino/ff8d5d47c7decde8c1c00a4699999cf2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mask = "" | |
m = {} | |
while True: | |
try: line = input() | |
except: break | |
if line[1] == "a": | |
mask = line[7:] | |
else: | |
a, b = map(int, line[4:].split("] = ")) | |
b = bin(b)[2:].zfill(36) | |
k = "" | |
for i, j in zip(mask, b): | |
if i == "X": k += j | |
else: k += i | |
m[a] = int(k, 2) | |
print(sum(m.values())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment