/**
 * A Binary Index tree is a tree array, used to efficiently maintain the prefix
 * sum. Such as support single point update with interval query, or interval
 * update with single point query. The amortized complexity of each operation is
 * $O(log N)$.
 *
 * The problem that the Binary Index Tree can solve is a subset of the Segment
 * Tree. Its advantage is that the complexity constant is smaller, and the
 * implementation is simpler and easier to understand.
 */ export interface BinaryIndexTree < T extends number | bigint > { param N init ( N ) : void ; param xth param value add ( xth , value ) : void ; param xth query ( xth ) : T ; }