sir, my solution is giving tle although all test cases are giving correct output, pls tell me how to optimise it ?
#include<stdio.h>
int main()
{
int t;
long long int n,i,k,s,m;
scanf("%d\n",&t);
while(t–)
{ s=0;
scanf("%lld\n",&n);
for(i=1 ; i<=n/2 ;i++)
{
s =( (s%1000000007)+(n%i));
}
if(n%2==0){
k=-1+n/2;m=((k+1)k/2);
}
else {k =n/2;
m=(k(k+1)/2);}
printf("%lld\n",(((n*n))-(s%1000000007)-m)%1000000007);
}
return 0;
}