import io
import array


def part1(stdin: io.TextIOWrapper, stderr: io.TextIOWrapper) -> int:
    """Find two numbers that sum to 2020, then multiply them."""

    numbers = array.array('i')

    iterations = 0
    for line in stdin:
        iterations += 1
        number = int(line.strip())
        pair = 2020 - number

        try:
            numbers.index(pair)
            stderr.write(f"{number} + {pair} in {iterations} iterations\n")
            return number * pair
        except ValueError:
            numbers.append(number)

    raise Exception("No matches found.")