aboutsummaryrefslogtreecommitdiff
path: root/2022/01/puzzles.awk
blob: 11bece529146c40b55d68eb2aad17890bbd52287 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/gawk -f

BEGIN { RS = ""; FS = "\n" }
      { for (i = 1; i <= NF; i++) s[NR] += $i }
END   {
	asort(s)
	# START PART 1
	print s[NR]
	# END PART 1 START PART 2
	print s[NR] + s[NR - 1] + s[NR - 2]
	# END PART 2
}