func_code_string: #include <bits/stdc++.h>   using namespace std;   int n;   int x[100111];   int num[100111], numl;   int ans[100111];   map<int, int> HASH;   int main() {     int i, temp;     scanf( %d , &n);     memset(num, 0, sizeof(num));     numl = 0;     for (i = 0; i < n; i++) {       scanf( %d , &temp);       if (HASH.count(temp) == 0) {         HASH[temp] = numl;         x[numl] = temp;         numl++;       }       num[HASH[temp]]++;     }     sort(x, x + numl);     ans[0] = num[HASH[x[0]]];     for (i = 1; i < numl; i++) {       ans[i] = ans[i - 1] + num[HASH[x[i]]];     }     int m, q;     int left, right, mid;     scanf( %d , &q);     for (i = 0; i < q; i++) {       scanf( %d , &m);       left = 0;       right = numl - 1;       while (left <= right) {         mid = (left + right) / 2;         if (x[mid] == m ||             (x[mid - 1] < m && x[mid + 1] > m && mid + 1 < numl && mid - 1 >= 0))           break;         if (x[mid] > m)           right = mid - 1;         else           left = mid + 1;       }       while (x[mid] > m && mid >= 0) mid--;       while (x[mid + 1] <= m && mid + 1 < numl) mid++;       if (mid >= 0 && mid < numl) printf( %d n , ans[mid]);       if (mid < 0) printf( 0 n );       if (mid >= numl) printf( %d n , n);     }     return 0;   }   