Again i am getting tle in test case 1,wrong answer in test case 2

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

int main(){
int t;
cin>>t;
while(t–)
{
int a,b;
cin>>a>>b;
int arr[b-a+1];
for(int i=a;i<=b;i++)
arr[i-a]=i;
if(a==1)
arr[0]=0;
for(int i=2;i<=b;i++)
{
int p=pow(i,2);
int j=0;
if(p<=b)
{
while(j<b-a+1)
{
if(arr[j]>=p && arr[j]%i==0)
{
arr[j]=0;
j+=i;
}
else
j++;
}
}
else
break;
}
int c=0;
for(int i=0;i<b-a+1;i++)
{
if(arr[i]!=0)
c++;
}
cout<<c<<endl;
}

}

hey @Avishek-Kumar-2445349249011561, contraints are very high in question so you need to use prime seive to calculate prime numbers

i have used the same…

hey @Avishek-Kumar-2445349249011561, please share your code saved in https://ide.codingblocks.com/ as text gets mismatched here