Can someone really help to find runtime error in code.

link to ques. TRISQ Problem - CodeChef
link to sol. CodeChef: Practical coding for everyone
One needs to find No. of squares in a triangle

What you are doing is that for all the t i.e test cases you take the input and then give output for all simultaneously which is wrong.

You need to take input and just after that give output and then again take input and so on.
here is my solution

#include<iostream>

using namespace std;

int main()

{

int t;cin>>t;

while(t--)

{

	int n;

	cin>>n;

	n=n/2;

	n= n-1;

	n = (n*(n+1))/2;

	cout<<n<<endl;

}

}

What you are doing is that for all the t i.e test cases you take the input and then give output for all simultaneously which is wrong.

You need to take input and just after that give output and then again take input and so on.
here is my solution

#include<iostream>

using namespace std;

int main()

{

int t;cin>>t;

while(t--)

{

	int n;

	cin>>n;

	n=n/2;

	n= n-1;

	n = (n*(n+1))/2;

	cout<<n<<endl;

}

}