Language: C++

#include <iostream>
#include <iomanip>
#include <vector>
#include <string>
using namespace std;
#define ok1 printf("ok1\n")
#define ok2 printf("ok2\n")
#define M LLONG_MAX
#define rep(i,n) for(int i=0;i<n;++i)
#define REP(i,s,n) for(int i=(s);i<(n);++i)
#define repr(i,n) for(int i=n-1;i>=0;--i)
#define REPR(i,s,n) for(int i=(s);i>=(n);--(i))
#define all(a) (a).begin(),(a).end()
#define reall(a) (a).rbegin(),(a).rend()
#define pb emplace_back //emplace_backの方が速いが使い慣れてないため
#define DOUBLE fixed << setprecision(15)
#define fi first
#define se second
#define mp make_pair
#define mt make_tuple
const double pi = acos(-1.0L);
typedef vector<int> vi;
typedef vector<string> vs;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<char> vc;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef deque<ll> dll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> TLL;
typedef vector<P> vP;
typedef vector<TLL> vTLL;
const ll mod = 1e9 + 7;
//const ll mod = 998244353;
ll dy[4] = { 1,0,-1,0 };
ll dx[4] = { 0,1,0,-1 };
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class A, class B>
ostream& operator<<(ostream& ost, const pair<A, B>&p) {
	ost << "{" << p.first << ", " << p.second << "} ";
	return ost;
}
template<class T>
ostream& operator<<(ostream& ost, const vector<T>&v) {
	ost << "{";
	for (int i = 0; i<v.size(); i++) {
		if (i)ost << ", ";
		ost << v[i];
	}
	ost << "} ";
	return ost;
}
template<class A, class B>
ostream& operator<<(ostream& ost, const map<A, B>&v) {
	ost << "{";
	for (auto p : v) {
		ost << "{" << p.first << ", " << p.second << "} ";
	}
	ost << "} ";
	return ost;
}
bool out_check(ll a, ll b) { return (0 <= a && a < b); }
double pitagoras(ll a, ll b, ll c, ll d) {
	double dx = a - b, dy = c - d;
	return pow(dx * dx + dy * dy, 0.5);
}
ll modpow(ll a, ll b) { ll c = 1; while (b > 0) { if (b & 1) { c = a * c%mod; }a = a * a%mod; b >>= 1; }return c; }
void Yes(bool x) { cout << ((x) ? "Yes\n" : "No\n"); }
void YES(bool x) { cout << ((x) ? "YES\n" : "NO\n"); }
void yes(bool x) { cout << ((x) ? "yes\n" : "no\n"); }
void Yay(bool x) { cout << ((x) ? "Yay!\n" : ":(\n"); }
ll  n, m, d, e, r, l, k, h, w, Q, ans, ret = M;
bool flag = false, flag2 = false, flag3 = false;
string s, t, u;
ll x, y;

ll __builtin_popcount(ll x) {
	stringstream ss;
	ss << bitset<26>(x);
	string S = ss.str();
	ll cnt = 0;
	cerr << x << " " << S << endl;
	for (auto c : S) cnt += (c == '1');
	return cnt;
}

int main() {
	cin.tie(0); ios::sync_with_stdio(false);//not intractive
	cin >> n >> s >> Q;
	vll bit(n);
	rep(i, n) bit[i]= 1 << (s[i] - 'a');
	while (Q--) {
		cin >> x;
		if (x == 1) {
			char c;
			cin >> y >> c;
			y--;
			bit[y] = 1 << (c - 'a');
		}
		else {
			int l, r;
			cin >> l >> r;
			l--;
			ans = 0;
			for (int i = l; i < r; i++)ans |= bit[i];
			cout << __builtin_popcount(ans) << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc:21:19: error: 'acos' was not declared in this scope
   21 | const double pi = acos(-1.0L);
      |                   ^~~~
a.cc:31:9: error: 'deque' does not name a type
   31 | typedef deque<ll> dll;
      |         ^~~~~
a.cc:58:41: error: 'map' does not name a type; did you mean 'mp'?
   58 | ostream& operator<<(ostream& ost, const map<A, B>&v) {
      |                                         ^~~
      |                                         mp
a.cc:58:44: error: expected ',' or '...' before '<' token
   58 | ostream& operator<<(ostream& ost, const map<A, B>&v) {
      |                                            ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, int)':
a.cc:60:23: error: 'v' was not declared in this scope
   60 |         for (auto p : v) {
      |                       ^
a.cc: In function 'double pitagoras(ll, ll, ll, ll)':
a.cc:69:16: error: 'pow' was not declared in this scope
   69 |         return pow(dx * dx + dy * dy, 0.5);
      |                ^~~
a.cc: At global scope:
a.cc:8:11: error: 'LLONG_MAX' was not declared in this scope
    8 | #define M LLONG_MAX
      |           ^~~~~~~~~
a.cc:76:46: note: in expansion of macro 'M'
   76 | ll  n, m, d, e, r, l, k, h, w, Q, ans, ret = M;
      |                                              ^
a.cc:4:1: note: 'LLONG_MAX' is defined in header '<climits>'; this is probably fixable by adding '#include <climits>'
    3 | #include <vector>
  +++ |+#include <climits>
    4 | #include <string>
a.cc:81:4: error: definition of 'll __builtin_popcount(ll)' ambiguates built-in declaration 'int __builtin_popcount(unsigned int)'
   81 | ll __builtin_popcount(ll x) {
      |    ^~~~~~~~~~~~~~~~~~
a.cc: In function 'll __builtin_popcount(ll)':
a.cc:83:15: error: 'bitset' was not declared in this scope
   83 |         ss << bitset<26>(x);
      |               ^~~~~~
a.cc:4:1: note: 'std::bitset' is defined in header '<bitset>'; this is probably fixable by adding '#include <bitset>'
    3 | #include <vector>
  +++ |+#include <bitset>
    4 | #include <string>