
def get_input():
    with open('input.txt', 'r') as f:
        return set(int(i) for i in f.read().split())

def main():
    puzzle = get_input()

    last_joltage = 0
    one_jolt = 0
    three_jolts = 1  # this is bad lmao
    while len(puzzle) != 0:
        if last_joltage + 1 in puzzle:
            last_joltage = last_joltage + 1
            one_jolt += 1
        elif last_joltage + 2 in puzzle:
            last_joltage = last_joltage + 2
        elif last_joltage + 3 in puzzle:
            last_joltage = last_joltage + 3
            three_jolts += 1
        puzzle.remove(last_joltage)
    
    print(one_jolt, three_jolts)
    return one_jolt * three_jolts



if __name__ == '__main__':
    import time

    start = time.perf_counter()
    print(main())
    print(time.perf_counter() - start)


def get_input():
    with open('input.txt', 'r') as f:
        return set(int(i) for i in f.read().split())

def main():
    puzzle = get_input()

    last_joltage = 0
    one_jolt = 0
    three_jolts = 1
    while len(puzzle) != 0:
        if last_joltage + 1 in puzzle:
            last_joltage = last_joltage + 1
            one_jolt += 1
        elif last_joltage + 2 in puzzle:
            last_joltage = last_joltage + 2
        elif last_joltage + 3 in puzzle:
            last_joltage = last_joltage + 3
            three_jolts += 1
        puzzle.remove(last_joltage)
    
    print(one_jolt, three_jolts)
    return one_jolt * three_jolts


if __name__ == '__main__':
    import time

    start = time.perf_counter()
    print(main())
    print(time.perf_counter() - start)

Fix minor issues in 2020.10.1 file
Fix minor issues in 2020.10.1 file

The comment about the 1 being bad was incorrect, in fact it was good. I
had forgotten about adding the extra three-jolt difference for the final
adapter in the device, and didn't make the connection between it and the
three-jolt count being one short lol.

  
  def get_input():
      with open('input.txt', 'r') as f:
          return set(int(i) for i in f.read().split())
  
  def main():
      puzzle = get_input()
  
      last_joltage = 0
      one_jolt = 0
-     three_jolts = 1  # this is bad lmao
+     three_jolts = 1
      while len(puzzle) != 0:
          if last_joltage + 1 in puzzle:
              last_joltage = last_joltage + 1
              one_jolt += 1
          elif last_joltage + 2 in puzzle:
              last_joltage = last_joltage + 2
          elif last_joltage + 3 in puzzle:
              last_joltage = last_joltage + 3
              three_jolts += 1
          puzzle.remove(last_joltage)
      
      print(one_jolt, three_jolts)
      return one_jolt * three_jolts
  
  
- 
  if __name__ == '__main__':
      import time
  
      start = time.perf_counter()
      print(main())
      print(time.perf_counter() - start)
  
Fix minor issues in 2020.10.1 file
## Code Before:

def get_input():
    with open('input.txt', 'r') as f:
        return set(int(i) for i in f.read().split())

def main():
    puzzle = get_input()

    last_joltage = 0
    one_jolt = 0
    three_jolts = 1  # this is bad lmao
    while len(puzzle) != 0:
        if last_joltage + 1 in puzzle:
            last_joltage = last_joltage + 1
            one_jolt += 1
        elif last_joltage + 2 in puzzle:
            last_joltage = last_joltage + 2
        elif last_joltage + 3 in puzzle:
            last_joltage = last_joltage + 3
            three_jolts += 1
        puzzle.remove(last_joltage)
    
    print(one_jolt, three_jolts)
    return one_jolt * three_jolts



if __name__ == '__main__':
    import time

    start = time.perf_counter()
    print(main())
    print(time.perf_counter() - start)

## Instruction:
Fix minor issues in 2020.10.1 file
## Code After:

def get_input():
    with open('input.txt', 'r') as f:
        return set(int(i) for i in f.read().split())

def main():
    puzzle = get_input()

    last_joltage = 0
    one_jolt = 0
    three_jolts = 1
    while len(puzzle) != 0:
        if last_joltage + 1 in puzzle:
            last_joltage = last_joltage + 1
            one_jolt += 1
        elif last_joltage + 2 in puzzle:
            last_joltage = last_joltage + 2
        elif last_joltage + 3 in puzzle:
            last_joltage = last_joltage + 3
            three_jolts += 1
        puzzle.remove(last_joltage)
    
    print(one_jolt, three_jolts)
    return one_jolt * three_jolts


if __name__ == '__main__':
    import time

    start = time.perf_counter()
    print(main())
    print(time.perf_counter() - start)
