import sys import shared if __name__ == '__main__': raw_string = shared.get_string(sys.argv[1]) garbageless, discarded_count = shared.remove_garbage(raw_string) print(discarded_count) print(shared.count_depth_score(garbageless))
import sys from shared import get_string, get_circle_sum if __name__ == '__main__': sumstring = get_string(sys.argv[1]) debug = len(sys.argv) > 2 and bool(sys.argv[2]) print(get_circle_sum(sumstring, lambda i, l: (i + 1) % l, debug=debug))
import sys import shared if __name__ == '__main__': hashprefix = shared.get_string(sys.argv[1]).strip() all_hashes_hexstring = (shared.knot_hash("{0}-{1}".format(hashprefix, i)) for i in range(128)) as_bytes = (shared.convert_hex_to_bytes(h) for h in all_hashes_hexstring) print(sum(shared.sum_individual_characters(x) for x in as_bytes))
import sys import shared if __name__ == '__main__': instructions = [int(x) for x in shared.get_string(sys.argv[1]).split('\n')] print(shared.run_instructions(instructions, lambda x: x - 1 if x >= 3 else x + 1))
import sys import shared if __name__ == '__main__': bytesin = shared.get_string(sys.argv[1]).strip() print(shared.knot_hash(bytesin))
import sys import shared def spin_lock(index_of_interest, step_size, iterations): cursor = 0 answer = None for current_val in range(1, iterations + 1): cursor = (cursor + step_size) % current_val + 1 if cursor == index_of_interest: answer = current_val return answer if __name__ == '__main__': step_size = int(shared.get_string(sys.argv[1]).strip()) print(spin_lock(1, step_size, 50 * 10**6))