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

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

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