September 2021 cohort is finalized with 45 amazing folks. For future cohorts Join the waitlist

TRICOUNT Solution



#include <stdio.h>

int main( int argc , char * argv[] ) {

	int t ;

	scanf("%d" , &t);

	while ( t-- ) {
		long long int n;
		scanf("%lld" , &n);
		printf("%lld\n" , (n*(n+2)*(2*n+1))/8 );
	}

	return 0;
}

470+ Competitive Programming Solutions

If you like what you read subscribe to my newsletter.

I write essays on various engineering topics and share it through my weekly newsletter 👇