They started with a ratio of 8:3.
Since we don't know the actual numbers, let's say their scores were originally 8x for Holly and 3x for Melanie.
Then Melanie scored 34 points, so her score became 3x + 34.
Holly's score remained the same at 8x.
The new ratio is 2:5, so
8x/(3x + 34) = 2/5
Now we solve the equation for x.
40x = 6x + 68
34x = 68
x = 2
With x, we can find the scores.
Holly ended up with 8x = 8 * 2 = 16
Melanie ended up with 3x + 34 = 3(2) + 34 = 40