#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long long);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t, i;
  scanf("%d", &t);
  for (i = 0; i < t; i++) {
    unsigned long long int n, tri;
    scanf("%llu", &n);
    if (n % 2 == 0)
      tri = n * (n + 2) * (2 * n + 1) / 8;
    else
      tri = (n * (n + 2) * (2 * n + 1) - 1) / 8;
    printf("%llu\n", tri);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11ef <main+0xcf>
lea    0xea8(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    11a5 <main+0x85>
mov    -0x18(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    $0x2,%rcx
imul   %rcx,%rax
mov    -0x18(%rbp),%rcx
shl    $0x1,%rcx
add    $0x1,%rcx
imul   %rcx,%rax
shr    $0x3,%rax
mov    %rax,-0x20(%rbp)
jmp    11d1 <main+0xb1>
mov    -0x18(%rbp),%rax
mov    -0x18(%rbp),%rcx
add    $0x2,%rcx
imul   %rcx,%rax
mov    -0x18(%rbp),%rcx
shl    $0x1,%rcx
add    $0x1,%rcx
imul   %rcx,%rax
sub    $0x1,%rax
shr    $0x3,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe2c(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1148 <main+0x28>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xecf(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11a1 <main+0x81>
lea    0xeb8(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xeb1(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rax
lea    0x2(%rax),%rcx
imul   %rax,%rcx
lea    (%rax,%rax,1),%rsi
add    $0x1,%rsi
imul   %rcx,%rsi
and    $0x1,%eax
sub    %rax,%rsi
shr    $0x3,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     1160 <main+0x40>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %7
7: ; preds = %40, %0
%8 = load i32, i32* %3
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %43
11: ; preds = %7
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %4)
%13 = load i64, i64* %4
%14 = urem i64 %13, 2
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %26
16: ; preds = %11
%17 = load i64, i64* %4
%18 = load i64, i64* %4
%19 = add i64 %18, 2
%20 = mul i64 %17, %19
%21 = load i64, i64* %4
%22 = mul i64 2, %21
%23 = add i64 %22, 1
%24 = mul i64 %20, %23
%25 = udiv i64 %24, 8
store i64 %25, i64* %5
br label %37
26: ; preds = %11
%27 = load i64, i64* %4
%28 = load i64, i64* %4
%29 = add i64 %28, 2
%30 = mul i64 %27, %29
%31 = load i64, i64* %4
%32 = mul i64 2, %31
%33 = add i64 %32, 1
%34 = mul i64 %30, %33
%35 = sub i64 %34, 1
%36 = udiv i64 %35, 8
store i64 %36, i64* %5
br label %37
37: ; preds = %26, %16
%38 = load i64, i64* %5
%39 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %38)
br label %40
40: ; preds = %37
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
br label %7
43: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%llu\00"
@.str.2 = [6 x i8] c"%llu\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = bitcast i32* %1 to i8*
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %25
7: ; preds = %0
%8 = bitcast i64* %2 to i8*
br label %9
9: ; preds = %7, %9
%10 = phi i32 [ 0, %7 ], [ %22, %9 ]
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i64* %2)
%12 = load i64, i64* %2
%13 = add i64 %12, 2
%14 = mul i64 %13, %12
%15 = shl i64 %12, 1
%16 = or i64 %15, 1
%17 = mul i64 %14, %16
%18 = and i64 %12, 1
%19 = sub i64 %17, %18
%20 = lshr i64 %19, 3
%21 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), i64 %20)
%22 = add nuw nsw i32 %10, 1
%23 = load i32, i32* %1
%24 = icmp slt i32 %22, %23
br i1 %24, label %9, label %25
25: ; preds = %9, %0
ret i32 0
}