Gas-Grain Chemical Models: Inclusion of a Grain Size Distribution and a Study of Young Stellar Objects in the Magellanic Clouds