Solutions to previous years code jam in Python