aboutsummaryrefslogtreecommitdiff
path: root/2024/01/puzzle-2.awk
blob: 8400a16d024db792f68cf606276703db33dc82dc (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/awk -f

{
	xs[++i] = $1
	ys[$2]++
}

END {
	for (i in xs)
		d += xs[i] * ys[xs[i]]
	print d
}