#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
int b,x,y,count=0;;
int t[n];
cin>>b;
for(int i=0;i<b;i++){
cin>>x;
cin>>y;
count =0;
for(int j=0;j<n;j++){
if(x%a[j]==0 and x>=a[j]){
count++;
}
}
cout<<count;
cout<<endl;
for(int j=0;j<b;j++){
if(count==y){
t[i]=1;
}
else{
t[i]=-1;
}
}
}
for(int i =0;i<b;i++){
if(t[i]==1){
cout<<"Yes";
cout<<endl;
}
else{
cout<<"No";
cout<<endl;
}
}
return 0;
}
this is the code ,its correct but the test cases are coming false,whats the mistake