Many melodies begin before the first full bar. LilyPond handles that with \partial.

Match the target by turning the opening quarter note into a pickup measure.

LilyPond manual reference

Target

Your Result

Click Check to compile and compare