#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 *, double);
int /*<<< orphan*/ scanf(char *, int *, ...);
int sqrt(int);
int main(void) {
  int t;
  scanf("%d", &t);
  while (t--) {
    int p, s;
    scanf("%d%d", &p, &s);
    double x1 = (p + sqrt(p * p - (24 * s))) / 12;
    double x2 = (p - sqrt(p * p - (24 * s))) / 12;
    double y1 = (p - (8 * x1)) / 4;
    double y2 = (p - (8 * x2)) / 4;
    double v1 = x1 * x1 * y1;
    double v2 = x2 * x2 * y2;
    printf("%.2f\n", (v1 > v2) ? v1 : v2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecc(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1298 <main+0x168>
lea    0xea4(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0xc(%rbp),%edi
imul   -0xc(%rbp),%edi
imul   $0x18,-0x10(%rbp),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x48(%rbp),%eax
add    %ecx,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xc(%rbp),%edi
imul   -0xc(%rbp),%edi
imul   $0x18,-0x10(%rbp),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
sub    %ecx,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe1b(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe03(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
movsd  0xdf0(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xdd8(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1278 <main+0x148>
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    1282 <main+0x152>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
lea    0xd87(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xecf(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x14(%rsp)
jb     1273 <main+0x143>
lea    0xeaf(%rip),%r14
lea    0xc(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0xea3(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
imul   %ebp,%edi
mov    0x10(%rsp),%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
add    %ebp,%eax
cltq
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x18(%rsp)
mov    0xc(%rsp),%ebp
mov    %ebp,%edi
imul   %ebp,%edi
mov    0x10(%rsp),%eax
shl    $0x3,%eax
lea    (%rax,%rax,2),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
sub    %eax,%ebp
movslq %ebp,%rax
imul   $0x2aaaaaab,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x18(%rsp),%xmm6
movapd %xmm6,%xmm2
movsd  0xddc(%rip),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm1,%xmm2
movsd  0xdd4(%rip),%xmm5
mulsd  %xmm5,%xmm2
movapd %xmm0,%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm1,%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm6,%xmm6
mulsd  %xmm2,%xmm6
mulsd  %xmm0,%xmm0
mulsd  %xmm3,%xmm0
maxsd  %xmm0,%xmm6
movapd %xmm6,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x14(%rsp)
jae    1180 <main+0x50>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %67, %0
%13 = load i32, i32* %2
%14 = add nsw i32 %13, -1
store i32 %14, i32* %2
%15 = icmp ne i32 %13, 0
br i1 %15, label %16, label %70
16: ; preds = %12
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%18 = load i32, i32* %3
%19 = load i32, i32* %3
%20 = load i32, i32* %3
%21 = mul nsw i32 %19, %20
%22 = load i32, i32* %4
%23 = mul nsw i32 24, %22
%24 = sub nsw i32 %21, %23
%25 = call i32 @sqrt(i32 %24)
%26 = add nsw i32 %18, %25
%27 = sdiv i32 %26, 12
%28 = sitofp i32 %27 to double
store double %28, double* %5
%29 = load i32, i32* %3
%30 = load i32, i32* %3
%31 = load i32, i32* %3
%32 = mul nsw i32 %30, %31
%33 = load i32, i32* %4
%34 = mul nsw i32 24, %33
%35 = sub nsw i32 %32, %34
%36 = call i32 @sqrt(i32 %35)
%37 = sub nsw i32 %29, %36
%38 = sdiv i32 %37, 12
%39 = sitofp i32 %38 to double
store double %39, double* %6
%40 = load i32, i32* %3
%41 = sitofp i32 %40 to double
%42 = load double, double* %5
%43 = call double @llvm.fmuladd.f64(double -8.000000e+00, double %42, double %41)
%44 = fdiv double %43, 4.000000e+00
store double %44, double* %7
%45 = load i32, i32* %3
%46 = sitofp i32 %45 to double
%47 = load double, double* %6
%48 = call double @llvm.fmuladd.f64(double -8.000000e+00, double %47, double %46)
%49 = fdiv double %48, 4.000000e+00
store double %49, double* %8
%50 = load double, double* %5
%51 = load double, double* %5
%52 = fmul double %50, %51
%53 = load double, double* %7
%54 = fmul double %52, %53
store double %54, double* %9
%55 = load double, double* %6
%56 = load double, double* %6
%57 = fmul double %55, %56
%58 = load double, double* %8
%59 = fmul double %57, %58
store double %59, double* %10
%60 = load double, double* %9
%61 = load double, double* %10
%62 = fcmp ogt double %60, %61
br i1 %62, label %63, label %65
63: ; preds = %16
%64 = load double, double* %9
br label %67
65: ; preds = %16
%66 = load double, double* %10
br label %67
67: ; preds = %65, %63
%68 = phi double [ %64, %63 ], [ %66, %65 ]
%69 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %68)
br label %12
70: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [6 x i8] c"%.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %48, label %9
9: ; preds = %0
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
br label %12
12: ; preds = %9, %12
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %14
%16 = load i32, i32* %3
%17 = mul i32 %16, -24
%18 = add i32 %17, %15
%19 = call i32 @sqrt(i32 %18)
%20 = add nsw i32 %19, %14
%21 = sdiv i32 %20, 12
%22 = sitofp i32 %21 to double
%23 = load i32, i32* %2
%24 = mul nsw i32 %23, %23
%25 = load i32, i32* %3
%26 = mul i32 %25, -24
%27 = add i32 %26, %24
%28 = call i32 @sqrt(i32 %27)
%29 = sub nsw i32 %23, %28
%30 = sdiv i32 %29, 12
%31 = sitofp i32 %30 to double
%32 = load i32, i32* %2
%33 = sitofp i32 %32 to double
%34 = call double @llvm.fmuladd.f64(double %22, double -8.000000e+00, double %33)
%35 = fmul double %34, 2.500000e-01
%36 = call double @llvm.fmuladd.f64(double %31, double -8.000000e+00, double %33)
%37 = fmul double %36, 2.500000e-01
%38 = fmul double %22, %22
%39 = fmul double %38, %35
%40 = fmul double %31, %31
%41 = fmul double %40, %37
%42 = fcmp ogt double %39, %41
%43 = select i1 %42, double %39, double %41
%44 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %43)
%45 = load i32, i32* %1
%46 = add nsw i32 %45, -1
store i32 %46, i32* %1
%47 = icmp eq i32 %45, 0
br i1 %47, label %48, label %12
48: ; preds = %12, %0
ret i32 0
}