Maths and Physical Sciences papers to be rewritten following leaks