January 2022 enrollments are closed and the course commences on 8th of January, 2022. For future cohorts Join the waitlist

CRDS Solution

#include <stdio.h>
#define MOD 1000007
int main ( void ) {

	int t;
	scanf("%d" , &t);
	while ( t-- ) {
		long long int n;
		scanf("%lld" , &n);
		long long int ans = ((n*(3*n+1))/2);
		ans %= MOD;
		printf("%lld\n" , ans);
	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 👇