Subtracting the frequency of higher number array with lower number array and thus finding the range of numbers from a to b having sum from 1 to 162
for ( let i = 0 ; i < arr_greater . length ; ++ i ) { arr_greater [ i ] -= arr_smaller [ i ] ; } let ans = 0 ; for ( let i = 1 ; i <= 162 ; ++ i ) { for ( let j = i + 1 ; j <= 162 ; ++ j ) {