CS246 homework