#include using namespace std; #define ll long long #define ull unsigned long long #define ld long double #define pi pair #define pii vector > #define v vector #define vi vector #define f(a,i,n) for(int i=a;i>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;} int inv(int a, int p = MOD) {return fpow(a, p - 2, p);} ll spf[MAX+1]; void sieve()//complexity = approx 3*10^6 { f(1,i,MAX) {spf[i]=i;} for(ll i=2;i>a; ll n=a.size(); vfreq(26,vi(n,0)); vpre(26,vi(n,0)); f(0,i,n) { freq[a[i]-'a'][i]++; } f(0,i,26) pre[i][0]=freq[i][0]; f(0,i,26) { f(1,j,n) { pre[i][j]=pre[i][j-1]+freq[i][j]; } } /*f(0,i,26) { f(0,j,n) { cout<>q; while(q--) { ll l,r; cin>>l>>r; l--;r--; vi freq_in_range(26,0); if(l!=0) { f(0,i,26) { freq_in_range[i]=pre[i][r]-pre[i][l-1]; } } else { f(0,i,26) { freq_in_range[i]=pre[i][r]; //cout<