Language: C++

#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
typedef long long ll;

void solve(){
  ll n, q;
  string s;
  cin >> n >> s >> q;
  vector<set<ll> > st(26);
  for(int i = 0; i < n; i++){
    int x = s[i] - 'a';
    st[x].insert(i);
  }
  cout << endl;
  for(int i= 0; i < q; i++){
    int x; cin >> x;
    if(x == 1){
      int y;
      char c1, c2;
      cin >> y >> c2;
      c1 = s[y - 1];
      st[c1 - 'a'].erase(y - 1);
      st[c2 - 'a'].insert(y - 1);
      s[y - 1] = c2;
    }
    else{
      int l, r, sum = 0; cin >> l >> r;
      for(int j = 0; j < 26; j++){
        if(lower_bound(l - 1) != st[j].end()){
          int y = *lower_bound(l - 1);
          if(y <= r - 1) sum++;
        }
      }
      cout << sum << endl;
    }
  }

  return;
}

int main(){
  solve();
  return 0;
}


Compiler output:
a.cc: In function 'void solve()':
a.cc:32:23: error: no matching function for call to 'lower_bound(int)'
   32 |         if(lower_bound(l - 1) != st[j].end()){
      |            ~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:3:
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided
a.cc:33:31: error: no matching function for call to 'lower_bound(int)'
   33 |           int y = *lower_bound(l - 1);
      |                    ~~~~~~~~~~~^~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note: candidate: 'template<class _ForwardIterator, class _Tp> _ForwardIterator std::lower_bound(_ForwardIterator, _ForwardIterator, const _Tp&)'
 1530 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:1530:5: note:   candidate expects 3 arguments, 1 provided
/usr/include/c++/14/bits/stl_algo.h:1963:5: note: candidate: 'template<class _FIter, class _Tp, class _Compare> _FIter std::lower_bound(_FIter, _FIter, const _Tp&, _Compare)'
 1963 |     lower_bound(_ForwardIterator __first, _ForwardIterator __last,
      |     ^~~~~~~~~~~
/usr/include/c++/14/bits/stl_algo.h:1963:5: note:   candidate expects 4 arguments, 1 provided