#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 *, char *);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  printf("%s\n", "hello1");
  int t, X, Y, N, K, i, j, flag, pages, price;
  scanf("%d", &t);
  while (t--) {
    flag = 0;
    scanf("%d %d %d %d", &X, &Y, &K, &N);
    while (N--) {
      scanf("%d %d", &pages, &price);
      if (price <= K && Y + pages >= X)
        flag = 1;
    }
    if (flag)
      printf("%s\n", "LuckyChef");
    else
      printf("%s\n", "UnluckyChef");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    0xec7(%rip),%rsi
call   1030 <printf@plt>
lea    0xecb(%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     1218 <main+0xf8>
movl   $0x0,-0x24(%rbp)
lea    0xe95(%rip),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x10(%rbp),%rdx
lea    -0x18(%rbp),%rcx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x14(%rbp)
cmp    $0x0,%eax
je     11de <main+0xbe>
lea    0xe69(%rip),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x2c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     11d9 <main+0xb9>
mov    -0x10(%rbp),%eax
add    -0x28(%rbp),%eax
cmp    -0xc(%rbp),%eax
jl     11d9 <main+0xb9>
movl   $0x1,-0x24(%rbp)
jmp    118d <main+0x6d>
cmpl   $0x0,-0x24(%rbp)
je     1200 <main+0xe0>
lea    0xe11(%rip),%rdi
lea    0xe21(%rip),%rsi
call   1030 <printf@plt>
jmp    1213 <main+0xf3>
lea    0xdf9(%rip),%rdi
lea    0xe13(%rip),%rsi
call   1030 <printf@plt>
jmp    1154 <main+0x34>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xecb(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1030 <printf@plt>
lea    0xecc(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x14(%rsp)
jae    116c <main+0x4c>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe98(%rip),%rbx
lea    0x10(%rsp),%rbp
lea    0xe92(%rip),%r14
lea    0x1c(%rsp),%r15
lea    0x18(%rsp),%r12
mov    $0x1,%r13d
jmp    11ba <main+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xe7a(%rip),%rsi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
subl   $0x1,0x14(%rsp)
jb     115b <main+0x3b>
mov    %rbx,%rdi
mov    %rbp,%rsi
lea    0x24(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0xc(%rsp),%r8
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0xc(%rsp)
jb     11a0 <main+0x80>
mov    %rbx,%rbp
xor    %ebx,%ebx
jmp    11f7 <main+0xd7>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
subl   $0x1,0xc(%rsp)
jb     1230 <main+0x110>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
cmp    0x20(%rsp),%eax
jg     11f0 <main+0xd0>
mov    0x1c(%rsp),%eax
add    0x24(%rsp),%eax
cmp    0x10(%rsp),%eax
cmovge %r13d,%ebx
jmp    11f0 <main+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xde0(%rip),%rsi
test   %ebx,%ebx
mov    %rbp,%rbx
lea    0x10(%rsp),%rbp
jne    11a7 <main+0x87>
jmp    11a0 <main+0x80>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [7 x i8] c"hello1\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"%d %d %d %d\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [10 x i8] c"LuckyChef\00"
@.str.6 = [12 x i8] c"UnluckyChef\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
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %1
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %14
14: ; preds = %44, %0
%15 = load i32, i32* %2
%16 = add nsw i32 %15, -1
store i32 %16, i32* %2
%17 = icmp ne i32 %15, 0
br i1 %17, label %18, label %45
18: ; preds = %14
store i32 0, i32* %9
%19 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4, i32* %6, i32* %5)
br label %20
20: ; preds = %36, %18
%21 = load i32, i32* %5
%22 = add nsw i32 %21, -1
store i32 %22, i32* %5
%23 = icmp ne i32 %21, 0
br i1 %23, label %24, label %37
24: ; preds = %20
%25 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %10, i32* %11)
%26 = load i32, i32* %11
%27 = load i32, i32* %6
%28 = icmp sle i32 %26, %27
br i1 %28, label %29, label %36
29: ; preds = %24
%30 = load i32, i32* %4
%31 = load i32, i32* %10
%32 = add nsw i32 %30, %31
%33 = load i32, i32* %3
%34 = icmp sge i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %29
store i32 1, i32* %9
br label %36
36: ; preds = %35, %29, %24
br label %20
37: ; preds = %20
%38 = load i32, i32* %9
%39 = icmp ne i32 %38, 0
br i1 %39, label %40, label %42
40: ; preds = %37
%41 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
br label %44
42: ; preds = %37
%43 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
br label %14
45: ; preds = %14
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [7 x i8] c"hello1\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [12 x i8] c"%d %d %d %d\00"
@.str.4 = [6 x i8] c"%d %d\00"
@.str.5 = [10 x i8] c"LuckyChef\00"
@.str.6 = [12 x i8] c"UnluckyChef\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
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%9 = bitcast i32* %1 to i8*
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%17 = load i32, i32* %1
%18 = add nsw i32 %17, -1
store i32 %18, i32* %1
%19 = icmp eq i32 %17, 0
br i1 %19, label %52, label %20
20: ; preds = %0, %46
%21 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i32* %2, i32* %3, i32* %5, i32* %4)
%22 = load i32, i32* %4
%23 = add nsw i32 %22, -1
store i32 %23, i32* %4
%24 = icmp eq i32 %22, 0
br i1 %24, label %45, label %25
25: ; preds = %20, %38
%26 = phi i32 [ %39, %38 ], [ 0, %20 ]
%27 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i32* %6, i32* %7)
%28 = load i32, i32* %7
%29 = load i32, i32* %5
%30 = icmp sgt i32 %28, %29
br i1 %30, label %38, label %31
31: ; preds = %25
%32 = load i32, i32* %3
%33 = load i32, i32* %6
%34 = add nsw i32 %33, %32
%35 = load i32, i32* %2
%36 = icmp slt i32 %34, %35
%37 = select i1 %36, i32 %26, i32 1
br label %38
38: ; preds = %31, %25
%39 = phi i32 [ %26, %25 ], [ %37, %31 ]
%40 = load i32, i32* %4
%41 = add nsw i32 %40, -1
store i32 %41, i32* %4
%42 = icmp eq i32 %40, 0
br i1 %42, label %43, label %25
43: ; preds = %38
%44 = icmp eq i32 %39, 0
br i1 %44, label %45, label %46
45: ; preds = %20, %43
br label %46
46: ; preds = %43, %45
%47 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), %45 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), %43 ]
%48 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %47)
%49 = load i32, i32* %1
%50 = add nsw i32 %49, -1
store i32 %50, i32* %1
%51 = icmp eq i32 %49, 0
br i1 %51, label %52, label %20
52: ; preds = %46, %0
ret i32 0
}