From cfeb794e91710205adc08b59f377d25dda018dda Mon Sep 17 00:00:00 2001 From: setop Date: Thu, 2 Dec 2021 09:46:21 +0100 Subject: [PATCH] some code compaction --- d01/d01_1.awk | 20 ++++---------------- d01/d01_2.py | 9 ++++++++- sliding.py => libs/sliding.py | 0 uloc.sh | 4 ++++ 4 files changed, 16 insertions(+), 17 deletions(-) rename sliding.py => libs/sliding.py (100%) create mode 100755 uloc.sh diff --git a/d01/d01_1.awk b/d01/d01_1.awk index 6c92772..00ad296 100644 --- a/d01/d01_1.awk +++ b/d01/d01_1.awk @@ -1,16 +1,4 @@ -NR == 1 { - A = $1 - next -} - -$1 > A { - N++ -} - -{ - A = $1 -} - -END { - print N -} \ No newline at end of file +NR == 1 { A = $1; next } +$1 > A { N++ } +{ A = $1 } +END { print N } diff --git a/d01/d01_2.py b/d01/d01_2.py index c74a859..f2393ee 100644 --- a/d01/d01_2.py +++ b/d01/d01_2.py @@ -1,3 +1,10 @@ import sys L = [int(l[:-1]) for l in sys.stdin.readlines()] -print(sum([0,1][a