def part2(data):
    """Return 100 * x + y where x and y in positions 1 and 2
    make the program halt with 19690720 in position 0.

    In the problem description, x and y are called noun and verb.
    The values will be between 0 and 99, inclusive.
    """
    def result(memory, noun, verb):
        memory[1] = noun
        memory[2] = verb
        ip = 0  # instruction pointer
        opcode = memory[ip]
        while opcode != 99:
            parameter1 = memory[ip+1]
            parameter2 = memory[ip+2]
            parameter3 = memory[ip+3]
            if opcode == 1:
                memory[parameter3] = memory[parameter1] + memory[parameter2]
            else:
                memory[parameter3] = memory[parameter1] * memory[parameter2]
            ip += 4
            opcode = memory[ip]
        return memory[0]

    program = data.split(',')
    for index in range(len(program)):
        program[index] = int(program[index])

    # exhaustive search for the two values
    for noun in range(100):
        for verb in range(100):
            # each run modifies the program, so use a copy of the original one
            if result(program.copy(), noun, verb) == 19690720:
                return 100*noun + verb