The algorithm is simple once you understand the insight. Here's the step-by-step approach:
Read the weight from input.
Check two conditions: is ? AND is even (meaning )?
If BOTH conditions are true, output YES.
If either fails, output NO. This runs in constant time since you're just checking two conditions. No loops, no arrays, just two boolean checks combined with AND. Simple problems often have simple solutions.