c++ performance improvement

using vector<int> instead of bitset, and inlining.

tested on windows, so please test on your platform.