Help me in solving SLOWSOLN problem

My issue

give wrong answer for last two input but when the inputs are run as first test case code gave right answer what is the problem

My code

#include <iostream>
using namespace std;

int main() {
	int tc;
	cin>>tc;
	while(tc--)
	{
	    long long maxT,maxN,maxS;
	    long long ans;
	    cin>>maxT>>maxN>>maxS;
	    long long count , r;
	    while (maxS>=maxN)
	    { 
	        maxS=maxS-maxN;
	        count++;
	    }
	    if (maxT<count)
	    {
	        ans = maxT*(maxN*maxN);
	    }
	    else
	    {
	        ans = count*(maxN*maxN)+ (maxS*maxS);
	    }
	    cout<<ans<<"\n";
	}   
	return 0;
}

Problem Link: SLOWSOLN Problem - CodeChef

@nk_23
initialise count=0 and in if condition it will be maxT<=count