2020/13.py
def part2():
    """
    Final attempt at part 2. At this point I had struggled through enough that I
    understood what I needed to do with the Chinese Remainder Theorem. I copied an
    implementation of it (above) and then just created the necessary arrays for it.

    One key is the ``indicies.append(-i)`` line. It needs to be negative because index
    in question happens ``i`` before the period of ``b``.
    """
    busses = []
    indicies = []
    for i, b in enumerate(lines[1].split(",")):
        if b != "x":
            busses.append(int(b))
            indicies.append(-i)
    n = busses
    a = indicies
    return chinese_remainder(n, a)

    Final attempt at part 2. At this point I had struggled through enough that I
    understood what I needed to do with the Chinese Remainder Theorem. I copied an
    implementation of it (above) and then just created the necessary arrays for it.

    One key is the ``indicies.append(-i)`` line. It needs to be negative because index
    in question happens ``i`` before the period of ``b``.
    
Final attempt at part 2. At this point I had struggled through enough that I
understood what I needed to do with the Chinese Remainder Theorem. I copied an
implementation of it (above) and then just created the necessary arrays for it.

One key is the ``indicies.append(-i)`` line.
Final attempt at part 2 . At this point I had struggled through enough that I understood what I needed to do with the Chinese Remainder Theorem . I copied an implementation of it ( above ) and then just created the necessary arrays for it . One key is the ` ` indicies . append ( - i ) ` ` line .
def part2():
    busses = []
    indicies = []
    for i, b in enumerate(lines[1].split(",")):
        if b != "x":
            busses.append(int(b))
            indicies.append(-i)
    n = busses
    a = indicies
    return chinese_remainder(n, a)
def part2 ( ) : busses = [ ] indicies = [ ] for i , b in enumerate ( lines [ 1 ] . split ( "," ) ) : if b != "x" : busses . append ( int ( b ) ) indicies . append ( - i ) n = busses a = indicies return chinese_remainder ( n , a )
Final attempt at part 2.
Final attempt at part 2 .
"""
    Final attempt at part 2. At this point I had struggled through enough that I
    understood what I needed to do with the Chinese Remainder Theorem. I copied an
    implementation of it (above) and then just created the necessary arrays for it.

    One key is the ``indicies.append(-i)`` line. It needs to be negative because index
    in question happens ``i`` before the period of ``b``.
    """