C++ template for mainly for Google code jam