Language: C++

#include <bits/stdc++.h>
using namespace std;
const int maxn=5e5+5;
char s[maxn],ch;
set<int> pos[26];
int n,t,opt,x,y;
int main(){
    scanf("%d %s %d",&n,s+1,&t);
    for(int i=0;i<=25;i++){
        pos[i].insert(n+1);
    }
    for(int i=1;i<=n;i++){
        pos[s[i]-'a'].insert(i);
    }
    while(t--){
        scanf("%d",&opt);
        if(opt==1){
            scanf("%d %c",&x,&ch);
            if(s[x]!=ch){
                pos[s[x]-'a'].erase(x);
                pos[ch-'a'].insert(x);
                s[x]=ch;
            }
        }else{
            scanf("%d %d",&x,&y);
            int ans=0;
            for(int i=0;i<=25;i++){
                if(*pos[i].lower_bound(x)<=y){
                    ans++;
                }
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}#include <bits/stdc++.h>
using namespace std;
const int maxn=5e5+5;
char s[maxn],ch;
set<int> pos[26];
int n,t,opt,x,y;
int main(){
    scanf("%d %s %d",&n,s+1,&t);
    for(int i=0;i<=25;i++){
        pos[i].insert(n+1);
    }
    for(int i=1;i<=n;i++){
        pos[s[i]-'a'].insert(i);
    }
    while(t--){
        scanf("%d",&opt);
        if(opt==1){
            scanf("%d %c",&x,&ch);
            if(s[x]!=ch){
                pos[s[x]-'a'].erase(x);
                pos[ch-'a'].insert(x);
                s[x]=ch;
            }
        }else{
            scanf("%d %d",&x,&y);
            int ans=0;
            for(int i=0;i<=25;i++){
                if(*pos[i].lower_bound(x)<=y){
                    ans++;
                }
            }
            printf("%d\n",ans);
        }
    }
    return 0;
}

Compiler output:
a.cc:36:2: error: stray '#' in program
   36 | }#include <bits/stdc++.h>
      |  ^
a.cc:36:3: error: 'include' does not name a type
   36 | }#include <bits/stdc++.h>
      |   ^~~~~~~
a.cc:38:11: error: redefinition of 'const int maxn'
   38 | const int maxn=5e5+5;
      |           ^~~~
a.cc:3:11: note: 'const int maxn' previously defined here
    3 | const int maxn=5e5+5;
      |           ^~~~
a.cc:39:6: error: redefinition of 'char s [500005]'
   39 | char s[maxn],ch;
      |      ^
a.cc:4:6: note: 'char s [500005]' previously declared here
    4 | char s[maxn],ch;
      |      ^
a.cc:39:14: error: redefinition of 'char ch'
   39 | char s[maxn],ch;
      |              ^~
a.cc:4:14: note: 'char ch' previously declared here
    4 | char s[maxn],ch;
      |              ^~
a.cc:40:10: error: redefinition of 'std::set<int> pos [26]'
   40 | set<int> pos[26];
      |          ^~~
a.cc:5:10: note: 'std::set<int> pos [26]' previously declared here
    5 | set<int> pos[26];
      |          ^~~
a.cc:41:5: error: redefinition of 'int n'
   41 | int n,t,opt,x,y;
      |     ^
a.cc:6:5: note: 'int n' previously declared here
    6 | int n,t,opt,x,y;
      |     ^
a.cc:41:7: error: redefinition of 'int t'
   41 | int n,t,opt,x,y;
      |       ^
a.cc:6:7: note: 'int t' previously declared here
    6 | int n,t,opt,x,y;
      |       ^
a.cc:41:9: error: redefinition of 'int opt'
   41 | int n,t,opt,x,y;
      |         ^~~
a.cc:6:9: note: 'int opt' previously declared here
    6 | int n,t,opt,x,y;
      |         ^~~
a.cc:41:13: error: redefinition of 'int x'
   41 | int n,t,opt,x,y;
      |             ^
a.cc:6:13: note: 'int x' previously declared here
    6 | int n,t,opt,x,y;
      |             ^
a.cc:41:15: error: redefinition of 'int y'
   41 | int n,t,opt,x,y;
      |               ^
a.cc:6:15: note: 'int y' previously declared here
    6 | int n,t,opt,x,y;
      |               ^
a.cc:42:5: error: redefinition of 'int main()'
   42 | int main(){
      |     ^~~~
a.cc:7:5: note: 'int main()' previously defined here
    7 | int main(){
      |     ^~~~