COT2 — Count on a tree II on SPOJ
I've been struggling with this problem for days now, and there isn't any decent discussion / editorial available on the internet as well. Any pointers / hints for the solution?