#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 *, int, int);
int /*<<< orphan*/ scanf(char *, int *, int *);
int sqrt(int);
int main() {
  int R, B, x, y, l, b;
  scanf("%d%d", &R, &B);
  x = (R + 4) / 2;
  y = (R + B);
  l = (x + sqrt((x * x) - (4 * y))) / 2;
  b = y / l;
  if (l >= b)
    printf("%d %d\n", l, b);
  else
    printf("%d %d\n", b, l);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x4,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
imul   -0x10(%rbp),%edi
mov    -0x14(%rbp),%eax
shl    $0x2,%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jl     11c6 <main+0x96>
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
lea    0xe49(%rip),%rdi
call   1030 <printf@plt>
jmp    11d8 <main+0xa8>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe32(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%ebx
lea    0x4(%rbx),%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%ebp
add    $0x4,%ebp
add    (%rsp),%ebx
sar    %ebp
mov    %ebp,%edi
imul   %ebp,%edi
lea    0x0(,%rbx,4),%eax
sub    %eax,%edi
call   1050 <sqrt@plt>
add    %ebp,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %ebx,%eax
cltd
idiv   %ecx
lea    0xe7f(%rip),%rdi
cmp    %eax,%ecx
jge    1190 <main+0x60>
mov    %eax,%esi
mov    %ecx,%edx
jmp    1194 <main+0x64>
mov    %ecx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%d%d\00"
@.str.1 = [7 x i8] c"%d %d\0A\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 ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, 4
%8 = sdiv i32 %7, 2
%9 = load i32, i32* %2
%10 = add nsw i32 %9, %6
%11 = mul nsw i32 %8, %8
%12 = mul i32 %10, -4
%13 = add i32 %12, %11
%14 = call i32 @sqrt(i32 %13)
%15 = add nsw i32 %8, %14
%16 = sdiv i32 %15, 2
%17 = sdiv i32 %10, %16
%18 = icmp slt i32 %16, %17
br i1 %18, label %21, label %19
19: ; preds = %0
%20 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %16, i32 %17)
br label %23
21: ; preds = %0
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %17, i32 %16)
br label %23
23: ; preds = %21, %19
ret i32 0
}