32 lines
884 B
Python
32 lines
884 B
Python
#!/bin/python3
|
|
import sys,time,re
|
|
from pprint import pprint
|
|
sys.path.insert(0, '../../')
|
|
from fred import list2int,get_re,nprint,lprint,loadFile
|
|
start_time = time.time()
|
|
|
|
input_f = 'input'
|
|
|
|
part = 1
|
|
#########################################
|
|
# #
|
|
# Part 1 #
|
|
# #
|
|
#########################################
|
|
|
|
if part == 1:
|
|
with open(input_f) as file:
|
|
instructions = file.readline().rstrip()
|
|
|
|
match = re.findall(r"(-?\d+)",instructions)
|
|
print(sum(list2int(match)))
|
|
|
|
#########################################
|
|
# #
|
|
# Part 2 #
|
|
# #
|
|
#########################################
|
|
if part == 2:
|
|
exit()
|
|
|
|
print("--- %s seconds ---" % (time.time() - start_time)) |