Help with the code of "help ram" problem code- aba14a

this is my C code which i wrote,but it is generating wrong answer error…can anyone please help me with any special case m missing:???


    long long int prime(long long int); 
int main() { long long int t,tt,a,b,j=0,arr[100]; scanf("%lld",&t); if (t>100) return -1; tt=t; while(t--) { scanf("%lld%lld",&a,&b); if (a > b || a < 2) return -1; if(prime(b) && b!=a) arr[j++]=b-1; else if (prime(b) == 0) arr[j++]=b; else arr[j++]=-1; } for (j=0;j<tt;j++) printf("%lld\n",arr[j]); return 0; }
    long long int prime(long long int b) { int k=2,c; if (b==2) return 1; if (b==3) return 1; if (b%2==0) return 0; c=sqrt(b); //printf("%d\n",c); while(b%k!=0) { if (k==c) break; k++; } if (k == c) return 1; else return 0;