<gh_stars>0
import functools
import operator

import fire
import numpy as np


def main(input_file: str = "input.txt") -> None:
    with open(input_file) as f:
        data = np.array([list(x) for x in f.read().splitlines()]).astype(int)

    sums = np.sum(data, axis=0)

    counts = sums > len(data) / 2
    gamma = int(functools.reduce(operator.add, counts.astype(int).astype(str)), 2)
    epsilon = int(functools.reduce(operator.add, (~counts).astype(int).astype(str)), 2)

    print(gamma * epsilon)


if __name__ == "__main__":
    fire.Fire(main)

import functools
import operator

import fire
import numpy as np


def main(input_file: str = "input.txt") -> None:
    with open(input_file) as f:
        data = np.array([list(x) for x in f.read().splitlines()]).astype(int)

    sums = np.sum(data, axis=0)

    counts = sums > len(data) / 2
    gamma = int(functools.reduce(operator.add, counts.astype(int).astype(str)), 2)
    epsilon = int(functools.reduce(operator.add, (~counts).astype(int).astype(str)), 2)

    print(gamma * epsilon)


if __name__ == "__main__":
    fire.Fire(main)