Measurement of π±, K±, p and p production by 200 and 300 GeV/c protons