Inclusive neutron and lambda production in proton-proton interactions at 12 and 24 GeV/c