calculating number of queries
let q = queries . length ; for ( let i = 0 ; i < q ; i ++ ) { let start = queries [ i ] [ 0 ] ; let end = queries [ i ] [ 1 ] ; document . write ( " " + ( i + 1 ) + " " + solveQuery ( start , end , A ) + " " ) ; }