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.

Add 2022/01

+9 -9
+7
2022/day01.py
··· 1 + import advent 2 + 3 + day = advent.Day(year=2022, day=1) 4 + elves = [sum(e) for e in day.nparagraphs] 5 + 6 + print("Part 1:", max(elves)) 7 + print("Part 2:", sum(sorted(elves)[-3:]))
+2 -9
2022/starter.py
··· 1 - import os 2 - import sys 3 - import re 4 - import math 5 - import copy 6 - import fileinput 1 + import os, sys, re, math, copy, fileinput 7 2 from string import ascii_uppercase, ascii_lowercase 8 3 from collections import Counter, defaultdict, deque, namedtuple 9 4 from itertools import count, product, permutations, combinations, combinations_with_replacement ··· 12 7 from utils import parse_line, parse_nums, mul, all_unique, factors, memoize, primes, resolve_mapping 13 8 from utils import chunks, gcd, lcm, print_grid, min_max_xy 14 9 from utils import new_table, transposed, rotated, firsts, lasts 15 - from utils import md5, sha256, knot_hash 16 - from utils import VOWELS, CONSONANTS 10 + from utils import md5, sha256, VOWELS, CONSONANTS 17 11 from utils import Point, DIRS, DIRS_4, DIRS_8 # N (0, 1) -> E (1, 0) -> S (0, -1) -> W (-1, 0) 18 - 19 12 # Itertools Functions: 20 13 # product('ABCD', repeat=2) AA AB AC AD BA BB BC BD CA CB CC CD DA DB DC DD 21 14 # permutations('ABCD', 2) AB AC AD BA BC BD CA CB CD DA DB DC