Something went wrong. Try again.
My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code
advent-of-code python
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445import os # NOQAimport sys # NOQAimport re # NOQAimport math # NOQAimport fileinputfrom string import ascii_uppercase, ascii_lowercase # NOQAfrom collections import Counter, defaultdict, deque, namedtuple # NOQAfrom itertools import count, product, permutations, combinations, combinations_with_replacement # NOQA
from utils import parse_line, parse_nums, mul, all_unique, factors, memoize, primes # NOQAfrom utils import chunks, gcd, lcm, print_grid, min_max_xy # NOQAfrom utils import new_table, transposed, rotated # NOQAfrom utils import md5, sha256, knot_hash # NOQAfrom utils import VOWELS, CONSONANTS # NOQAfrom utils import Point, DIRS, DIRS_4, DIRS_8 # NOQA
# Itertools Functions:# product('ABCD', repeat=2) AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD# permutations('ABCD', 2) AB AC AD BA BC BD CA CB CD DA DB DC# combinations('ABCD', 2) AB AC AD BC BD CD# combinations_with_replacement('ABCD', 2) AA AB AC AD BB BC BD CC CD DD
# It's Intcode time again!# from intcode import emulate# TAPE = [int(x) for x in fileinput.input()[0].split(',')]# TAPE += [0] * 100000# GLOBAL_INPUTS = [0]# vm = emulate(TAPE, 0, GLOBAL_INPUTS)# try:# resp = next(vm)# except StopIteration:# pass
total = 0result = []table = new_table(None, width=2, height=4)
for i, line in enumerate(fileinput.input()): line = line.strip() nums = parse_nums(line) data = parse_line(r'', line)
if i == 0: print(data)