Help me in solving SLOWSOLN problem

My issue

I have a doubt, the algorithm looks fine, but why isn’t it working

My code

#include <stdio.h> 
void MaxIterations(int maxT, int maxN,int sumN) 
{
    int Sum=0,testcases=1; 
    while(sumN>=maxN && maxT>0) 
    {
        Sum+=maxN*maxN;
        sumN=sumN-maxN;
        maxT--;
    }
    if(sumN<maxN) 
    {
printf("%d\n",Sum+sumN*sumN); 
}
else 
{
    printf("%d\n",Sum); 
}
}
int main() 
{
    int T; scanf("%d",&T); 
    while(T--) 
    {
        int maxT,maxN, sumN; scanf("%d %d %d",&maxT, &maxN, &sumN); 
        MaxIterations(maxT, maxN,sumN);
    }
}

Problem Link: Slow Solution Practice Coding Problem