R code for some codejam contests