Create prefix array
let prefix_a = Array . from ( { length : N + 1 } , ( _ , i ) => 0 ) ; let prefix_b = Array . from ( { length : N + 1 } , ( _ , i ) => 0 ) ; let prefix_c = Array . from ( { length : N + 1 } , ( _ , i ) => 0 ) ;