Two cities, X and Y, are 800 km from each other. A flight from X to Y in the headwind takes 2.5 hours. The return trip only takes 2 hours. Calculate the aircraft's speed through the surrounding air and the wind speed.

I assume that

2.5 * (x-y) = 800 and 2 * (x+y) = 800 for the other

Solving is

2.5x * -2.5y = 800
25x * -25y = 8000
-25y = 8000 - 25x
-25y/-25 = 8000/-25 - 25x/-25
y = -320 - (-x)
y = x - 320

same way for other side, giving y=400 - x

So this means that 320km for 2.5 and 400km for 2h? Does that seem good?

well, does it work?

Does 320*2.5 = 400*2 = 800 ?
Yes, so I guess you're ok
Rather than go through the work of posting such a question, get into the practice of checking your answers.