from typing import Callable, Generic, TypeVar

T = TypeVar("T")

class LazySegTree(Generic[T]):
    def __init__(
        self,
        op: Callable[[T, T], T],
        e: T,
        mapping: Callable[[T, T], T],
        composition: Callable[[T, T], T],
        id_: T,
        v: int | list[T],
    ) -> None: ...
    def set(self, p: int, x: T) -> None: ...
    def get(self, p: int) -> T: ...
    def prod(self, left: int, right: int) -> T: ...
    def all_prod(self) -> T: ...
    def apply(
        self, left: int, right: int | None = None, f: T | None = None
    ) -> None: ...
    def max_right(self, left: int, g: Callable[[T], bool]) -> int: ...
    def min_left(self, right: int, g: Callable[[T], bool]) -> int: ...
    def _update(self, k: int) -> None: ...
    def _all_apply(self, k: int, f: T) -> None: ...
    def _push(self, k: int) -> None: ...
