import sequtils import times template stopwatch(body) = (let t1 = cpuTime();body;echo "TIME:",(cpuTime() - t1) * 1000,"ms") template stopwatch(body) = body proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': return result = 10 * result + k.ord - '0'.ord let n = scan() var data: array[200010,int32] var E : array[200010,seq[int32]] proc update(i:int,val:int32) = var i = i while i < n: data[i] += val i = i or (i + 1) proc get*(i:int): int32 = var i = i while i >= 0: result += data[i] i = (i and (i + 1)) - 1 stopwatch: for i in 1.int32..