Let $B$ be the indicator of what type of jump occurs, if any; $B=-1$ when there's a negative jump, $B=1$ when there's a positive jump and $B=0$ if there is no jump. Then to determine the jump, you just need to generate $B$. According to your formulation,
$$ P(B=-1) = p_{down} $$
$$P(B=1) = p_{up} $$
$$P(B=0) = 1-p_{up}-p_{down} $$
You can generate $B$ by generating ana Uniform(0,1) variable $U$ and letting
$$B=-1 \ \ \ {\rm if} \ \ \ U \leq p_{down}, $$
$$B=1 \ \ \ {\rm if} \ \ \ p_{down} \leq U \leq p_{down}+p_{up} $$
and
$$B=0 \ \ \ {\rm if} \ \ \ U \geq p_{down}+p_{up}$$
Examining the Uniform(0,1) CDF will make it clear why the probabilities work out correctly.
You could integrate out $Y$ if the question were to determine the distribution of $S(T)$ analytically but I think the point is to determine its distribution by simulation.
Note: Assuming you don't have a function to generate normally distributed variables, you will also have to generate more uniforms to simulate $X$. If you use the Box-Muller transform method of generating normals, you can simulate two normals for every two uniformly distributed variables.