You may not use algorithm std::accuulate in its simple form for a container of type std::map. You need use the algorithm with binary operation and to use possibly a lambda expression as the binary operation. For example
int sum = accumulate( m.begin(), m.end(), 0,
[]( int acc, std::pair<int, int> p ) { return ( acc + p.second ); } );