This is not an easy question.
The OP asks you to give up one of these possibilities.
I can't imagine how would a programmer give up programming, except if he just lost all his intelligence in some way, such as shooting himself in the head.
Giving up sex could be likened to losing your balls.
Which makes it a choice between death and impotence, neither of which is desirable.
The other remark that could be made is that giving up programming does not imply that the person in question would have sex ever again, thus the safest answer is to live and thus to program, but maybe for some people such a future would seem pointless?