Solves a sudoku puzzle or generates a solved one if no input is provided. Code is somewhat optimized for memory and isn't terribly slow but it's absolutely evil. RNG is not seeded properly for testing purposes.
Example input: 400050008038200100600003000013009005060400000000000090000070200800000000095004001