Pattern-recognition pearl: the word SUDDEN is the key that unlocks this question.
A headache that reaches maximum intensity within seconds is a thunderclap headache, and the number-one cause is subarachnoid hemorrhage from a ruptured aneurysm. Add neck rigidity (from meningeal irritation by blood) and the picture is complete.
Run through the distractors. Intraparenchymal bleed tends to produce focal weakness, speech or sensory deficits that progress, rather than a pure sudden headache with stiff neck. Bacterial meningitis does cause neck stiffness, but its onset is over hours to days with fever and malaise, not an instantaneous thunderclap. So infection does not fit the timeline.
That leaves SAH, which is also a neurosurgical emergency: confirm with a non-contrast CT, and if negative but suspicion remains, do a lumbar puncture looking for xanthochromia.
Ref: Harrison's Principles of Internal Medicine, 20e.