all code for cumcm2013 problem B