| Problem statement | Source code | Tags: VMBrute force
Not much to say here; just iterate through the instructions, keeping track of which ones have been executed (as line numbers). If we reach an instruction we've already executed, return the accumulator.
There may be clever ways to do this, such as building a control flow graph and finding which nop/jmp instructions are on paths that lead to termination, but I brute-forced: for each nop or jmp, swap it, run the program, and see if it terminates. If it does, return the accumulator.