list = File.read!("input.txt") |> String.split("\n") |> Enum.map(&String.to_integer/1) # pattern match binary tuple from list values [{a, b} | _] = for x <- list, y <- list, x + y == 2020, do: {x, y} IO.puts("Part 1: #{a * b}") # same thing but with 3-ary tuple [{a, b, c} | _] = for x <- list, y <- list, z <- list, x + y + z == 2020, do: {x, y, z} IO.puts("Part 2: #{a * b * c}")