criyle/codenet-compile-errors huggingface dataset:
Language: Java

import javafx.geometry.Pos;

import java.io.*;
import java.util.*;
import java.util.stream.Collectors;

public class Main {

    public static void main(final String[] args) throws Exception {
        final Scanner sc = new Scanner(System.in);
        long N;
        N = sc.nextLong();
        long M;
        M = sc.nextLong();
        long K;
        K = sc.nextLong();

        Set<Point> friends = new HashSet<>();
        for(int i = 0 ; i < M ; i++){
            Point p = new Point(sc.nextInt() - 1, sc.nextInt() - 1);
            friends.add(p);
        }
        Set<Point> blocks = new HashSet<>();
        for(int i = 0 ; i < K ; i++){
            Point p = new Point(sc.nextInt() - 1, sc.nextInt() - 1);
            blocks.add(p);
        }

        final Solver solver = new Solver();
        solver.solve(N, M, K, friends, blocks);
    }
}

class Point {
    final int x;
    final int y;

    Point(int x, int y) {
        this.x = x;
        this.y = y;
    }

    @Override
    public int hashCode() {
        return Objects.hash(x, y);
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof Point)) {
            return false;
        }
        final Point other = (Point) obj;
        return this.x == other.x && this.y == other.y;
    }
}

class Solver {
    public void solve(long N, long M, long K, Set<Point> friends, Set<Point> blocks) {
        int INF = (int) 10e5;

        int d[][] = new int[(int) N][(int) N];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                Point p1 = new Point(i, j);
                Point p2 = new Point(j, i);
                if (friends.contains(p1) || friends.contains(p2)) {
                    d[i][j] = 1;
                    continue;
                }
                d[i][j] = INF;
            }
        }

        for (int k = 0; k < N; k++) {
            for (int i = 0; i < N; i++) {
                for (int j = 0; j < N; j++) {
                    d[i][j] = Math.min(d[i][j], d[i][k] + d[k][j]);
                }
            }
        }

        List<Integer> candidates = new ArrayList<>();
        for (int i = 0; i < N; i++) {
            int candidate = 0;
            for (int j = 0; j < N; j++) {
                if (i == j) {
                    continue;
                }

                Point p1 = new Point(i, j);
                Point p2 = new Point(j, i);
                if (blocks.contains(p1) || blocks.contains(p2)) {
                    continue;
                }
                if (friends.contains(p1) || friends.contains(p2)) {
                    continue;
                }

                if (d[i][j] < INF) {
                    candidate++;
                }
            }
            candidates.add(candidate);
        }
        System.out.println(candidates.stream().map(String::valueOf).collect(Collectors.joining(" ")));
    }
}



Compiler output:
Main.java:1: error: package javafx.geometry does not exist
import javafx.geometry.Pos;
                      ^
1 error
Language: C

#include <stdio.h>

