please help me and suggest me any error or additions to the code
i am getting the correct output that is mentioned in the example but the codechef is not accepting it
#include<stdio.h>
#define mod 1000000007
int n,ar[100001];
int query1(int x)
{
int sum = 0 ;
for(int i=x;i<=n;i+=x)
sum = sum + ((ar[i]*ar[i])%mod);
return sum%mod ;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int q,i,qt,x,y;
scanf("%d %d",&n,&q);
for(i=1;i<=n;i++)
scanf("%d",&ar[i]);
while(q--)
{
scanf("%d",&qt);
if(qt==1)
{
scanf("%d",&x);
printf("%d\n",query1(x));
}
if(qt==2)
{
scanf("%d %d",&x,&y);
ar[x]=y;
}
}
}
return 0;
}