Example #1
0
def main(day):
    data = aocinput(day)
    instructions = [[part1, int(part2)] for line in data
                    for part1, part2 in [line.strip().split(' ')]]
    result, _ = oneVisit(instructions)
    result2 = findBrokenInstruction(instructions)
    print(result, result2)
Example #2
0
def main(day):
    data = aocinput(day)

    # setup
    add_reactions(data)
    find_depths()

    result = fuel_ammount(data)
    print(result)
Example #3
0
def main(day):
    data = aocinput(day)
    data = [int(value) for value in data[0].split(',')]
    comp = IntcompExtract(data.copy())
    comp.set_intcode(1, 12)
    comp.set_intcode(2, 2)
    comp.run()
    result = comp.get_intcode(0)
    noun_verb = find_noun_verb(data.copy())
    print(result, noun_verb)
Example #4
0
def main(day):
    data = aocinput(day)
    data = [int(value) for value in data[0].split(',')]

    test = TEST(data.copy(), 1)
    test.run()
    print(test.log[-1])

    # part 2
    test = TEST(data.copy(), 5)
    test.run()
    print(test.log[-1])
Example #5
0
def main(day):
    data = aocinput(day)
    result = occupiedSeats(data)
    result2 = occupied2(data)
    print(result, result2)
Example #6
0
def main(day):
    data = aocinput(day)
    data = sorted([int(item) for item in data])
    result = findSum(data, 2020), findTripleSum(data, 2020)
    print(result)
Example #7
0
def main(day):
    data = aocinput(day)
    data = [int(part) for part in data[0].strip().split(',')]
    result = find_oxygen(data)
    print(result)
Example #8
0
def main(day):
    data = [line.strip() for line in aocinput(day)]
    print(checksum(data))
    print(commonLetters(data))
Example #9
0
def main(day):
    data = aocinput(day)
    result = memorySum(data)
    result2 = memorySum2(data)
    print(result, result2)
Example #10
0
def main(day):
    data = aocinput(day)
    result = decode_image(data[0])
    print(result[0])
    print(result[1])
Example #11
0
def main(day):
    data = aocinput(day)
    result = matchRules(data)
    print(result)
Example #12
0
def main(day):
    data = list(map(int, aocinput(day)[0].split()))
    print(sumMetadata(data))
    print(sumMetaData2(data))
Example #13
0
def main(day):
    data = aocinput(day)
    result = activeCubes(data)
    result2 = activeCubes(data, 4)
    print(result, result2)
Example #14
0
def main(day):
    data = aocinput(day)
    result = containsBag(data)
    print(result)
Example #15
0
def main(day):
    data = aocinput(day)
    result = findCorners(data)
    print(result)
Example #16
0
def main(day):
    data = aocinput(day)
    result = validPasswords(data)
    print(result)
Example #17
0
def main(day: int):
    data = aocinput(day)
    print(sum_fuel(data))
Example #18
0
def main(day):
    data = aocinput(day)
    result = find_orbits(data)
    print(result)
Example #19
0
def main(day):
    data = aocinput(day)
    result = earliestBus(data)
    result2 = offsetDeparting(data)
    print(result, result2)
Example #20
0
def main(day):
    data = aocinput(day)
    print(largestAreas(data))
Example #21
0
def main(day):
    data = aocinput(day)
    print(displayMessage(data))
Example #22
0
def main(day):
    data = aocinput(day)
    print(recipe(data[0]))
Example #23
0
def main(day):
    data = [line.strip() for line in aocinput(day)]
    data1 = data[:3124]
    data2 = data[3126:]
    print(multibehave(data1))
    print(testprogram(data1, data2))
Example #24
0
def main(day):
    data = aocinput(day)
    result = maximize_thrusters([int(i) for i in data[0].split(',')])
    print(result)
Example #25
0
def main(day):
    data = aocinput(day)
    result = closest_intersection(data)
    print(result)
Example #26
0
def main(day):
    data = aocinput(day)
    result = best_location(data)
    print(result)
Example #27
0
def main(day):
    data = aocinput(day)
    data = [[char == '#' for char in line.strip()] for line in data]
    result1 = treeEncounters(data)
    result2 = minimizeEncounters(data)
    print(result1, result2)
Example #28
0
def main(day):
    data = aocinput(day)
    result = evalHomeWork(data, samePrecidence)
    result2 = evalHomeWork(data, plusPrecidence)
    print(result, result2)
Example #29
0
def main(day):
    data = aocinput(day)
    print(mostSleep(data))
Example #30
0
def main(day):
    data = aocinput(day)
    instructions = [(line[0], int(line[1:])) for line in data]
    result = getDistance(instructions)
    result2 = waypointMovement(instructions)
    print(result, result2)