刚开始超时
#include<stdio.h>
int main()
{
int t,n;
long long c;
//long long f[1001];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
//f[1]=2;
//for(i=2;i<=n;i++)
//{
//f[i]=f[i-1]+6*(i-1);
//}
c=3*(n-1)*n + 2;
printf("%lld\n",c);
}
}