aboutsummaryrefslogtreecommitdiff
path: root/2023/04/puzzle-1.py
blob: 8c221d85b59d98b4452bca4fe659a73d2b433923 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
def main() -> None:
	acc = 0
	with open("input", "r") as f:
		while line := f.readline():
			l, r = map(str.split, line.split('|'))
			l = set(filter(str.isdigit, l))
			r = set(filter(str.isdigit, r))
			if s := l & r:
				acc += 1 << (len(s) - 1)
	print(acc)


if __name__ == "__main__":
	main()