RT,只过了一个点
#pragma GCC target("ssse3","sse3","sse2","sse","avx2","avx")
#include<bits/stdc++.h>
#define N 1005
#define ll long long
#define test_time 8
#define Mod 19260817
using namespace std;
int n,m,block,num[100005],prime[100005],cnt,a[100005];
int pre[100005][205],factor[100005][15],tot[100005];
int b[400005],cnt1,len,l=1,r,ans=1,cnt2[400005],inv[400005]={0,1};
bool vis[100005];
unordered_map<int,int>pos;
struct node {
int l,r,p,res;
} q[100005];
inline bool cmp1(node x,node y) {
if(num[x.l]!=num[y.l])return x.l<y.l;
if(num[x.l]&1)return x.r<y.r;
return x.r>y.r;
}
inline bool cmp2(node x,node y){
return x.p<y.p;
}
inline int fpow(int x,int y,int mod) {
int res=1;
while(y) {
if(y&1)res=((ll)res*x)%mod;
x=((ll)x*x)%mod;
y>>=1;
}
return res;
}
inline bool Miller_Rabin(int x) {
if(x<2)return 0;
if(x<=3)return 1;
int p=0,sum=x-1,t;
while(sum%2==0)sum/=2,p++;
for(int i=1; i<=test_time; i++) {
int a=rand()%(x-2)+2;
t=fpow(a,sum,x);
if(t==1||t==x-1)continue;
int j;
for(j=0; j<p; j++) {
t=((ll)t*t)%x;
if(t==p-1)break;
}
if(t!=p-1)return 0;
}
return 1;
}
inline int f(int x,int y,int mod) {
return ((ll)x*x+y)%mod;
}
inline int Pollard_Rho(int x) {
int c=rand()%(x-1)+1,r1=0,r2=0,val=1;
for(int i=1;;i<<=1,r1=r2,val=1) {
for(int j=1; j<=i; j++) {
r2=f(r2,c,x);
val=((ll)val*abs(r1-r2))%x;
if(j%127==0) {
int gcd=__gcd(val,x);
if(gcd>1)return gcd;
}
}
int gcd=__gcd(val,x);
if(gcd>1)return gcd;
}
return x;
}
inline void fac(int x,int now) {
if(x<=prime[cnt])return;
if(Miller_Rabin(x)) {
factor[now][++tot[now]]=x,b[++cnt1]=x;
return;
}
int res=x;
while(res==x)res=Pollard_Rho(x);
while(x%res==0)x/=res;
fac(x,now),fac(res,now);
}
inline void add(int now){
int cnt3,temp=a[now];
for(int j=1;j<=tot[now];j++){
cnt3=0;
while(temp%factor[now][j]==0)temp/=factor[now][j],cnt3++;
ans=((ll)ans*inv[cnt2[pos[factor[now][j]]]])%Mod;
cnt2[pos[factor[now][j]]]+=cnt3;
ans=((ll)ans*cnt2[pos[factor[now][j]]])%Mod;
}
}
inline void del(int now){
int cnt3,temp=a[now];
for(int j=1;j<=tot[now];j++){
cnt3=0;
while(temp%factor[now][j]==0)temp/=factor[now][j],cnt3++;
ans=((ll)ans*inv[cnt2[pos[factor[now][j]]]])%Mod;
cnt2[pos[factor[now][j]]]-=cnt3;
ans=((ll)ans*cnt2[pos[factor[now][j]]])%Mod;
}
}
int main() {
scanf("%d%d",&n,&m);
block=sqrt(n);
for(int i=2;i<=2*n;i++)inv[i]=((ll)inv[Mod%i]*(Mod-Mod/i))%Mod;
for(int i=1; i<=n; i++)scanf("%d",&a[i]),num[i]=(i-1)/block+1;
for(int i=1; i<=m; i++)scanf("%d%d",&q[i].l,&q[i].r),q[i].p=i,q[i].res=1;
sort(q+1,q+m+1,cmp1);
for(int i=2; i<=N; i++) {
if(!vis[i])prime[++cnt]=i;
for(int j=1; j<=cnt&&i*prime[j]<=N; j++) {
vis[i*prime[j]]=1;
if(i%prime[j]==0)break;
}
}
for(int i=1; i<=n; i++) {
for(int j=1; j<=cnt; j++) {
while(a[i]%prime[j]==0)a[i]/=prime[j],pre[i][j]++;
pre[i][j]+=pre[i-1][j];
}
}
for(int i=1;i<=n;i++)fac(a[i],i);
sort(b+1,b+cnt1+1);
len=unique(b+1,b+cnt1+1)-b-1;
for(int i=1;i<=len;i++)pos[b[i]]=lower_bound(b+1,b+len+1,b[i])-b,cnt2[i]=1;
for(int i=1;i<=m;i++){
while(q[i].l<l)add(--l);
while(q[i].r>r)add(++r);
while(q[i].l>l)del(l++);
while(q[i].r<r)del(r--);
for(int j=1;j<=cnt;j++)
q[i].res=((ll)q[i].res*(pre[q[i].r][j]-pre[q[i].l-1][j]+1))%Mod;
q[i].res=((ll)q[i].res*ans)%Mod;
}
sort(q+1,q+m+1,cmp2);
for(int i=1;i<=m;i++)printf("%d\n",q[i].res);
}