Divide the grid into regions of orthogonally connected cells, and place the region size in each cell of those regions. Regions of the same size can't share an edge. Clues outside the grid contain the sum of the first X numbers from the direction of the clue, where X is the first number seen by the clue.