#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 */
long long pow(int, long long);
int /*<<< orphan*/ printf(char *, long long);
int /*<<< orphan*/ scanf(char *, long long *, ...);
int main() {
  long long int t;
  scanf("%lld", &t);
  long long int s, c, k, n, res;
  while (t--) {
    res = 0;
    scanf("%lld %lld %lld", &s, &c, &k);
    res = pow(2, s - k + 1);
    while (s < c) {
      res += pow(2, c + 1);
      c--;
    }
    if (res == 0)
      res = -1;
    printf("%lld\n", res + 1);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec4(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     120b <main+0xdb>
movq   $0x0,-0x38(%rbp)
lea    0xe87(%rip),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x18(%rbp),%rsi
sub    -0x28(%rbp),%rsi
add    $0x1,%rsi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jge    11df <main+0xaf>
mov    -0x20(%rbp),%rsi
add    $0x1,%rsi
mov    $0x2,%edi
call   1050 <pow@plt>
add    -0x38(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x20(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x20(%rbp)
jmp    11a6 <main+0x76>
cmpq   $0x0,-0x38(%rbp)
jne    11f2 <main+0xc2>
movq   $0xffffffffffffffff,-0x38(%rbp)
ff
mov    -0x38(%rbp),%rsi
add    $0x1,%rsi
lea    0xe0e(%rip),%rdi
call   1030 <printf@plt>
jmp    1151 <main+0x21>
xor    %eax,%eax
add    $0x40,%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    0xec5(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
subq   $0x1,0x18(%rsp)
jae    116a <main+0x3a>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe8f(%rip),%r14
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x20(%rsp),%r13
lea    0xe88(%rip),%rbx
jmp    11ab <main+0x7b>
nopl   0x0(%rax)
lea    0x1(%rbp),%rsi
test   %rbp,%rbp
cmove  %rbp,%rsi
mov    %rbx,%rdi
call   1030 <printf@plt>
subq   $0x1,0x18(%rsp)
jb     1159 <main+0x29>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x10(%rsp),%rsi
sub    0x20(%rsp),%rsi
add    $0x1,%rsi
mov    $0x2,%edi
call   1050 <pow@plt>
mov    %rax,%rbp
mov    0x8(%rsp),%rsi
cmp    %rsi,0x10(%rsp)
jge    1190 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rsi
mov    $0x2,%edi
call   1050 <pow@plt>
add    %rax,%rbp
mov    0x8(%rsp),%rsi
add    $0xffffffffffffffff,%rsi
mov    %rsi,0x8(%rsp)
cmp    %rsi,0x10(%rsp)
jl     11f0 <main+0xc0>
jmp    1190 <main+0x60>

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

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