This is how I did it and got the answer as 24 (18 + 6). Hope this helps.
First lets find the greatest number of students taking all three subjects. Since 19 is the smallest number of number of people taking a particular subject, let's assume that x=19. Plugging that into the Venn diagram where either a student takes only a single subject or all three, we get that the total number of students is (25-19)+(22-19)+(19-19)+19 = 6 + 3 + 0 + 19 = 28. So this doesn't work.
Next, let's try x=18. Which works because if 18 students take all three, 7 students take only M, 4 students take only E, and 1 student takes only H. Therefore, 18+7+4+1 = 30. ( and it works for other combinations as well since 25 = 18 + 7 ; 22 = 18 + 4 and 19 = 18 + 1). Hence x = 18.
Now for the least number of students taking all three, it's really easy to find. We know that total number of students = 30. Total number of registrations = 25 + 22 + 19 = 66. Now let's assume that each student takes at the most two subjects, and no one takes three. then the max number of registrations = 30 * 2 = 60. Which leaves us with 66 - 60 = 6. Therefore, our assumption wasn't correct and 6 of those 30 students have to have taken at least 3 subjects. Hence, y is 6 at least.
We can check this result,
If we have only M = 0, only E = 0, and only H = 0, and only (ME) = 11; only (EH) = 5 and only (MH) = 8 with MHE being 6, we find that.
Total M = 11 + 8 + 6 = 25
Total E = 5 + 11 + 6 = 22
Total H = 5 + 8 + 6 = 19
and total number of students = 11 + 5 + 8 + 6 = 30.
Hence y = 6.
So the grand sum is x + y = 18 + 6 = 24.