text: To store the pre - computed integers
code: static List < int > v = new List < int > ( ) ; static int upper_bound ( List < int > ar , int k ) { int s = 0 ; int e = ar . Count ; while ( s != e ) { int mid = s + e >> 1 ; if ( ar [ mid ] <= k ) { s = mid + 1 ; } else { e = mid ; } } if ( s == ar . Count ) { return - 1 ; } return s ; }