Let's see. We know that x > 13 for sure. That's because we have 4 constant numbers: 7, 1, 3, 2. The total amount of cookies must be larger than 13 because those numbers equal 13 already.
If you then look, it says that after Sandy and Sue and Stan, Steve was given half of the cookies left. After Steve's cookies were given, there were only two left for grandma. That means Steve got 2 cookies, because grandma also got 2. Now we know that the total amount of cookies must be > than 15.
But using this information, we know that after 3 cookies were given to Stan, there were 4 cookies (b/c 2 + 2 = 4). This also means that before 3 cookies were given to Stan, there were 7 cookies (b/c 4 + 3 = 7).
So now I did a little trial and testing. After a few tries, I've found the answer. Grandma baked 23 cookies in total.
23 - 7 = 16. 16 / 2 = 8. 8 + 1 = 9. 16 - 9 = 7. 7 - 3 = 4. 4 / 2 = 2. 4 - 2 = 2.
Sorry if this was a tad confusing, hope it helps though!