#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 */
scalar_t__ ceil(double);
scalar_t__ floor(double);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
double sqrt(double);
int main() {
  int count;
  int k;
  scanf("%d", &count);
  for (int i = 0; i < count; i++) {
    scanf("%d", &k);
    double y = (double)8 * (double)k - 7;
    double x = sqrt(y);
    printf("%d ", (floor(x) == ceil(x)));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1207 <main+0xb7>
lea    0xe87(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xe61(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe5d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1070 <floor@plt>
mov    %rax,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
call   1030 <ceil@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xe1f(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1176 <main+0x26>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xeb5(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11fb <main+0xab>
xor    %ebp,%ebp
lea    0xe9a(%rip),%r14
lea    0x4(%rsp),%r15
lea    0xe91(%rip),%r12
jmp    11c7 <main+0x77>
nopl   0x0(%rax)
call   1060 <sqrt@plt>
movsd  %xmm0,0x8(%rsp)
call   1070 <floor@plt>
mov    %rax,%rbx
movsd  0x8(%rsp),%xmm0
call   1030 <ceil@plt>
xor    %esi,%esi
cmp    %rax,%rbx
sete   %sil
mov    %r12,%rdi
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    (%rsp),%ebp
jge    11fb <main+0xab>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2sdl 0x4(%rsp),%xmm0
mulsd  0xe1d(%rip),%xmm0
addsd  0xe1d(%rip),%xmm0
ucomisd 0xe1d(%rip),%xmm0
jb     1190 <main+0x40>
sqrtsd %xmm0,%xmm0
jmp    1195 <main+0x45>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %4
br label %8
8: ; preds = %26, %0
%9 = load i32, i32* %4
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %29
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to double
%16 = call double @llvm.fmuladd.f64(double 8.000000e+00, double %15, double -7.000000e+00)
store double %16, double* %5
%17 = load double, double* %5
%18 = call double @sqrt(double %17)
store double %18, double* %6
%19 = load double, double* %6
%20 = call i64 @floor(double %19)
%21 = load double, double* %6
%22 = call i64 @ceil(double %21)
%23 = icmp eq i64 %20, %22
%24 = zext i1 %23 to i32
%25 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %24)
br label %26
26: ; preds = %12
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %8
29: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %9, %0
ret i32 0
9: ; preds = %0, %9
%10 = phi i32 [ %21, %9 ], [ 0, %0 ]
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = sitofp i32 %12 to double
%14 = call double @llvm.fmuladd.f64(double %13, double 8.000000e+00, double -7.000000e+00)
%15 = call double @sqrt(double %14)
%16 = call i64 @floor(double %15)
%17 = call i64 @ceil(double %15)
%18 = icmp eq i64 %16, %17
%19 = zext i1 %18 to i32
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %19)
%21 = add nuw nsw i32 %10, 1
%22 = load i32, i32* %1
%23 = icmp slt i32 %21, %22
br i1 %23, label %9, label %8
}