int main(){
  int N, M, K;
  int user[100001];
  int A[100001],B[100001],C[100001],D[100001];
  int Ms[100001], Ks[100001];
  
  scanf("%d %d %d", &N,&M,&K);
  for(int i=0; i<M; i++){
    scanf("%d %d", &A[i], &B[i]);
  }
  for(int i=0; i<K; i++){
    scanf("%d %d", &C[i], &D[i]);
  }
  
  //***********************************//
  
  for(int i=1; i<N; i++){
    for(int j=0; j<M; j++){
      if(A[j]==i){
        user[B[j]]=i;
        Ms[k]=j

  return 0;
}


Compiler output:
main.c: In function 'main':
main.c:23:12: error: 'k' undeclared (first use in this function)
   23 |         Ms[k]=j
      |            ^
main.c:23:12: note: each undeclared identifier is reported only once for each function it appears in
main.c:23:16: error: expected ';' before 'return'
   23 |         Ms[k]=j
      |                ^
      |                ;
   24 | 
   25 |   return 0;
      |   ~~~~~~        
main.c:26:1: error: expected declaration or statement at end of input
   26 | }
      | ^
main.c:26:1: error: expected declaration or statement at end of input
main.c:26:1: error: expected declaration or statement at end of input
Language: C++

#include<bits/stdc++.h>

using namespace std;

const int MAXN=1e5+1;

int n,m,k,f[MAXN],g[MAXN]={0},cnt[MAXN]={0};
map<pair<int,int>,bool> r;

inline find_root(int x) {
	return x==f[x] ? x:f[x]=find_root(f[x]);
}

inline bool merge(int x,int y) {
	x=find_root(x),y=find_root(y);
	if(x==y) return 0;
	f[x]=y,g[y]+=g[x];
	return 1;
}



int main() {
	scanf("%d %d %d",&n,&m,&k);
	for(int i=1; i<=n; ++i) f[i]=i,g[i]=1;
	for(int i=1,a,b; i<=m; ++i) {
		scanf("%d %d",&a,&b);
		++cnt[a],++cnt[b];
		merge(a,b);
	}
	for(int i=1; i<=n; ++i) cnt[i]=g[find_root(i)]-cnt[i];
	for(int i=1,c,d; i<=k; ++i) {
		scanf("%d %d",&c,&d);
		if(f[c]==f[d]) --cnt[c],--cnt[d];
	}
	for(int i=1; i<=n; ++i) printf("%d ",cnt[i]-1);
	putchar('\n');
	return 0;
}

Compiler output:
a.cc:10:8: error: ISO C++ forbids declaration of 'find_root' with no type [-fpermissive]
   10 | inline find_root(int x) {
      |        ^~~~~~~~~
Language: C++

#include<bits/stdc++.h>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stdio.h>
#include<cstring>
#include<math.h>
#include<map>
#include<bitset>
#include<iomanip>
#include<queue>
#include<functional>
#include<stack>
#include<tuple>
#include<cassert>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
using ll = long long;
using P = pair<int, int>;
using MATRIX = vector< vector<ll> >;
template <class T> inline bool chmin(T &x, const T &y) {if (x > y) {x = y; return 1;} return 0;}
template <class T> inline bool chmax(T &x, const T &y) {if (x < y) {x = y; return 1;} return 0;}

int N;
string S;
int Q;
const int INF = 1000000000;

int main() {
  cin >> N >> S >> Q;
  set<int> s[26];

  rep(i, N) {
    s[S[i]-'a'].insert(i);
  }
  rep(j, 26) {
    s[j].insert(INF);
  }

  rep(i, Q) {
    int temp;
    cin >> temp;
    if(temp == 1) {
      int j;
      char c;
      cin >> j >> c;
      j--;
      s[S[j]-'a'].erase(j);
      S[j] = c;
      s[S[j]-'a'].insert(j);
    } else {
      int l, r;
      cin >> l >> r;
      l--;r--;
      int t = 0;
      rep(j, 26) {
        if(s[j].empty()) continue;
        int p = *lower_bound(s[j].begin(), s[j].end(), l);
        if(p <= r) {
          t++;
        }
      }
      ans.push_back(t);
    }
  }
  rep(i, ans.size()) {
      cout << ans[i] << endl;
  }
  return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:64:7: error: 'ans' was not declared in this scope; did you mean 'abs'?
   64 |       ans.push_back(t);
      |       ^~~
      |       abs
a.cc:67:10: error: 'ans' was not declared in this scope; did you mean 'abs'?
   67 |   rep(i, ans.size()) {
      |          ^~~
a.cc:18:45: note: in definition of macro 'rep'
   18 | #define rep(i, n) for (int i = 0; i < (int)(n); ++i)
      |                                             ^
Language: C++

#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  set<int> S[26];
  /*
  rep(i, 26){
    rep(j, n){
      if(s[j]-'a'==i){
        S[i].insert(j);
      }
    }
  }*/
  rep(i, n){
    S[s[i]-'a'].insert(i);
  }
  int q;
  cin >> q;
  rep(i, q){
    int t;
    cin >> t;
    if(t==1){
      int iq;
      char cq;
      cin >> iq >> cq;
      iq--;
      S[s[iq]-'a'].erase(iq);
      s[iq]=cq;
      S[cq-'a'].insert(iq);
    } else {
      int lq, rq;
      cin >> lq >> rq;
      int ans=0;
      lq--; rq--;
      rep(j, 26){
        //auto it=lower_bound(S[j].begin(), S[j].end(), lq);
        it=S[j].lower_bound(lq);
        if(it != S[j].end() && *it<=rq){
          ans++;
        }
      }
      printf("%d\n", ans);
    }
  }
  return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:52:9: error: 'it' was not declared in this scope; did you mean 't'?
   52 |         it=S[j].lower_bound(lq);
      |         ^~
      |         t
Language: C++

#include <bits/stdc++.h>
#include <string>
#include <vector>
#include <algorithm>
#define rep(i,w) for (int i = 0;i < (w); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
int INF = 1e9;

int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int q;
  cin >> q;
  vector<set<int>> table(26);
  rep(i,s.size()) table[s[i]-'a'].insert(i);
  rep(query,q){
    int com,l;cin >> com >> l;
    --l;
    if(com == 1){
      char ch;
      cin >> ch;
      //int i;
      // cin >> i >> ch;
      // --i;
      table[s[l]-'a'].erase(l);
      s[l] = ch;
      table[ch-'a'].insert(l);
    }else{
      int ans = 0;
      int r;cin >> r;--r;
      // int l,r;cin >> l >> r;
      // --r;--l;
      rep(j,26){
        set<int>::iterator it = lower_bound(table[j].begin(),table[j].end,l);
        if(it != table[j].end() && *it <= r) ans++;
      }
      printf("%d\n",ans);
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:38:71: error: invalid use of non-static member function 'std::set<_Key, _Compare, _Alloc>::iterator std::set<_Key, _Compare, _Alloc>::end() const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; iterator = std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::const_iterator]'
   38 |         set<int>::iterator it = lower_bound(table[j].begin(),table[j].end,l);
In file included from /usr/include/c++/14/set:63,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:158,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_set.h:355:7: note: declared here
  355 |       end() const _GLIBCXX_NOEXCEPT
      |       ^~~
Language: C++

#include<iostream>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int seg[(1<<24)][26];
int LEN=(1<<23)-1;

void add(char a, int x) {
  x += LEN;
  while(true) {
    seg[x][a-'a']++;
    if(x==0) break;
    x = (x-1)/2;
  }
  return;
}

void change(char bef, char newchr, int x) {
  x += LEN;
  while(true) {
    seg[x][bef-'a']--;
    seg[x][newchr-'a']++;
    if(x==0) break;
    x = (x-1)/2;
  }
  return;
}

int sum(int l, int r) {
  l += LEN;
  r += LEN;
  vector<char> ans;
  map<char, int> amap;
  while(l<r) {
    if(l%2==0) {
      for(int i=0;i<26;++i) {
        if(seg[l][i]>0) {
          if(amap['a'+i]==0) ans.push_back('a'+i);
          amap['a'+i]++;
        }
      }
      l++;
    }
    l /= 2;
    if(r%2==0) {
      for(int i=0;i<26;++i) {
        if(seg[r-1][i]>0) {
          if(amap['a'+i]==0) ans.push_back('a'+i);
          amap['a'+i]++;
        }
      }
      r--;
    }
    r /= 2;
  }
  return ans.size();
}

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  for(int i=0;i<N;++i) {
    add(S[i], i);
  }
  int Q;
  cin>>Q;
  int query;
  int l, r, x;
  char a;
  vector<int> ans;
  for(int i=0;i<Q;++i) {
    cin>>query;
    if(query==1) {
      cin>>x>>a;
      x--;
      change(S[x], a, x);
      S[x] = aft;
    }
    else {
      cin>>l>>r;
      l--;
      ans.push_back(sum(l, r));
    }
  }
  for(int i=0;i<ans.size();++i) cout<<ans[i]<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:100:14: error: 'aft' was not declared in this scope
  100 |       S[x] = aft;
      |              ^~~
Language: C++

#include<iomanip>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<list>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<stack>
using namespace std;
typedef long long ll;
#define fi first
#define se second
#define mp make_pair
#define rep(i, n) for(int i=0;i<n;++i)
#define rrep(i, n) for(int i=n;i>=0;--i)
const int inf=1e9+7;
const ll mod=1e9+7;
const ll mod1=998244353;
const ll big=1e18;
const double PI=2*asin(1);

int seg[(1<<24)][26];
int LEN=(1<<23)-1;

void add(char a, int x) {
  x += LEN;
  while(true) {
    seg[x][a-'a']++;
    if(x==0) break;
    x = (x-1)/2;
  }
  return;
}

void change(char bef, char newchr, int x) {
  x += LEN;
  while(true) {
    seg[x][bef-'a']--;
    seg[x][newchr-'a']++;
    if(x==0) break;
    x = (x-1)/2;
  }
  return;
}

int sum(int l, int r) {
  l += LEN;
  r += LEN;
  vector<char> ans;
  map<char, int> amap;
  while(l<r) {
    if(l%2==0) {
      for(int i=0;i<26;++i) {
        if(seg[l][i]>0) {
          if(amap['a'+i]==0) ans.push_back('a'+i);
          amap['a'+i]++;
        }
      }
      l++;
    }
    l /= 2;
    if(r%2==0) {
      for(int i=0;i<26;++i) {
        if(seg[r-1][i]>0) {
          if(amap['a'+i]==0) ans.push_back('a'+i);
          amap['a'+i]++;
        }
      }
      r--;
    }
    r /= 2;
  }
  return ans.size();
}

int main() {
  int N;
  cin>>N;
  string S;
  cin>>S;
  for(int i=0;i<N;++i) {
    add(S[i], i);
  }
  int Q;
  cin>>Q;
  int query;
  int l, r, x;
  char a;
  vector<int> ans;
  for(int i=0;i<Q;++i) {
    cin>>query;
    if(query==1) {
      cin>>x>>a;
      x--;
      change(S[x], a, x);
    }
    else {
      cin>>l>>r;
      l--;
      ans.push_back(sum(l, r));
    }
  }
  for(int i=0;i<ans.size();++i) cout<<ans[i]<<endl;
}



Compiler output:
a.cc: In function 'int main()':
a.cc:81:3: error: 'cin' was not declared in this scope
   81 |   cin>>N;
      |   ^~~
a.cc:12:1: note: 'std::cin' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
   11 | #include<stack>
  +++ |+#include <iostream>
   12 | using namespace std;
a.cc:106:33: error: 'cout' was not declared in this scope
  106 |   for(int i=0;i<ans.size();++i) cout<<ans[i]<<endl;
      |                                 ^~~~
a.cc:106:33: note: 'std::cout' is defined in header '<iostream>'; this is probably fixable by adding '#include <iostream>'
Language: C++

#include<bits/stdc++.h>
using namespace std;
class BIT {
  private:
  int sum[1000000];
  int N;
  public:
  void init(int n) {
    N = n;
    for (int i = 0; i <= N; i ++) sum[i] = 0;
  }
  void pp(int a) {
    while (a <= N) {
      sum[a] ++;
      a += (a & -a);
    }
  }
  void mn(int a) {
    while (a <= N) {
      sum[a] --;
      a += (a & -a);
    }
  }
  int sumUp(int r) {
    int ret = 0;
    while (r > 0) {
      ret += sum[r];
      r -= (r & -r);
    }
    return ret;
  }
}
int main () {
  BIT alph[26];
  int N;
  cin >> N;
  string S;
  cin >> S;
  for (int i = 0; i < 26; i ++) alph[i].init(N);
  for (int i = 0; i < N; i ++) {
    char c = S[i];
    int kj = (int)c - (int)'a';
    alph[kj].pp(i + 1);
  }
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; q ++) {
    int t;
    cin >> t;
    if (t == 1) {
      int i;
      char c;
      cin >> i >> c;
      if (S[i - 1] != c) {
        int mo = (int)S[i - 1] - (int)'a';
        int tu = (int)c - (int)'a';
        alph[mo].mn(i);
        alph[tu].pp(i);
      }
    }
    else {
      int l, r;
      cin >> l >> r;
      int ans = 0;
      for (int i = 0; i < 26; i ++) {
        if (alph[i].sumUp(r) - alph[i].sumUp(l - 1) > 0) ans ++;
      }
      cout << ans << endl;
    }
  }
}


Compiler output:
a.cc:32:2: error: expected ';' after class definition
   32 | }
      |  ^
      |  ;
Language: C++

#include<bits/stdv++.h>
using namespace std;
class BIT {
  private:
  int sum[1000000];
  int N;
  public:
  void init(int n) {
    N = n;
    for (int i = 0; i <= N; i ++) sum[i] = 0;
  }
  void pp(int a) {
    while (a <= N) {
      sum[a] ++;
      a += (a & -a);
    }
  }
  void mn(int a) {
    while (a <= N) {
      sum[a] --;
      a += (a & -a);
    }
  }
  int sumUp(int r) {
    int ret = 0;
    while (r > 0) {
      ret += sum[r];
      r -= (r & -r);
    }
    return ret;
  }
}
int main () {
  BIT alph[26];
  int N;
  cin >> N;
  string S;
  cin >> S;
  for (int i = 0; i < 26; i ++) alph[i].init(N);
  for (int i = 0; i < N; i ++) {
    char c = S[i];
    int kj = (int)c - (int)'a';
    alph[kj].pp(i + 1);
  }
  int Q;
  cin >> Q;
  for (int q = 0; q < Q; q ++) {
    int t;
    cin >> t;
    if (t == 1) {
      int i;
      char c;
      cin >> i >> c;
      if (S[i - 1] != c) {
        int mo = (int)S[i - 1] - (int)'a';
        int tu = (int)c - (int)'a';
        alph[mo].mn(i);
        alph[tu].pp(i);
      }
    }
    else {
      int l, r;
      cin >> l >> r;
      int ans = 0;
      for (int i = 0; i < 26; i ++) {
        if (alph[i].sumUp(r) - alph[i].sumUp(l - 1) > 0) ans ++;
      }
      cout << ans << endl;
    }
  }
}

Compiler output:
a.cc:1:9: fatal error: bits/stdv++.h: No such file or directory
    1 | #include<bits/stdv++.h>
      |         ^~~~~~~~~~~~~~~
compilation terminated.
Language: C++

#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long n;
vector<vector<long long>> BIT(26, vector<long long>(n+10));
void add(long long c,long long i, long long x) {
	while (i <= n) {
		BIT[c][i] += x;
		i += i & -i;
	}
}
long long csum(long long c,long long i) {
	long long count = 0;
	while (i > 0) {
		count += BIT[c][i];
		i -= i & -i;
	}
	return count;
}
long long sum(long long c,long long l, long long r) {
	return csum(c,r) - csum(c,l - 1);
}
int main() {
	cin >> n;
	string s;
	cin >> s;
	for (int i = 0; i < n; i++) {
		long long c = long long(s[i] - 'a');
		add(c, i + 1, 1);
	}
	long long q;
	cin >> q;
	for (int i = 0; i < q; i++) {
		int b;
		cin >> b;
		if (b == 1) {
			long long a;
			char h;
			cin >> a >> h;
			long long c = long long(s[a - 1] - 'a');
			add(c, a, -1);
			c = long long(h - 'a');
			add(c, a, 1);
		}
		else {
			long long l, r;
			cin >> l >> r;
			long long ans = 0;
			for (int i = 0; i < 26; i++) {
				long long co = sum(i, l, r);
				if (co != 0) {
					ans++;
				}
			}
			cout << ans << endl;
		}
	}
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:44:31: error: expected primary-expression before 'long'
   44 |                 long long c = long long(s[i] - 'a');
      |                               ^~~~
a.cc:56:39: error: expected primary-expression before 'long'
   56 |                         long long c = long long(s[a - 1] - 'a');
      |                                       ^~~~
a.cc:58:29: error: expected primary-expression before 'long'
   58 |                         c = long long(h - 'a');
      |                             ^~~~
Language: C++

#include<bits/stdc++.h>
using namespace std;

int main() {
  int n,q;
  string s;
  cin >> n >> s >> q;
  set<int> alpha[26];
  for(int i=0;i<n;i++)alpha[(int)(s[i]-'0')].insert(i);
  for(int i=0;i<q;i++){
      int t;
      cin >> t;
      if(t==1){
        int i;
        char c;
        cin >> i >> c;
        i--;
        if(s[i]!=c){
            alpha[(s[i]-'0')].erase(i);
            alpha[(c-'0')].insert(i);
        }
      }
      else{
        int l,r;
        cin >> l >> r;
        l--; r--;
        int ans=0;
        for(int i=0;i<26;i++){
            auto u = alpha[i].lower_bound(l);
            if(u!=alpha[i].end() && *u<=r)ans++;
        cout << ans << endl;
      }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:2: error: expected '}' at end of input
   34 | }
      |  ^
a.cc:4:12: note: to match this '{'
    4 | int main() {
      |            ^
Language: C++

#include <bits/stdc++.h>
using namespace std;

int main() {
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  int N, Q;
  string S;
  cin >> N >> S >> Q;
  vector<set<int>> V(26);
  for (int i = 0; i < N; i++) {
    V.at(S.at(i) - 'a').insert(i);
  }
  while (Q--) {
    int q;
    cin >> q;
    if (q == 1) {
      int a;
      char c;
      cin >> a >> c;
      a--;
      int now = b - 'a';
      int pre = S.at(a) - 'a';
      V.at(pre).erase(a);
      V.at(now).insert(a);
      S.at(a) = b;
    } else {
      int a, b;
      cin >> a >> b;
      a--, b--;
      int cnt = 0;
      for (int i = 0; i < 26; i++) {
        auto it1 = V.at(i).lower_bound(a);
        if (it1 == V.at(i).end()) continue;
        auto it2 = V.at(i).upper_bound(b);
        if (it1 != it2) cnt++;
      }
      cout << cnt << "\n";
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:22:17: error: 'b' was not declared in this scope
   22 |       int now = b - 'a';
      |                 ^
Language: C++

#include<bits/stdc++.h>
#define rep(i,f,n) for(ll i=(f); (i) < (n); i++)
#define repe(i,f,n) for(ll i=(f); (i) <= (n); i++)
using namespace std;
using ll = long long;

ll INF = 1e+18;
using G = vector<map<int, int>>;

int 
main()
{
  int N; cin >> N;
  vector<char> ori(N);
  rep(i, 0, N) cin >> ori[i];
  map<char, set<int>> m;
  rep(i, 0, N){
    m[ori[i]].insert(i + 1);
  }

  int Q; cin >> Q;
  rep(i, 0, Q){
    int type; cin >> type;
    if(type == 1){
      int index;
      char c;
      cin >> index >> c;
      m[c].insert(index);
      char rc = ori[index];
      m[rc].erase(index);
    } else {
      ll l, r; cin >> l >> r;
      if(l > r){
        ll tmp = l;
        l = r;
        r = tmp;
      }
      ll ans = 0;
      rep(i, 0, 26){
        if(m[(char)(97 + i)].size == 0) continue;
        ll posi = *m[(char)(97 + i)].lower_bound(l);
        if(posi >= l && posi <= r) ++ans;
      }
      cout << ans << endl;
    }
  }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:40:30: error: invalid use of member function 'std::set<_Key, _Compare, _Alloc>::size_type std::set<_Key, _Compare, _Alloc>::size() const [with _Key = int; _Compare = std::less<int>; _Alloc = std::allocator<int>; size_type = long unsigned int]' (did you forget the '()' ?)
   40 |         if(m[(char)(97 + i)].size == 0) continue;
      |                                  ()
Language: C++

#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<vector>
#include<functional>
#include<algorithm>
#include<stdlib.h>
#include<string>
#include<string.h>
#define _USE_MATH_DEFINES
#include<math.h>
#include<deque>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<iostream>
#include <bitset>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(auto i=a;i<b;i++)
#define all(_x) _x.begin(), _x.end()
#define r_sort(_x) sort(_x.begin(), _x.end(), std::greater<int>())
#define vec_cnt(_a, _n) (upper_bound(all(_a), _n) - lower_bound(all(_a), _n))
#define vec_unique(_a) _a.erase(std::unique(all(_a)), _a.end());
#define vvec vector<vector<ll>>
ll gcd(ll a, ll b) { return a % b == 0 ? b : gcd(b, a % b); }
ll lcm(ll a, ll b) { return (a / gcd(a, b)) * b; }
#define INF 1 << 30
const int mod = 1000000007;
ll power(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x *= x; p /= 2; } else { a *= x; p--; } }return a; }
ll mpower(ll x, ll p) { ll a = 1; while (p > 0) { if (p % 2 == 0) { x = x * x % mod; p /= 2; } else { a = a * x % mod; p--; } }return a; }
ll c(ll n, ll k) { ll a = 1; rep(i, 1, k) { a *= n - i + 1; a /= i; }return a; }
ll mc(ll n, ll m) { ll k = 1, l = 1; rep(i, n - m + 1, n + 1) k = k * i % mod; rep(i, 1, m + 1) l = l * i % mod; l = mpower(l, mod - 2); return k * l % mod; }
int __builtin_popcount(ll x) { int c = 0; do { if (x & 1)c++; } while (x >>= 1); return c; }
#define N 500000
int n, q, t[N << 2], lev[N];
char s[N];
void update(int k)
{
	t[k] = t[k << 1] | t[k << 1 | 1];
}
void build(int l, int r, int k)
{
	if (l == r)
	{
		lev[l] = k;
		t[k] = 1 << (s[l] - 'a'); return;
	}
	int m = l + r >> 1;
	build(l, m, k << 1); build(m + 1, r, k << 1 | 1);
	update(k);
}
void fix(int x, char c)
{
	if (s[x] == c) return;
	s[x] = c;
	x = lev[x];
	t[x] = 1 << (c - 'a');
	while (x >>= 1) update(x);
}
int query(int l, int r, int k, int x, int y)
{
	if (r<x || l>y) return 0;
	if (l >= x && r <= y) return t[k];
	int m = l + r >> 1;
	return query(l, m, k << 1, x, y) | query(m + 1, r, k << 1 | 1, x, y);
}
int main()
{
	scanf("%d%s", &n, s + 1);
	build(1, n, 1);
	scanf("%d", &q);
	while (q--)
	{
		int opt; scanf("%d", &opt);
		if (opt == 1)
		{
			int x; char c;
			scanf("%d %c", &x, &c);
			fix(x, c);
		}
		else
		{
			int l, r; scanf("%d%d", &l, &r);
			printf("%d\n", __builtin_popcount(query(1, n, 1, l, r)));
		}
	}
}

Compiler output:
a.cc:34:5: error: definition of 'int __builtin_popcount(ll)' ambiguates built-in declaration 'int __builtin_popcount(unsigned int)'
   34 | int __builtin_popcount(ll x) { int c = 0; do { if (x & 1)c++; } while (x >>= 1); return c; }
      |     ^~~~~~~~~~~~~~~~~~
Language: C++

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;


int main(){
    ll N; cin >> N;
    string S; cin >> S;
    ll Q; cin >> Q;
    vector<set<ll>> sg(26);
    rep(i, 0, 26){
        //sg[i].insert(INF);
    }
    rep(i, 0, N){
        ll d = S[i] - 'a';
        sg[d].insert(i);
    }
    rep(i, 0, Q){
        ll a; cin >> a;
        if(a == 1){
            ll x; char q;
            cin >> x >> q;
            x--;
            if(q == S[x]){
                continue;
            }
            ll e = S[x] - 'a', f = q - 'a';
            S[x] = q;
            sg[e].erase(x); sg[f].insert(x);
        }else{
            ll l, r; cin >> l >> r;
            l--; r--;
            ll c = 0;
            rep(j, 0, 26){
                if(*lower_bound(s[j].begin(), s[j].end(), l) <= r){
                    //char t = 'a' + j;
                    //prtl(t);
                    c++;
                }
            }
            prtl(c);
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:33: error: 's' was not declared in this scope
   58 |                 if(*lower_bound(s[j].begin(), s[j].end(), l) <= r){
      |                                 ^
Language: C++

#pragma GCC optimize ("O3")
#include <bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define all(x) (x).begin(),(x).end()
#define prt(x) cout << (x)
#define prtl(x) cout << (x) << endl
#define rep(i,a,b) for(ll i=a; i<b; i++)
#define rrep(i,a,b) for(ll i=a; i>b; i--)
#define mp(a, b) make_pair(a, b)
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
using namespace std;
using vi = vector<int>;
using vll = vector<long long int>;
using vb = vector<bool>;
using vvb = vector<vector<bool>>;
using vc = vector<char>;
using vvi = vector<vector<int>>;
using vvll = vector<vector<long long int>>;
using vvc = vector<vector<char>>;
using ll = long long int;
using P = pair<long long int, long long int>;
using Map = map<long long int, long long int>;
ll INF = 1LL<<60;
ll M = 1000000007;


int main(){
    ll N; cin >> N;
    string S; cin >> S;
    ll Q; cin >> Q;
    vector<set<ll>> sg(26);
    rep(i, 0, 26){
        //sg[i].insert(INF);
    }
    rep(i, 0, N){
        ll d = S[i] - 'a';
        sg[d].insert(i);
    }
    rep(i, 0, Q){
        ll a; cin >> a;
        if(a == 1){
            ll x; char q;
            cin >> x >> q;
            x--;
            if(q == S[x]){
                continue;
            }
            ll e = S[x] - 'a', f = q - 'a';
            S[x] = q;
            sg[e].erase(x); sg[f].insert(x);
        }else{
            ll l, r; cin >> l >> r;
            l--; r--;
            ll c = 0;
            rep(j, 0, 26){
                if(*lower_bound(s[j].begin(), s[j].end(), l); <= r){
                    //char t = 'a' + j;
                    //prtl(t);
                    c++;
                }
            }
            prtl(c);
        }
    }
}

Compiler output:
a.cc: In function 'int main()':
a.cc:58:33: error: 's' was not declared in this scope
   58 |                 if(*lower_bound(s[j].begin(), s[j].end(), l); <= r){
      |                                 ^
a.cc:58:63: error: expected primary-expression before '<=' token
   58 |                 if(*lower_bound(s[j].begin(), s[j].end(), l); <= r){
      |                                                               ^~
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
typedef vector<lint> vlint;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int popcount(int n){
    int res = 0;
    for (int i = 0; i < 32; ++i){
        if (n & (1 << i)) res++;
    }
    return res;
};

int bit_length(int n){
    for (int i = 31; i >= 0; --i){
        if (n & (1 << i)) return i+1;
    }
    return 1;
}
int c = 2*(1 << bit_length(500000));
struct SegmentTree{
    int n;
    // cast
    int ide;
    int tree[c];
    SegmentTree(int k, int id){
        ide = id;
        n = k;
        if (popcount(n) > 1){
            n = 1 << bit_length(n);
        }
        for (int i = 0; i < 2 * n; ++i){
            tree[i] = ide;
        }
    }
    // rewrite
    int func(int a, int b){
        return a | b;
    };
    void update(int i, int x){
        i += n-1;
        tree[i] = x;
        while (i > 1){
            i /= 2;
            tree[i] = func(tree[2*i], tree[2*i+1]);
        };
    };
    int query(int a, int b, int k, int l, int r){
        if (r <= a || b <= l) return ide;
        if (a <= l && r <= b) return tree[k];

        return func(
            query(a, b, k*2, l, (l+r)/2),
            query(a, b, k*2+1, (l+r)/2, r)
        );
    };
};

int main(){
    int n;
    string s; cin >> n >> s;
    SegmentTree st(n, 0);
    for (int i = 1; i <= n; i++){
        st.update(i, 1 << (int)(s[i-1] - 'a'));
    }
    int q, type, l, r, res;
    char t;
    cin >> q;
    rep(i, q){
        cin >> type >> l;
        if (type == 1){
            cin >> t;
            st.update(l, 1 << (int)(t - 'a'));
        }
        else if (type == 2)
        {
            cin >> r;
            res = st.query(l, r+1, 1, 1, st.n+1);
            cout << popcount(res) << "\n";
        }
        
    }
}

Compiler output:
a.cc:27:14: error: size of array 'tree' is not an integral constant-expression
   27 |     int tree[c];
      |              ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1LL<<62
#define inf 1000000007

int main() {
	ll n;
	string s;
	set<ll>a[26];
	cin>>n>>s;
	ll m;
	cin>>m;
	for(ll i=0;i<n;i++){
		ll now=s[i]-'a';
		a[now].insert(i);
//		cout <<now<< " "<<i<<endl;
	}
	for(ll i=0;i<26;i++){
		a[i].insert(inf);
	}
	for(ll i=0;i<m;i++){
		ll now;
		cin>>now;
//		cout << now<<" ";
		if(now==2){
			ll cnt=0;
			ll l,r;
			cin>>l>>r;
			l--;r--;
			for(ll j=0;j<26;j++){
			//	auto itr=lower_bound(a[j].begin(),a[j].end(),l);
								//	cout << *itr<< "itr"<<j<<"j"<<endl;
				if(*itr<=r){

					cnt++;
				}
			}
			cout << cnt<<endl;
		}
		if(now==1){
			ll l;char t;
			cin>>l>>t;
			l--;
			ll nex=t-'a';
			ll be=s[l]-'a';
			s[l]=t;
			a[be].erase(l);
			a[nex].insert(l);
		}
	}
	// your code goes here
	return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:37: error: 'itr' was not declared in this scope
   34 |                                 if(*itr<=r){
      |                                     ^~~
Language: C++

int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	vector<set<int> > SET(26, set<int> {INF});
	for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
	for(int i = 0; i < q; i++){
		int type; cin >> type;
		if(type == 1){
			int l; cin >> l; char c; cin >> c; --l;
			if(s[l] != c){
			  SET[s[l] - 'a'].erase(i);
			  SET[c - 'a'].insert(i);
			  s[l] = c;
			}
		}
		if(type == 2){
			int l, r; cin >> l >> r; --l;
			int c = 0;
			for(int j = 0; j < 26; j++){
				if(SET[j].empty()) continue;
				if(*SET[j].lower_bound(l) < r) c++;
			}
			cout << c << endl;
		}
	}
}


Compiler output:
a.cc:1:8: error: 'cin' does not name a type
    1 | int n; cin >> n;
      |        ^~~
a.cc:2:9: error: 'string' does not name a type
    2 |         string s; cin >> s;
      |         ^~~~~~
a.cc:2:19: error: 'cin' does not name a type
    2 |         string s; cin >> s;
      |                   ^~~
a.cc:3:16: error: 'cin' does not name a type
    3 |         int q; cin >> q;
      |                ^~~
a.cc:4:9: error: 'vector' does not name a type
    4 |         vector<set<int> > SET(26, set<int> {INF});
      |         ^~~~~~
a.cc:4:49: error: expected unqualified-id before ')' token
    4 |         vector<set<int> > SET(26, set<int> {INF});
      |                                                 ^
a.cc:5:9: error: expected unqualified-id before 'for'
    5 |         for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
      |         ^~~
a.cc:5:24: error: 'i' does not name a type
    5 |         for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
      |                        ^
a.cc:5:31: error: 'i' does not name a type
    5 |         for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
      |                               ^
a.cc:6:9: error: expected unqualified-id before 'for'
    6 |         for(int i = 0; i < q; i++){
      |         ^~~
a.cc:6:24: error: 'i' does not name a type
    6 |         for(int i = 0; i < q; i++){
      |                        ^
a.cc:6:31: error: 'i' does not name a type
    6 |         for(int i = 0; i < q; i++){
      |                               ^
a.cc:26:1: error: expected declaration before '}' token
   26 | }
      | ^
Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1e9;

signed main(){
	int n; cin >> n;
	string s; cin >> s;
	int q; cin >> q;
	vector<set<int> > SET(26, set<int> {INF});
	for(int i = 0; i < n; i++) SET[s[i] - 'a'].insert(i);
	/*for(int i = 0; i < q; i++){
		int type; cin >> type;
		if(type == 1){
			int l; cin >> l; char c; cin >> c; --l;
			if(s[l] != c){
			  SET[s[l] - 'a'].erase(i);
			  SET[c - 'a'].insert(i);
			  s[l] = c;
			}
		}
		if(type == 2){
			int l, r; cin >> l >> r; --l;
			int c = 0;
			for(int j = 0; j < 26; j++){
				if(SET[j].empty()) continue;
				if(*SET[j].lower_bound(l) < *SET[j].lower_bound(r)) c++;
			}
			cout << c << endl;
		}
	}*/
    for(int i = 0; i < Q; i++){
    int t; cin >> t;
    if(t == 1){
      int l; char c; cin >> l >> c; --l;
      if(s[l] != c){
        SET[s[l] - 'a'].erase(l);
        SET[c - 'a'].insert(l);
        s[l] = c;
      }
    }
    if(t == 2){
      int l, r; cin >> l >> r; --l;
      int ans = 0;
      for(int c = 0; c < 26; c++){
        if(SET[c].empty()) continue;
        if(*SET[c].lower_bound(l) < *SET[c].lower_bound(r)) ans++;
      }
      cout << ans << '\n';
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:32:24: error: 'Q' was not declared in this scope
   32 |     for(int i = 0; i < Q; i++){
      |                        ^
Language: C++

//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
#define INF 1000000000 //10^9:極めて大きい値,∞
#define MOD 1e+9+7 //10^9+7
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>=(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入
int main(){
    int N,Q;
    string S;
    cin >> N;
    cin >> S;
    auto alphabet;
    vector<set<int>> a(26,{INF});
    REP(i,N){
        alphabet=S[i]-'a';
        a[alphabet].insert(i);
    }

    int ans;
    cin >> Q;
    vector<int> t(Q),num(Q),l(Q),r(Q);
    vector<char> c(Q);
    REP(i,Q){
        cin >> t[i];
        if(t[i]==1){
            cin >> num[i] >> c[i];num[i]--;
        }else{
            cin >> l[i] >> r[i];l[i]--;
        }
    }

    REP(i,Q){
        if(t[i]==1){
            alphabet=S[num[i]]-'a';
            a[alphabet].erase(num[i]);
            alphabet=c[i]-'a';
            a[alphabet].insert(num[i]);
        }else{
            ans=0;
            REP(j,26){
                int lid = *a[j].lower_bound(l[i]);
                int rid = *a[j].lower_bound(r[i]);
                if(rid>lid) ans++;
            }
            cout << ans << endl;
        }

    }
    
}

Compiler output:
a.cc: In function 'int main()':
a.cc:34:5: error: declaration of 'auto alphabet' has no initializer
   34 |     auto alphabet;
      |     ^~~~
Language: C++

//ヘッダー
#include<bits/stdc++.h>
using namespace std;

//型定義
typedef long long ll;

//定数
#define INF 1000000000000 //10^12:極めて大きい値,∞
#define MOD 1e+9+7 //10^9+7
#define MAXR 100000 //10^5:配列の最大のrange(素数列挙などで使用)

//REPマクロ
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define REP2(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define REPD2(i,a,b) for(ll i=a;i>=(ll)(b);i--)

//vectorの扱い
#define ALL(x) (x).begin(),(x).end() //sortなどの引数省略
#define SIZE(x) ((ll)(x).size()) //size
#define MAX(x) *max_element(ALL(x)) //最大値
#define MIN(x) *min_element(ALL(x)) //最小値

//グローバル変数


//ライブラリ挿入
struct SegmentTree {
private:
    int n;
    vector<int> node;
public:
    SegmentTree(vector<int> v) {
        int sz = (int)v.size();
        n = 1; while(n < sz) n *= 2;
        node.resize(2*n-1, 0);

        for(int i=0; i<sz; i++) node[i+n-1] = v[i];
        for(int i=n-2; i>=0; i--) node[i] = node[i*2+1] + node[i*2+2];
    }

    void add(int k, int val) {
        k += (n - 1);
        node[k] += val;

        while(k > 0) {
            k = (k - 1) / 2;
            node[k] = node[2*k+1] + node[2*k+2];
        }
    }

    int getsum(int a, int b, int k=0, int l=0, int r=-1) {
        if(r < 0) r = n;
        if(b <= l || r <= a) return 0;
        if(a <= l && r <= b) return node[k];

        int vl = getsum(a, b, 2*k+1, l, (l+r)/2);
        int vr = getsum(a, b, 2*k+2, (l+r)/2, r);
        return vl + vr;
    }
};


int main(){
    int N,Q;
    string S;
    cin >> N;
    cin >> S;
    vector<SegmentTree> seg(26,vector<int>(N, 0));
    int alphabet;
    REP(i,S.size()){
        alphabet=S[i]-'a';
        seg[alphabet].add(i,1);
    }

    int ans;
    cin >> Q;
    vector<int> t(Q),num(Q),l(Q),r(Q);
    vector<char> c(Q);
    REP(i,Q){
        cin >> t[i];
        if(t[i]==1) cin >> num[i] >> c[i];
        else cin >> l[i] >> r[i];
        
    }
    REP(i,Q){
        if(t[i]==1){
            alphabet=S[i]-'a';
            seg[alphabet].add(num[i]-1,-1);
            alphabet=c[i]-'a';
            seg[alphabet].add(num[i]-1,1);
            S[i]=c[i]
        }else{
            ans=0;
            REP(j,26){
                if(seg[j].getsum(l[i]-1,r[i])!=0) ans++;
            }
            cout << ans << endl;   
        }
    }
    


}

Compiler output:
a.cc: In function 'int main()':
a.cc:93:22: error: expected ';' before '}' token
   93 |             S[i]=c[i]
      |                      ^
      |                      ;
   94 |         }else{
      |         ~
Language: C++

#include <iostream>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <math.h>
#include <queue>
#include <deque>
#include <map>
#include <set>
const int MOD = 1e9+7;
typedef long long ll;
using namespace std;

int ctoi(char c){
	return c - 'a';
}


int main(){
	int n, q;
	string s;
	cin >> n >> s >> q;
	vector<set<int> > st(26);
	for (int i = 0; i < s.length(); i++){
		st[ctoi(s[i])].insert(i);
	}
	for (int i = 0; i < q; i++){
		int x;
		cin >> x;
		if (x == 1){
			int a;
			char c;
			cin >> a >> c;
			st[ctoi(s[a-1])].erase(a-1);
			st[ctoi(c)].insert(a-1);
		}else{
			int a, b;
			cin >> a >> b;
			int coun = 0;
			for (int i = 0; i < 26; i++){
				if (st[i].empty()) continue;
				auto iter1 = st[i].lower_bound(a-1);
				if (*iter1 <= b-1 && iter1 != s[i].end()) coun++;
			}
			cout << coun << endl;
		}
	}
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:44:68: error: request for member 'end' in 's.std::__cxx11::basic_string<char>::operator[](((std::__cxx11::basic_string<char>::size_type)i))', which is of non-class type '__gnu_cxx::__alloc_traits<std::allocator<char>, char>::value_type' {aka 'char'}
   44 |                                 if (*iter1 <= b-1 && iter1 != s[i].end()) coun++;
      |                                                                    ^~~
Language: C++

#include<iostream>
#include<set>

#define N 500000+1
#define Q 20000

char S[N];

using namespace std;

int main(void){
	int n;//not use
	int q;
	
	cin >> n;//not use, dummy input
	cin >> S;
	cin >> q;
	
	set<char> letters;
	char* pt;
	
	rep(j, q){
		int type;
		cin >> type;
		
		if(type == 1){
			int i;
			char c;
			
			cin >> i;
			cin >> c;
			
			S[i-1] = c;
			
		}else{
			int l;
			int r;
			
			cin >> l;
			cin >> r;
			
			
			letters.clear();
			for(pt = &S[l-1]; pt < &S[r]; pt++){
				letters.insert(*pt);
			}
			cout << letters.size() << endl;
		}
	}
	
	return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:22:13: error: 'j' was not declared in this scope
   22 |         rep(j, q){
      |             ^
a.cc:22:9: error: 'rep' was not declared in this scope
   22 |         rep(j, q){
      |         ^~~
Language: C++

#include"bits/stdc++.h"
using namespace std;
const int INF = 1e9;


signed main(){
    int N;
    cin >> N;
    string s;
    cin >> s;
    int Q;
    cin >> Q;
    vector<set<int>> alp(26,set<int> {INF});
    for(int i=0;i<N;i++){
        alp[s[i]-'a'].insert(i);
    ;}


    for(int i=0;i<Q;i++){
        int t;
        cin >> t;
        if(t==1){
            int a;
            cin >> a;a--;
            char c;
            cin >> c;
            if(s[a]!=c)alp[s[a]-'a'].erase(a);
            s[a]=c;
            alp[c-'a'].insert(a);
        }
        else if(t==2){
            int ans=0;
            int l;
            cin >> l;l--;
            int r;
            cin >> r;
            for(int j=0;j<26;j++){
                if(alp[j].empty())continue;
                if(*alp[c].lower_bound(l) < *alp[c].lower_bound(r))ans++;
            ;}
            cout<<ans<<endl;
        }
    }


    
}


Compiler output:
a.cc: In function 'int main()':
a.cc:39:25: error: 'c' was not declared in this scope
   39 |                 if(*alp[c].lower_bound(l) < *alp[c].lower_bound(r))ans++;
      |                         ^
Language: C++

#include "bits/stdc++.h"
using namespace std;
const int INF = 1e9;

signed main(){
  int N; cin >> N;
  string s; cin >> s;
  int Q; cin >> Q;
  vector<set<int> > alp(26, set<int> {INF});
  for(int i = 0; i < N; i++) alp[s[i] - 'a'].insert(i);
  
  for(int i = 0; i < Q; i++){
    int t; cin >> t;
    if(t == 1){
      int i; char c; cin >> i >> c; --i;
	  if(s[i] != c) S[s[i] - 'a'].erase(i);
		s[i] = c;
		S[c-'a'].insert(i);
    }
    if(t == 2){
      int ans = 0;
      int l, r; cin >> l >> r; --l;
      for(int c = 0; c < 26; c++){
        if(alp[c].empty()) continue;
        if(*alp[c].lower_bound(l) < *alp[c].lower_bound(r)) ans++;
      }
      cout << ans << endl;
    }
  }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:16:25: error: 'S' was not declared in this scope
   16 |           if(s[i] != c) S[s[i] - 'a'].erase(i);
      |                         ^
a.cc:18:17: error: 'S' was not declared in this scope
   18 |                 S[c-'a'].insert(i);
      |                 ^
Language: C++

#include<bits/stdc++.h>
using namespace std; 
int main() 
{long long n,q,a,b,c;cin>>n;
 char d;
 string s,str;cin>>s;
 long long r,ans=0;
 cin>>q;
 while(q--)
 {cin>>a;
  if(a==1)
  {cin>>b>>d;
   b--;
   s[b]=d;
  }
  else{
  cin>>b>>c;
    b--,c--;
    //str=s.substr(b,(c-b+1));
    for(char p='a';p<='z';i++)
    {r=find(s.begin()+b,s.begin()+c,p)-s.begin();
     if(r>c or r<b)continue;
     else ans++;
    }
    cout<<ans<<"\n";ans=0;
  }
 }
 return 0;
}


Compiler output:
a.cc: In function 'int main()':
a.cc:20:27: error: 'i' was not declared in this scope
   20 |     for(char p='a';p<='z';i++)
      |                           ^
Language: C++

#include<bits/stdc++.h>
using namespace std; 
int main() 
{long long n,q,a,b,c;cin>>n;
 char d;
 string s,str;cin>>s;
 cin>>q;
 while(q--)
 {cin>>a;
  if(a==1)
  {cin>>b>>d;
   b--;
   s[b]=d;
  }
  else{
  cin>>b>>c;
    b--,c--;
    str=s.substr(s.begin()+b,(c-b+1));
    std::unordered_set<char> log;

str.erase(std::remove_if(str.begin(), str.end(), [&] (char const c) { return !(log.insert(c).second); }), str.end());
  cout<<str.size()<<"\n";
  }
 }
}


Compiler output:
a.cc: In function 'int main()':
a.cc:18:27: error: cannot convert '__gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >' to 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'}
   18 |     str=s.substr(s.begin()+b,(c-b+1));
      |                  ~~~~~~~~~^~
      |                           |
      |                           __gnu_cxx::__normal_iterator<char*, std::__cxx11::basic_string<char> >
In file included from /usr/include/c++/14/string:54,
                 from /usr/include/c++/14/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52,
                 from a.cc:1:
/usr/include/c++/14/bits/basic_string.h:3208:24: note:   initializing argument 1 of 'std::__cxx11::basic_string<_CharT, _Traits, _Alloc> std::__cxx11::basic_string<_CharT, _Traits, _Alloc>::substr(size_type, size_type) const [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>; size_type = long unsigned int]'
 3208 |       substr(size_type __pos = 0, size_type __n = npos) const
      |              ~~~~~~~~~~^~~~~~~~~
Language: C++

#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i < (n+1); ++i)
using namespace std;
using ll = long long;
const int INF = +100100100;
typedef pair<int,int> P;


int main(){
    int n,q;
    string s;
    cin >> n >> s >> q;
    // set<char> C;
    vector<set<int>> is(26);
    rep(i,n){
        is[s[i]-'a'].insert(i);
    }
    rep(i,q){
        int ty;cin>>ty;
        if(ty==1){
            int ac;char x;
            cin >> ac>>x;
            --ac;
            is[s[ac]-'a'].erase(ac));
            s[ac]=x;
            is[s[ac]-'a'].insert(ac);
        }else{
            int l,r;cin>>l>>r;
            --l;
            // cout << endl;
            int ans = 0;
            rep(i,26){
                auto it = is[i].lower_bound(l);
                if(it!=is[i].end()&&*it<r)++ans;
            }
            // cout << endl;
            cout << ans << endl;
        }
    }
    return 0;
}

Compiler output:
a.cc: In function 'int main()':
a.cc:26:36: error: expected ';' before ')' token
   26 |             is[s[ac]-'a'].erase(ac));
      |                                    ^
      |                                    ;