#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*/ assert(int);
int *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
void solve() {
  int *prices = malloc((((100) >= (2000)) ? (100) : (2000)) * sizeof(*prices));
  int cases;
  scanf("%d\n", &cases);
  for (int i = 0; i < cases; i++) {
    int credit;
    scanf("%d\n", &credit);
    int num_items;
    scanf("%d\n", &num_items);
    for (int i = 0; i < num_items; i++) {
      scanf("%d ", prices + i);
    }
    printf("Case #%d: ", i + 1);
    for (int a = 0; a < num_items - 1; a++) {
      for (int b = a + 1; b < num_items; b++) {
        if (credit == prices[a] + prices[b]) {
          printf("%d %d", a + 1, b + 1);
          goto next;
        }
      }
    }
    assert(!"FOUND");
  next:
    if (i < cases - 1) {
      printf("\n");
    }
  }
}


x86 assembly (clang, -O0):
<solve>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x1f40,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12b5 <solve+0x175>
lea    0xe80(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe70(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11d5 <solve+0x95>
mov    -0x8(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe42(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11a0 <solve+0x60>
mov    -0x10(%rbp),%esi
add    $0x1,%esi
lea    0xe26(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    127c <solve+0x13c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1269 <solve+0x129>
mov    -0x14(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0x20(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
mov    -0x8(%rbp),%rdx
movslq -0x24(%rbp),%rsi
add    (%rdx,%rsi,4),%ecx
cmp    %ecx,%eax
jne    1256 <solve+0x116>
mov    -0x20(%rbp),%esi
add    $0x1,%esi
mov    -0x24(%rbp),%edx
add    $0x1,%edx
lea    0xdc9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1283 <solve+0x143>
jmp    125b <solve+0x11b>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    120a <solve+0xca>
jmp    126e <solve+0x12e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11f0 <solve+0xb0>
xor    %edi,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12a2 <solve+0x162>
lea    0xd67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12a7 <solve+0x167>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116d <solve+0x2d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solve>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x1f40,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
lea    0xe8e(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    12d4 <solve+0x184>
mov    %r13,%rax
add    $0x4,%rax
mov    %rax,0x10(%rsp)
lea    0xe6a(%rip),%r14
xor    %r12d,%r12d
jmp    11ac <solve+0x5c>
nop
mov    %r15d,%r12d
cmp    %eax,%r15d
jge    12d4 <solve+0x184>
lea    0xe4d(%rip),%rbx
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   1070 <scanf@plt>
mov    %rbx,%rdi
lea    0x4(%rsp),%rsi
call   1070 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    11fd <solve+0xad>
mov    %r13,%rbp
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
call   1070 <scanf@plt>
add    $0x1,%rbx
movslq 0x4(%rsp),%rax
add    $0x4,%rbp
cmp    %rax,%rbx
jl     11e0 <solve+0x90>
lea    0x1(%r12),%r15d
lea    0xdff(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%r9d
cmp    $0x2,%r9d
jl     1290 <solve+0x140>
lea    -0x1(%r9),%r8d
mov    0xc(%rsp),%ebp
lea    -0x1(%r9),%rdi
mov    $0xfffffffe,%r10d
mov    0x10(%rsp),%rax
xor    %esi,%esi
jmp    1251 <solve+0x101>
nopl   0x0(%rax)
add    $0xffffffffffffffff,%r10
add    $0x4,%rax
add    $0xffffffffffffffff,%rdi
cmp    %r8,%rsi
je     1290 <solve+0x140>
mov    %rsi,%rdx
add    $0x1,%rsi
cmp    %r9,%rsi
jae    1240 <solve+0xf0>
mov    0x0(%r13,%rdx,4),%ebx
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rax,%rdx,4),%ecx
add    %ebx,%ecx
cmp    %ecx,%ebp
je     12a0 <solve+0x150>
add    $0x1,%rdx
cmp    %rdx,%rdi
jne    1270 <solve+0x120>
jmp    1240 <solve+0xf0>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %edi,%edi
call   1050 <assert@plt>
jmp    12b1 <solve+0x161>
nopl   0x0(%rax)
sub    %r10d,%edx
lea    0xd69(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    %ecx,%r12d
jge    11a0 <solve+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%eax
jmp    11a0 <solve+0x50>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [11 x i8] c"Case #%d: \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [6 x i8] c"FOUND\00"
@.str.5 = [2 x i8] c"\0A\00"
define void @solve() {
%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 = call i32* @malloc(i32 8000)
store i32* %9, i32** %1
%10 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %11
11: ; preds = %85, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %88
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %4)
%17 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %5)
store i32 0, i32* %6
br label %18
18: ; preds = %28, %15
%19 = load i32, i32* %6
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %31
22: ; preds = %18
%23 = load i32*, i32** %1
%24 = load i32, i32* %6
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %26)
br label %28
28: ; preds = %22
%29 = load i32, i32* %6
%30 = add nsw i32 %29, 1
store i32 %30, i32* %6
br label %18
31: ; preds = %18
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %33)
store i32 0, i32* %7
br label %35
35: ; preds = %72, %31
%36 = load i32, i32* %7
%37 = load i32, i32* %5
%38 = sub nsw i32 %37, 1
%39 = icmp slt i32 %36, %38
br i1 %39, label %40, label %75
40: ; preds = %35
%41 = load i32, i32* %7
%42 = add nsw i32 %41, 1
store i32 %42, i32* %8
br label %43
43: ; preds = %68, %40
%44 = load i32, i32* %8
%45 = load i32, i32* %5
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %71
47: ; preds = %43
%48 = load i32, i32* %4
%49 = load i32*, i32** %1
%50 = load i32, i32* %7
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i32, i32* %49, i64 %51
%53 = load i32, i32* %52
%54 = load i32*, i32** %1
%55 = load i32, i32* %8
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds i32, i32* %54, i64 %56
%58 = load i32, i32* %57
%59 = add nsw i32 %53, %58
%60 = icmp eq i32 %48, %59
br i1 %60, label %61, label %67
61: ; preds = %47
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %63, i32 %65)
br label %77
67: ; preds = %47
br label %68
68: ; preds = %67
%69 = load i32, i32* %8
%70 = add nsw i32 %69, 1
store i32 %70, i32* %8
br label %43
71: ; preds = %43
br label %72
72: ; preds = %71
%73 = load i32, i32* %7
%74 = add nsw i32 %73, 1
store i32 %74, i32* %7
br label %35
75: ; preds = %35
%76 = call i32 @assert(i32 0)
br label %77
77: ; preds = %75, %61
%78 = load i32, i32* %3
%79 = load i32, i32* %2
%80 = sub nsw i32 %79, 1
%81 = icmp slt i32 %78, %80
br i1 %81, label %82, label %84
82: ; preds = %77
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %84
84: ; preds = %82, %77
br label %85
85: ; preds = %84
%86 = load i32, i32* %3
%87 = add nsw i32 %86, 1
store i32 %87, i32* %3
br label %11
88: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [11 x i8] c"Case #%d: \00"
@.str.3 = [6 x i8] c"%d %d\00"
define void @solve() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = tail call i32* @malloc(i32 8000)
%5 = bitcast i32* %1 to i8*
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %0
%10 = bitcast i32* %2 to i8*
%11 = bitcast i32* %3 to i8*
br label %13
12: ; preds = %72, %0
ret void
13: ; preds = %9, %72
%14 = phi i32 [ 0, %9 ], [ %20, %72 ]
%15 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 0
br i1 %18, label %30, label %19
19: ; preds = %30, %13
%20 = add nuw nsw i32 %14, 1
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i32 %20)
%22 = load i32, i32* %3
%23 = icmp sgt i32 %22, 1
br i1 %23, label %24, label %63
24: ; preds = %19
%25 = add nsw i32 %22, -1
%26 = load i32, i32* %2
%27 = zext i32 %22 to i64
%28 = zext i32 %25 to i64
%29 = zext i32 %22 to i64
br label %41
30: ; preds = %13, %30
%31 = phi i64 [ %34, %30 ], [ 0, %13 ]
%32 = getelementptr inbounds i32, i32* %4, i64 %31
%33 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = add nuw nsw i64 %31, 1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %30, label %19
38: ; preds = %55, %41
%39 = add nuw nsw i64 %43, 1
%40 = icmp eq i64 %44, %28
br i1 %40, label %63, label %41
41: ; preds = %24, %38
%42 = phi i64 [ 0, %24 ], [ %44, %38 ]
%43 = phi i64 [ 1, %24 ], [ %39, %38 ]
%44 = add nuw nsw i64 %42, 1
%45 = icmp ult i64 %44, %27
br i1 %45, label %46, label %38
46: ; preds = %41
%47 = getelementptr inbounds i32, i32* %4, i64 %42
%48 = load i32, i32* %47
br label %49
49: ; preds = %46, %55
%50 = phi i64 [ %43, %46 ], [ %56, %55 ]
%51 = getelementptr inbounds i32, i32* %4, i64 %50
%52 = load i32, i32* %51
%53 = add nsw i32 %52, %48
%54 = icmp eq i32 %26, %53
br i1 %54, label %58, label %55
55: ; preds = %49
%56 = add nuw nsw i64 %50, 1
%57 = icmp eq i64 %56, %29
br i1 %57, label %38, label %49
58: ; preds = %49
%59 = trunc i64 %44 to i32
%60 = trunc i64 %50 to i32
%61 = add nuw nsw i32 %60, 1
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32 %59, i32 %61)
br label %65
63: ; preds = %38, %19
%64 = call i32 @assert(i32 0)
br label %65
65: ; preds = %58, %63
%66 = load i32, i32* %1
%67 = add nsw i32 %66, -1
%68 = icmp slt i32 %14, %67
br i1 %68, label %69, label %72
69: ; preds = %65
%70 = call i32 @putchar(i32 10)
%71 = load i32, i32* %1
br label %72
72: ; preds = %69, %65
%73 = phi i32 [ %71, %69 ], [ %66, %65 ]
%74 = icmp slt i32 %20, %73
br i1 %74, label %13, label %12
}