It is giving correct answers to all the custom test cases. I’m not able to figure out, for which test case, it is giving wrong answer.

Q: You are given an integer N and a digit D. Find the minimum integer you should add to N such that the final value of N does not contain the digit D.

ll fun(ll n, ll orn){ // ll is long long

int z=0; ll temp=orn;

```
while(n%10==0){
z++;
n/=10;
}
if(z>=2){
int i=0;
for(; i<z; i++){
n=n*10+1;
}
}
return n;
```

}

int main(){

```
int t; cin>>t;
while(t--){
stack<int>s;
ll n, d; cin>>n>>d;
ll ans=0; ll temp=n;
temp=n;
li pos=0; // li long int
li cnt=0;
while(temp!=0){
int rem=temp%10;
pos++;
if(rem==d){
cnt=pos;
while(!s.empty()) s.pop();
}
else s.push(rem);
temp/=10;
}
while(!s.empty()){
int temp2=s.top();
s.pop();
ans+=temp2*pow(10, pos);
pos--;
}
ans+=(d+1)*pow(10, cnt);
if(ans%10==0 and d==0) {
cout<<fun(ans, n)/10-n<<endl;
continue;}
cout<<(ans/10)-n<<endl;
}
return 0;
```

}