My Advent of Code solutions in Python.
kevinyap.ca/2019/12/going-fast-in-advent-of-code/
advent-of-code
python
1import fileinput
2
3paper = 0
4ribbon = 0
5
6for line in fileinput.input():
7 l, w, h = [int(n) for n in line.strip().split('x')]
8 a, b, c = l*w, w*h, h*l
9
10 paper += 2*(a+b+c) + min(a, b, c)
11 ribbon += (l*w*h) + 2*(l+w+h - max(l, w, h))
12
13print "ft^2 of paper: %d" % paper
14print "Feet of ribbon: %d" % ribbon