Help me in solving P2149 problem

My issue

i am creating logic but somewhere it is wrong

My code

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

int main() {
	// your code goes here
int t;
cin>>t;
while(t--)
{
    int a, b, x;
    cin>>a>>b>>x;
    int count =0;
    int blue = x*x;
    int red = a*b;
    while(blue<red){
        if(a<b)
        {
            b = b-a;
            red = a*b;
            count++;
        }
        else
        {
            a = a-b;
            red=a*b;
            count++;
        }
        
    }
    
    if(blue>=red){
    cout<<count<<endl;
    }
    
}
}

Problem Link: Magical World Practice Coding Problem