diff options
Diffstat (limited to '2024/01/puzzle-2.awk')
-rwxr-xr-x | 2024/01/puzzle-2.awk | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/2024/01/puzzle-2.awk b/2024/01/puzzle-2.awk new file mode 100755 index 0000000..8400a16 --- /dev/null +++ b/2024/01/puzzle-2.awk @@ -0,0 +1,12 @@ +#!/usr/bin/awk -f + +{ + xs[++i] = $1 + ys[$2]++ +} + +END { + for (i in xs) + d += xs[i] * ys[xs[i]] + print d +}
\ No newline at end of file |