func_code_string: #include <bits/stdc++.h>   using namespace std;   vector<long long> sp;   vector<pair<long long, long long>> bases;   int main() {     int s, b;     cin >> s >> b;     long long num, num2;     for (int i = 0; i < s; i++) {       cin >> num;       sp.push_back(num);     }     for (int i = 0; i < b; i++) {       cin >> num >> num2;       bases.push_back({num, num2});     }     sort(bases.begin(), bases.end());     long long sum[b + 5];     for (int i = 0; i < b; i++) {       sum[i] = bases[i].second;       if (i > 0) sum[i] += sum[i - 1];     }     for (int i = 0; i < s; i++) {       long long bas = 0;       long long start = 0, end = b, mid, idx = -1;       while (start <= end) {         mid = (start + end) / 2;         if (bases[mid].first <= sp[i]) {           idx = mid;           start = mid + 1;         } else {           end = mid - 1;         }       }       if (idx == b) idx--;       if (idx == -1)         cout <<  0  ;       else         cout << sum[idx] <<    ;     }     return 0;   }   