Driven Program
public static void Main ( ) { int q = 3 ; int [ ] L = { 2 , 2 , 24 } ; int [ ] R = { 5 , 2 , 28 } ; int [ ] prefix = new int [ MAX ] ; int [ ] suffix = new int [ MAX ] ; precompute ( prefix , suffix ) ; for ( int i = 0 ; i < q ; i ++ ) { Console . WriteLine ( query ( prefix , suffix , L [ i ] , R [ i ] ) ) ; } } }