From 24610576bb18c4b5cac4497fba423d0920727d98 Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 1 Dec 2022 09:57:05 +0100 Subject: [PATCH] 2022: d01: ex1: add solution --- 2022/d01/ex1/ex1.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 2022/d01/ex1/ex1.py diff --git a/2022/d01/ex1/ex1.py b/2022/d01/ex1/ex1.py new file mode 100755 index 0000000..00c6305 --- /dev/null +++ b/2022/d01/ex1/ex1.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python + +import sys + + +def solve(input: list[list[int]]) -> int: + return max(map(sum, input), default=0) + + +def main() -> None: + input = [ + [int(line) for line in group.splitlines()] + for group in sys.stdin.read().split("\n\n") + if group + ] + print(solve(input)) + + +if __name__ == "__main__": + main()