From e790654a6a8db28946ba16a3203feadb699e94ca Mon Sep 17 00:00:00 2001
From: Thomas Voss <thomasvoss@live.com>
Date: Mon, 6 Dec 2021 09:38:35 +0100
Subject: Make code a little more efficient

---
 2021/06/puzzles.py | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/2021/06/puzzles.py b/2021/06/puzzles.py
index 93dcfea..9d3f2d4 100644
--- a/2021/06/puzzles.py
+++ b/2021/06/puzzles.py
@@ -14,15 +14,11 @@ def main() -> None:
 		acc = collections.Counter(map(int, f.read().split(",")))
 
 	for _ in range(DAYS):
-		counts: Counter[int] = collections.Counter()
-		for a, c in acc.items():
-			if a:
-				counts[a - 1] += c
-			else:
-				counts[6] += c
-				counts[8] += c
-
-		acc = counts
+		n = acc[0]
+		for i in range(8):
+			acc[i] = acc[i + 1]
+		acc[6] += n
+		acc[8] = n
 
 	print(sum(acc.values()))
 
-- 
cgit v1.2.3