input: def solve_sudoku(board): 
      """
      Solve a given Sudoku puzzle. The board is a 9x9 matrix where the cells can be filled with numbers from 0 to 9.
      A zero means that the cell is vacant. 
  
      The function uses backtracking to solve the puzzle. It first finds a vacant cell, then checks if a number 
      from 1 to 9 can be placed in that cell without violating any Sudoku rules (uniqueness in row, column, and 3x3 block). 
      If a number can be placed, the function tries to solve the rest of the board. If no number works, it backtracks
      and tries another number.
  
      >>> board = [
      ...     [7,8,0,4,0,0,1,2,0],
      ...     [6,0,0,0,7,5,0,0,9],
      ...     [0,0,0,6,0,1,0,7,8],
      ...     [0,0,7,0,4,0,2,6,0],
      ...     [0,0,1,0,5,0,9,3,0],
      ...     [9,0,4,0,6,0,0,0,5],
      ...     [0,7,0,3,0,0,0,1,2],
      ...     [1,2,0,0,0,7,4,0,0],
      ...     [0,4,9,2,0,6,0,0,7]
      ... ]
      >>> solve_sudoku(board)
      [7, 8, 5, 4, 3, 9, 1, 2, 6]
      [6, 1, 2, 8, 7, 5, 3, 4, 9]
      [4, 9, 3, 6, 2, 1, 5, 7, 8]
      [8, 5, 7, 9, 4, 3, 2, 6, 1]
      [2, 6, 1, 7, 5, 8, 9, 3, 4]
      [9, 3, 4, 1, 6, 2, 7, 8, 5]
      [3, 7, 6, 5, 8, 4, 9, 1, 2]
      [1, 2, 8, 3, 9, 7, 4, 5, 6]
      [5, 4, 9, 2, 1, 6, 8, 3, 7]
      """
output:     def find_empty(board):
          for i in range(9):
              for j in range(9):
                  if board[i][j] == 0:
                      return (i, j)
          return None
  
      def is_valid(board, num, pos):
          row, col = pos
          
          # Check row
          for i in range(9):
              if board[row][i] == num and col != i:
                  return False
          
          # Check column
          for i in range(9):
              if board[i][col] == num and row != i:
                  return False
          
          # Check 3x3 box
          box_x = col // 3
          box_y = row // 3
          
          for i in range(box_y * 3, box_y * 3 + 3):
              for j in range(box_x * 3, box_x * 3 + 3):
                  if board[i][j] == num and (i, j) != pos:
                      return False
          
          return True
  
      def solve(board):
          find = find_empty(board)
          if not find:
              return True
          else:
              row, col = find
          
          for i in range(1, 10):
              if is_valid(board, i, (row, col)):
                  board[row][col] = i
                  
                  if solve(board):
                      return True
                  
                  board[row][col] = 0
          
          return False
  
      solve(board)
      return board