summaryrefslogtreecommitdiffstats
path: root/20
diff options
context:
space:
mode:
Diffstat (limited to '20')
-rw-r--r--20/py/d13.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/20/py/d13.py b/20/py/d13.py
index fde95e9..e42372b 100644
--- a/20/py/d13.py
+++ b/20/py/d13.py
@@ -26,10 +26,8 @@ def pt2(_in):
N = 1
for dep, bus in busses.items():
N *= bus
- x = 0
- for dep, bus in busses.items():
- x += -dep * (N // bus) * mul_inv(N // bus, bus)
- return x % N
+ return sum(-dep * (N // bus) * mul_inv(N // bus, bus)
+ for dep, bus in busses.items()) % N
if __name__ == "__main__":