from typing import Tuple


def tuple_to_index(t: Tuple[int, int], size) -> int:
    """
    Returns an index of 1d-array for the given tuple

    :param t:
    :param size:
    :return:
    """
    assert 0 <= t[0] < size and 0 <= t[1] < size, "Out of bound"

    return int(t[0] * size + t[1])