def lowerCamelCase  (   ):
    '''simple docstring'''







    return [list(range(1_000 - i  ,			-1_000 - i  ,			-1	)	) for i in range(1_000	)]


__lowercase							 =					generate_large_matrix()
__lowercase							 =					(
    [[4, 3, 2, -1], [3, 2, 1, -1], [1, 1, -1, -2], [-1, -1, -2, -3]],
    [[3, 2], [1, 0]],
    [[7, 7, 6]],
    [[7, 7, 6], [-1, -2, -3]],
    grid,
)



def lowerCamelCase  (   SCREAMING_SNAKE_CASE	):
    '''simple docstring'''







    assert all(row == sorted(SCREAMING_SNAKE_CASE  ,			reverse=SCREAMING_SNAKE_CASE	) for row in grid	)
    assert all(list(SCREAMING_SNAKE_CASE	) == sorted(SCREAMING_SNAKE_CASE  ,			reverse=SCREAMING_SNAKE_CASE	) for col in zip(*SCREAMING_SNAKE_CASE	)	)



def lowerCamelCase  (   SCREAMING_SNAKE_CASE	):
    '''simple docstring'''







    __UpperCamelCase     :Any			  =		0
    __UpperCamelCase     :Union[str, Any]			  =		len(SCREAMING_SNAKE_CASE	) - 1

    # Edge cases such as no values or all numbers are negative.
    if not array or array[0] < 0:
        return 0

    while right + 1 > left:
        __UpperCamelCase     :Union[str, Any]			  =		(left + right) // 2
        __UpperCamelCase     :Any			  =		array[mid]

        # Num must be negative and the index must be greater than or equal to 0.
        if num < 0 and array[mid - 1] >= 0:
            return mid

        if num >= 0:
            __UpperCamelCase     :List[Any]			  =		mid + 1
        else:
            __UpperCamelCase     :List[Any]			  =		mid - 1
    # No negative numbers so return the last index of the array + 1 which is the length.
    return len(SCREAMING_SNAKE_CASE	)



def lowerCamelCase  (   SCREAMING_SNAKE_CASE	):
    '''simple docstring'''







    __UpperCamelCase     :int			  =		0
    __UpperCamelCase     :Optional[int]			  =		len(grid[0]	)

    for i in range(len(SCREAMING_SNAKE_CASE	)	):
        __UpperCamelCase     :str			  =		find_negative_index(grid[i][:bound]	)
        total += bound
    return (len(SCREAMING_SNAKE_CASE	) * len(grid[0]	)) - total



def lowerCamelCase  (   SCREAMING_SNAKE_CASE	):
    '''simple docstring'''







    return len([number for row in grid for number in row if number < 0]	)



def lowerCamelCase  (   SCREAMING_SNAKE_CASE	):
    '''simple docstring'''







    __UpperCamelCase     :Optional[Any]			  =		0
    for row in grid:
        for i, number in enumerate(SCREAMING_SNAKE_CASE	):
            if number < 0:
                total += len(SCREAMING_SNAKE_CASE	) - i
                break
    return total



def lowerCamelCase  (   ):
    '''simple docstring'''







    from timeit import timeit

    print('''Running benchmarks'''	)
    __UpperCamelCase     :int			  =		(
        '''from __main__ import count_negatives_binary_search, '''
        '''count_negatives_brute_force, count_negatives_brute_force_with_break, grid'''
    )
    for func in (
        "count_negatives_binary_search",  # took 0.7727 seconds
        "count_negatives_brute_force_with_break",  # took 4.6505 seconds
        "count_negatives_brute_force",  # took 12.8160 seconds
    ):
        __UpperCamelCase     :Optional[Any]			  =		timeit(f"""{func}(grid=grid)"""  ,			setup=SCREAMING_SNAKE_CASE  ,			number=500	)
        print(f"""{func}() took {time:0.4f} seconds"""	)


if __name__ == "__main__":
    import doctest

    doctest.testmod()
    benchmark()











def 			_SCREAMING_SNAKE_CASE			(							lowercase	:       int	,							lowercase	:       int     ):


      '''simple docstring'''



      return int((input_a, input_a).count(1     ) != 0     )

def 			_SCREAMING_SNAKE_CASE			(							):


      '''simple docstring'''



      assert or_gate(0	,							0     ) == 0
      assert or_gate(0	,							1     ) == 1
      assert or_gate(1	,							0     ) == 1
      assert or_gate(1	,							1     ) == 1


if __name__ == "__main__":
 print(or_gate(0, 1))
 print(or_gate(1, 0))
 print(or_gate(0, 0))
 print(or_gate(1, 1))



