import argparse

parser = argparse.ArgumentParser(description="AoC day 1")
parser.add_argument("file", help="The file that should be sourced")
parser.add_argument("-p", "--phase", help="The part of the exercise that we are at", type=int, default=1)


def main(argv):
    print(f"test, {argv}")

    infile = open(argv.file, "r")

    allItems = []

    for line in infile:
        # do a line operation
        if line:
            allItems.append(int(line))

    infile.close()

    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f"The target mass is {sol}")
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f"The fuel adjusted fuel weight is now {sol}")


# Fuel required to launch a given module is based on its mass.
# Specifically, to find the fuel required for a module, take its mass,
# divide by three, round down, and subtract 2.


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2

    return sum


def solutionPt2(items):
    sum = 0
    for item in items:
        tumbler = int(item / 3) - 2
        while tumbler > 0:
            sum += tumbler
            tumbler = int(tumbler / 3) - 2

    return sum


main(parser.parse_args())


73590ea100635c66f93304f2dfb9751c3cb16728
<mask token>


def main(argv):
    print(f'test, {argv}')
    infile = open(argv.file, 'r')
    allItems = []
    for line in infile:
        if line:
            allItems.append(int(line))
    infile.close()
    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f'The target mass is {sol}')
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f'The fuel adjusted fuel weight is now {sol}')


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2
    return sum


<mask token>

<mask token>
parser.add_argument('file', help='The file that should be sourced')
parser.add_argument('-p', '--phase', help=
    'The part of the exercise that we are at', type=int, default=1)


def main(argv):
    print(f'test, {argv}')
    infile = open(argv.file, 'r')
    allItems = []
    for line in infile:
        if line:
            allItems.append(int(line))
    infile.close()
    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f'The target mass is {sol}')
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f'The fuel adjusted fuel weight is now {sol}')


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2
    return sum


def solutionPt2(items):
    sum = 0
    for item in items:
        tumbler = int(item / 3) - 2
        while tumbler > 0:
            sum += tumbler
            tumbler = int(tumbler / 3) - 2
    return sum


main(parser.parse_args())

<mask token>
parser = argparse.ArgumentParser(description='AoC day 1')
parser.add_argument('file', help='The file that should be sourced')
parser.add_argument('-p', '--phase', help=
    'The part of the exercise that we are at', type=int, default=1)


def main(argv):
    print(f'test, {argv}')
    infile = open(argv.file, 'r')
    allItems = []
    for line in infile:
        if line:
            allItems.append(int(line))
    infile.close()
    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f'The target mass is {sol}')
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f'The fuel adjusted fuel weight is now {sol}')


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2
    return sum


def solutionPt2(items):
    sum = 0
    for item in items:
        tumbler = int(item / 3) - 2
        while tumbler > 0:
            sum += tumbler
            tumbler = int(tumbler / 3) - 2
    return sum


main(parser.parse_args())

import argparse
parser = argparse.ArgumentParser(description='AoC day 1')
parser.add_argument('file', help='The file that should be sourced')
parser.add_argument('-p', '--phase', help=
    'The part of the exercise that we are at', type=int, default=1)


def main(argv):
    print(f'test, {argv}')
    infile = open(argv.file, 'r')
    allItems = []
    for line in infile:
        if line:
            allItems.append(int(line))
    infile.close()
    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f'The target mass is {sol}')
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f'The fuel adjusted fuel weight is now {sol}')


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2
    return sum


def solutionPt2(items):
    sum = 0
    for item in items:
        tumbler = int(item / 3) - 2
        while tumbler > 0:
            sum += tumbler
            tumbler = int(tumbler / 3) - 2
    return sum


main(parser.parse_args())

import argparse

parser = argparse.ArgumentParser(description="AoC day 1")
parser.add_argument("file", help="The file that should be sourced")
parser.add_argument("-p", "--phase", help="The part of the exercise that we are at", type=int, default=1)


def main(argv):
    print(f"test, {argv}")

    infile = open(argv.file, "r")

    allItems = []

    for line in infile:
        # do a line operation
        if line:
            allItems.append(int(line))

    infile.close()

    if argv.phase == 1:
        sol = solutionPt1(allItems)
        print(f"The target mass is {sol}")
    elif argv.phase == 2:
        sol = solutionPt2(allItems)
        print(f"The fuel adjusted fuel weight is now {sol}")


# Fuel required to launch a given module is based on its mass.
# Specifically, to find the fuel required for a module, take its mass,
# divide by three, round down, and subtract 2.


def solutionPt1(items):
    sum = 0
    for item in items:
        sum += int(item / 3) - 2

    return sum


def solutionPt2(items):
    sum = 0
    for item in items:
        tumbler = int(item / 3) - 2
        while tumbler > 0:
            sum += tumbler
            tumbler = int(tumbler / 3) - 2

    return sum


main(parser.parse_args())

