Arrow keys to move boxes. Space to shoot a bullet. For good measure, I recommend using the green flag to reset the puzzle. For some reason there seems to be a feedback loop that's spawning hundreds of clones that I have no idea how is happening.
Thanks to Toby Fox for making Undertale v1.1 - Added the other 3 Hotland puzzles as well as an RNG mechanic that shuffles the puzzles around