Cython implementation of fenwick tree