if ( numberOfElements >= 2 ) : ways += ( numberOfElements * ( numberOfElements - 1 ) / 2 ) ; return ways ; def upper_bound ( a , low , high , element ) : while ( low < high ) : middle = int ( low + ( high - low ) / 2 ) ; if ( a [ middle ] > element ) : high = middle ; else : low = middle + 1 ; return low ;
Driver Code NEW_LINE