def grid_put(
    grid: list[list[int]],
    y: int,
    x: int,
    num: int,
) -> list[list[int]]:
    """Returns new grid with grid[y][x] == num and everything else the same

    >>> grid_put([[2, 4], [4, 0]], 1, 1, 2)
    [[2, 4], [4, 2]]

    """
    copy = [row.copy() for row in grid]
    copy[y][x] = num
    return copy