func_code_string: #include <bits/stdc++.h>   using namespace std;   template <class A>   void read(vector<A>& v);   template <class A, size_t S>   void read(array<A, S>& a);   template <class T>   void read(T& x) {     cin >> x;   }   void read(double& d) {     string t;     read(t);     d = stod(t);   }   void read(long double& d) {     string t;     read(t);     d = stold(t);   }   template <class H, class... T>   void read(H& h, T&... t) {     read(h);     read(t...);   }   template <class A>   void read(vector<A>& x) {     for (auto& a : x) read(a);   }   template <class A, size_t S>   void read(array<A, S>& x) {     for (auto& a : x) read(a);   }   const int mod = 1e9 + 7;   long long int primeLimit = 1e5;   const double PI = acos(-1);   bool prime[100000];   string LongestPalindromicPrefix(string str) {     string temp = str +  ? ;     reverse(str.begin(), str.end());     temp += str;     long long int n = temp.length();     long long int lps[n];     fill(lps, lps + n, 0);     for (long long int i = 1; i < n; i++) {       long long int len = lps[i - 1];       while (len > 0 && temp[len] != temp[i]) {         len = lps[len - 1];       }       if (temp[i] == temp[len]) {         len++;       }       lps[i] = len;     }     return temp.substr(0, lps[n - 1]);   }   bool binarySearchFloat(float lower, float higher, float maxErrorAllowed,                          long long int numberOfTimesWanttoRunCode) {     float l = lower, r = higher;     float eps = maxErrorAllowed;     long long int iteration_count = numberOfTimesWanttoRunCode;     for (long long int i = 0; i < iteration_count && l + eps < r; ++i) {     }   }   void primefinder() {     memset(prime, true, sizeof(prime));     prime[1] = false;     prime[0] = false;     for (long long int i = 2; i < primeLimit; i++) {       if (prime[i]) {         for (long long int j = i * i; j < primeLimit; j += i) {           prime[j] = false;         }       }     }   }   long long fast_pow(long long int x, long long int y) {     long long res = 1;     while (y > 0) {       if (y & 1) res = res * x;       y = y >> 1;       x = x * x;     }     return res;   }   long long Fast_pow(long long int x, long long int y, long long int p) {     long long res = 1;     x = x % p;     if (x == 0) return 0;     while (y > 0) {       if (y & 1) res = (res * x) % p;       y = y >> 1;       x = (x * x) % p;     }     return res;   }   long long int bs(vector<long long int> arr, long long int low,                    long long int cur) {     long long int high = (long long int)arr.size() - 1;     long long int index = -1;     while (low <= high) {       long long int mid = (low + high) / 2;       if (arr[mid] <= cur) {         index = mid;         low = mid + 1;       } else {         high = mid - 1;       }     }     return index;   }   int32_t main() {     ios_base::sync_with_stdio(false);     cin.tie(NULL);     long long int n, k;     cin >> n >> k;     vector<long long int> arr(n);     read(arr);     sort((arr).begin(), (arr).end());     long long int ans = 0;     for (long long int i = 0; i < n; i++) {       long long int index = bs(arr, i, 2 * k);       if (index >= (n - 1)) break;       if (index == -1) {         while ((k * 2) < arr[i]) {           k *= 2;           ans++;         }         k = std::max(k, arr[i]);       } else {         k = std::max(k, arr[index]);       }     }     cout << ans;   }   