Let's assume that Ville has x candies and Olli has y candies.
From the first statement, we know that if Ville gave 7 candies to Olli, they would have the same number of candies. This means that:
x - 7 = y + 7
Simplifying this equation, we get:
x - y = 14 ------ Equation 1
From the second statement, we know that if Olli gave 7 candies to Ville, Ville would have twice as many candies as Olli. This means that:
x + 7 = 2(y - 7)
Simplifying this equation, we get:
x - 2y = -21 ------ Equation 2
Now we have two equations with two unknowns, which we can solve using simultaneous equations.
Multiplying Equation 1 by 2 and subtracting Equation 2 from it, we get:
2(x - y) - (x - 2y) = 28 + 21
Simplifying this equation, we get:
x + 3y = 49 ------ Equation 3
We can now use Equation 1 to substitute for x in terms of y:
x = y + 14
Substituting this into Equation 3, we get:
(y + 14) + 3y = 49
Solving for y, we get:
y = 11
Substituting this value of y into Equation 1, we get:
x - 11 = 14
Solving for x, we get:
x = 25
Therefore, Ville has 25 candies and Olli has 11 candies.
To check, we can verify that if Ville gives 7 candies to Olli, they will both have 18 candies, and if Olli gives 7 candies to Ville, Ville will have 32 candies while Olli will have 4 candies, which satisfies both of the given conditions.