binary indexed tree
pat 1057