Advent of Code 2020 Day 1 — Mathematica

The first task of day 1 was to find a pair of numbers in a given list that sum to 2020:

Intersection[input, 2020 - input]

The second task was to find three numbers that sum to 2020:

Intersection[input, 2020 - Total /@ Subsets[input, {2}]]

This last task completes in 3 milliseconds, compared with 2 seconds for the naive solution:

SelectFirst[Subsets[input, {3}], Total@# == 2020 &]