This file contains hidden or 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
sequence = ['\u0003', ' ', '&', '$', '-', '\u001e', '\u0002', ' ', '/', '/', '.', '/'] | |
for c in sequence: | |
print(chr(ord(c) ^ 0x41), end='') |
This file contains hidden or 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
def decrypt(u_input): | |
false_flag = '{ga1F_1auTca_eht_t0n_s!_s1hT}galf' | |
flag = [] | |
for i, x in enumerate(u_input): | |
flag.append(x ^ ord(false_flag[i])) | |
for x in flag: | |
print( chr(((x & 0x0F) << 4) ^ ((x & 0xF0) >> 4)), end='' ) |
This file contains hidden or 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
encrypted_key = [0x88, 0x9A, 0x93, 0x9C, 0x90, 0x92, 0x9A, 0x0A0, 0x8B, 0x90, 0x0A0,0x9C, 0x8C, 0x9E, 0x88, 0x0DE] | |
for c in encrypted_key: | |
print(chr(c ^ 0x0FF), end='') |
This file contains hidden or 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
register_values = {} | |
arithmetics = {'dec': '-', 'inc': '+'} | |
highest_value = 0 | |
with open('input', 'r') as f: | |
for line in f: | |
words = line.split(' ') | |
register = words[0] | |
amount = words[2] | |
condition = words[5:] | |
eval_register = words[4] |
This file contains hidden or 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
input_ = [0, 5, 10, 0, 11, 14, 13, 4, 11, 8, 8, 7, 1, 4, 12, 11] | |
def redistributions(banks): | |
seen = [] | |
cycles = 0 | |
while banks not in seen: | |
seen.append(list(banks)) | |
max_block = max(banks) # The bank to spread out. |
This file contains hidden or 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
input_ = [] | |
with open('input', 'r') as f: | |
for x in f: | |
input_.append(int(x)) | |
# PART 1 | |
idx = 0 | |
steps = 0 | |
while 0 <= idx < len(input_): | |
curr = input_[idx] |
This file contains hidden or 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
import itertools | |
def is_anagram(words): | |
count = 0 | |
w1, w2 = words | |
for char in w1: | |
if char in w2: | |
count += 1 |
This file contains hidden or 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
import itertools | |
input_ = [] | |
with open('input', 'r') as f: | |
for row in f: | |
input_.append(row.replace('\t', ' ').replace('\n', '').split(' ')) | |
values = [[int(val) for val in row] for row in input_] | |
# Part 1 |
This file contains hidden or 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
part1 = 0 | |
part2 = 0 | |
steps = len(input_)/2 | |
for i, num in enumerate(input_): | |
if num == input_[int((i + 1) % len(input_))]: | |
part1 += int(num) | |
if num == input_[int((i+steps) % len(input_))]: | |
part2 += int(num) | |