# Help in FCTRE

bool comp(query a , query b)
{
int x = a.l/BLK;
int y = b.l/BLK;

``````if(x != y)
return x < y;

return x % 2 ? a.r < b.r : a.r > b.r;
``````

}

if x==y then then u are sorting values according to r , then why are u using x%2?

modular multiplicative inverse means like this
(6/2)%5 =(6%5)((multiplicative inverse of 2%5)%5)%5=(6%5)(3%5)%5 =3%5=3.
what is its importance?

can anyone help me to find error in the code FCTRE, everything looks correct, unable to detect the error
https://www.codechef.com/viewsolution/31975002

when x == y
we need to sort queries based on R pointer (true) but we wonâ€™t always sort queries as a.r < b.r
we try to minimize the movement of right pointer more by sorting queries as
a.r < b.r if block size of first query is odd
otherwise
a.r > b.r

you are making mistake in init( ) function

``````for(ll j=2*i;j<=N;j++)
{
ll cnt=0;
ll x=j;
while(x%i==0)
{
cnt++;
x/=i;
}

ar[j].pb({i,cnt});

}
``````

here you have written j++ in the for loop
it should be j += i