My Advent of Code solutions in Python. kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code python
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 32 lines 1.2 kB view raw
1import os # NOQA 2import sys # NOQA 3import re # NOQA 4import math # NOQA 5import fileinput 6from string import ascii_uppercase, ascii_lowercase # NOQA 7from collections import Counter, defaultdict, deque, namedtuple # NOQA 8from itertools import count, product, permutations, combinations, combinations_with_replacement # NOQA 9 10from utils import parse_line, parse_nums, mul, all_unique, factors, memoize, primes # NOQA 11from utils import new_table, transposed, rotated # NOQA 12from utils import md5, sha256, knot_hash # NOQA 13from utils import VOWELS, CONSONANTS # NOQA 14from utils import Point, DIRS, DIRS_4, DIRS_8 # NOQA 15 16# Itertools Functions: 17# product('ABCD', repeat=2) AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD 18# permutations('ABCD', 2) AB AC AD BA BC BD CA CB CD DA DB DC 19# combinations('ABCD', 2) AB AC AD BC BD CD 20# combinations_with_replacement('ABCD', 2) AA AB AC AD BB BC BD CC CD DD 21 22total = 0 23result = [] 24table = new_table(None, width=2, height=4) 25 26for i, line in enumerate(fileinput.input()): 27 line = line.strip() 28 nums = parse_nums(line) 29 data = parse_line(r'', line) 30 31 if i == 0: 32 print(data)