Sam had 300 more pencils than erasers at first. After giving away 1/5 the

erasers and 5/6 of the pencils, he had 216 more erasers than pencils left.
(a) How many erasers did he have at first?
(b) How many pencils did he have at first?

Looking at the bot's answer:

Didn't it say he had 300 more pencils than erasers?
but 1800 - 600 ≠ 300 !! So the bot's answer is wrong again.

Number of erasers ---- x
number of pencils ----- x + 300

after the giving he has:
number of erasers = 5x/6
number of pencils = (x+300)/6

erasers - pencils = 216
5x/6 - (x + 300)/6 = 216

times 6
5x - x - 300 = 1296
4x = 1596
x = 399

He had 399 erasers and 699 pencils

I think there is a flaw in the question, since you cannot get a whole
number of 5x/6

(a) 600 erasers

(b) 1800 pencils