question link=https://www.codechef.com/submit/DIGARR
my code=#include
using namespace std;

int main() {

int t;
cin>>t;
while(t--){
long long int d;
int n,count=0;
cin>>n;
cin>>d;
while(d!=0){
int ans = d%10;
if(ans==5||ans==0){
count +=1;
}
d=d/10;
}
if(count==0){
cout<< "NO"<<endl;
}
else{
cout<< "YES"<<endl;
}
}
return 0;

Constraints
1≤N<10^1000
The number N won’t fit into a long long and
D comes before N in the Input and D does describe the length of the string N and not the other way around (which I find odd)

Hello Manish;
In question it is given that you have to rearrange in such a way that it gives reminder 0.
So your code is not working when we have the input like "001"and as per your code the while loop is exit when we get the digit ‘0’ but as we know that we have to rearrange and after rearrange it becomes “100” which is completely divisible by “5”.
I hope it help you.