Help me in solving SLOWSOLN problem

My issue

My code

#include <iostream>
using namespace std;

int main() {
	// your code goes here'
	int z;
	cin>>z;
	while(z--){
	    long long int t,n,sum,add=0;
	    cin>>t>>n>>sum;
	    long long int x,y,k;
	    x=sum/n;
	    y=sum%n;
	    /*if(y!=0){
	        k=x+1;
	    }
	    else{
	        k=x;
	    }*/
	    k=x;
	    if(t<=k){
	        for(long long int i=0;i<t;i++){
	            add=add+(n*n);
	        }
	        add=add+(y*y);
	    }
	    else{
	        for(long long int i=0;i<k;i++){
	            add=add+(n*n);
	        }
	        add=add+(y*y);
	    }
	    cout<<add<<endl;
	}
	return 0;
}

Problem Link: SLOWSOLN Problem - CodeChef

@aditya_knit
In case u got t<=k then u won’t be adding y*y into answer cozz it will exceed tmax which is not possible.
so just comment that part rest is correct .

thanks