# read input file and create list of input lines
file = open("Day6/day6_input.txt", "r")
input = file.read()
input_list = input.split('\n')
# part 1
# Read each of the two input lines
times = input_list[0]
distances = input_list[1]
# Parse the input lines into more usable data
times = [int(i) for i in times.split(':')[1].split(' ') if i.isdigit()]
distances = [int(i) for i in distances.split(':')[1].split(' ') if i.isdigit()]
# loop through each time and distance index in our input
answer = 1
for ind, time in enumerate(times):
# loop through each possible "charging time" for the race and determine
# whether the resulting distance is greater than the record distance
wins = 0
for i in range(0, time):
if i*(time-i) > distances[ind]:
wins +=1
answer = answer * wins
print(answer)
### part 2 ###
# parse the input to be one long race
time = int(times.split(':')[1].replace(' ', ''))
distance = int(distances.split(':')[1].replace(' ', ''))
# loop through all possible charging times in the race and count up wins
wins = 0
for i in range(0, time):
if i*(time-i) > distance:
wins +=1
print(wins)