What is wrong in my solution in the problem make smaller bigger(MSB)

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

int main() {
int t;
cin >> t;
while(t–){
long long int a, b, x, y;
cin >> a >> b >> x >> y;
if(a >= b){
cout << 0 << endl;
continue;
}
if(x == 1 && y == 1){
cout << -1 << endl;
continue;
}

// Now to count how many opreation does multiplication and division need

    long long int count1 = 0, count2 = 0;

// For multiplication First found division of b to a
long long int tmp = b/a;
if(b%a != 0) tmp++;
if(x!=1){
// Now after calculating division i calculate how many time should i multiply x to get bigger than b/a
while(tmp > 1) {
count1++;
long long int temp = tmp;
tmp = tmp/x;
if(temp%x != 0) tmp++;
}
}
// for second count i simply divide b to y and get count2
if(y!=1){
while(b > a){
count2++;
b = b/y;
}
}
// Now answer
long long int ans = 0;
if(count1 == 0) ans = count2; // if x == 1 && y != 1
else if(count2 == 0) ans == count1; // if y == 1 && x != 1
else ans = min(count1, count2); // if y != 1 && x != 1
cout << ans << endl;

}
return 0;

}