A question regarding Bitmask DP.

Question–>TopCoder Statistics - Problem Statement

Below is my solution uses bitmask DP logic. However, having spent close to three days, my code is still yielding 0 to each and every test-case, which is simply driving me mad. Any help will be much appreciated.

CODE → dF27C3 - Online C++ Compiler & Debugging Tool - Ideone.com