5 filename=(len(sys.argv) > 1) and sys.argv[1] or "22_10.txt"
8 adaptors=[int(line.rstrip()) for line in open(filename, "r")]
10 end_jolts=adaptors[-1]+3
14 for adaptor in adaptors:
15 if adaptor-cur_jolts == 3:
16 if 3 not in diff_counts:
19 elif adaptor-cur_jolts == 1:
20 if 1 not in diff_counts:
24 raise Exception("Diff is not 1 or 3!")
29 print(diff_counts[1] * diff_counts[3])