#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
long long choose(int, int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, int *);
int /*<<< orphan*/ printf(char *, int, long long);
int main() {
  int t, i, j, k, cases, n;
  FILE *input = fopen("dinner.in", "r");
  fscanf(input, "%d", &cases);
  for (t = 0; t < cases; t++) {
    fscanf(input, "%d", &n);
    long long res = 0;
    for (i = 0; i <= 10; i++) {
      for (j = 0; j <= 20; j++) {
        for (k = 0; k <= 50; k++) {
          if (10 * i + 5 * j + 2 * k == n) {
            res += choose(i + j + k, i) * choose(j + k, j);
          }
        }
      }
    }
    printf("Dinner #%d: %lld\n", t + 1, res);
  }
  fclose(input);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9a(%rip),%rdi
lea    0xe9d(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
lea    0xe8b(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <fscanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    129a <main+0x14a>
mov    -0x28(%rbp),%rdi
lea    0xe64(%rip),%rsi
lea    -0x1c(%rbp),%rdx
call   1060 <fscanf@plt>
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jg     1276 <main+0x126>
movl   $0x0,-0x10(%rbp)
cmpl   $0x14,-0x10(%rbp)
jg     1263 <main+0x113>
movl   $0x0,-0x14(%rbp)
cmpl   $0x32,-0x14(%rbp)
jg     1250 <main+0x100>
imul   $0xa,-0xc(%rbp),%eax
imul   $0x5,-0x10(%rbp),%ecx
add    %ecx,%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
cmp    -0x1c(%rbp),%eax
jne    123d <main+0xed>
mov    -0xc(%rbp),%edi
add    -0x10(%rbp),%edi
add    -0x14(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <choose@plt>
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%edi
add    -0x14(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <choose@plt>
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
imul   %rcx,%rax
add    -0x30(%rbp),%rax
mov    %rax,-0x30(%rbp)
jmp    1242 <main+0xf2>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e2 <main+0x92>
jmp    1255 <main+0x105>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11d1 <main+0x81>
jmp    1268 <main+0x118>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11c0 <main+0x70>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x30(%rbp),%rdx
lea    0xd88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x41>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
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    $0x38,%rsp
lea    0xe9b(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1070 <fopen@plt>
lea    0xe94(%rip),%rsi
lea    0x4(%rsp),%rdx
mov    %rax,0x28(%rsp)
mov    %rax,%rdi
call   1060 <fscanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    12a7 <main+0x157>
xor    %ebx,%ebx
jmp    11c3 <main+0x73>
nopl   0x0(%rax)
mov    0x30(%rsp),%rbx
add    $0x1,%ebx
lea    0xe60(%rip),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
call   1050 <printf@plt>
cmp    0x4(%rsp),%ebx
jge    12a7 <main+0x157>
mov    %rbx,0x30(%rsp)
mov    0x28(%rsp),%rdi
lea    0xe38(%rip),%rsi
lea    0x24(%rsp),%rdx
call   1060 <fscanf@plt>
xor    %r15d,%r15d
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    1201 <main+0xb1>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    0x18(%rsp),%r15d
add    $0xa,%r15d
cmp    $0xb,%ebp
je     11a0 <main+0x50>
xor    %ecx,%ecx
mov    %rcx,0x10(%rsp)
mov    %ebp,%ecx
mov    %rcx,0x8(%rsp)
mov    %r15d,0x18(%rsp)
jmp    1248 <main+0xf8>
cs nopw 0x0(%rax,%rax,1)
mov    0x10(%rsp),%rax
add    $0x1,%eax
mov    0x1c(%rsp),%r15d
add    $0x5,%r15d
mov    0x8(%rsp),%rcx
add    $0x1,%ecx
mov    %rcx,0x8(%rsp)
mov    %rax,0x10(%rsp)
cmp    $0x15,%eax
je     11f0 <main+0xa0>
mov    %r15d,0x1c(%rsp)
xor    %ebx,%ebx
jmp    126c <main+0x11c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebx
add    $0x2,%r15d
cmp    $0x33,%ebx
je     1220 <main+0xd0>
cmp    0x24(%rsp),%r15d
jne    1260 <main+0x110>
mov    0x10(%rsp),%r13
lea    (%rbx,%r13,1),%eax
mov    %eax,0x20(%rsp)
mov    0x8(%rsp),%rax
lea    (%rax,%rbx,1),%edi
mov    %ebp,%esi
call   1030 <choose@plt>
mov    %rax,%r14
mov    0x20(%rsp),%edi
mov    %r13d,%esi
call   1030 <choose@plt>
imul   %r14,%rax
add    %rax,%r12
jmp    1260 <main+0x110>
mov    0x28(%rsp),%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"dinner.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [18 x i8] c"Dinner #%d: %lld\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
%8 = alloca i32*
%9 = alloca i64
store i32 0, i32* %1
%10 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %10, i32** %8
%11 = load i32*, i32** %8
%12 = call i32 @fscanf(i32* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
store i32 0, i32* %2
br label %13
13: ; preds = %75, %0
%14 = load i32, i32* %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %78
17: ; preds = %13
%18 = load i32*, i32** %8
%19 = call i32 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %7)
store i64 0, i64* %9
store i32 0, i32* %3
br label %20
20: ; preds = %67, %17
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 10
br i1 %22, label %23, label %70
23: ; preds = %20
store i32 0, i32* %4
br label %24
24: ; preds = %63, %23
%25 = load i32, i32* %4
%26 = icmp sle i32 %25, 20
br i1 %26, label %27, label %66
27: ; preds = %24
store i32 0, i32* %5
br label %28
28: ; preds = %59, %27
%29 = load i32, i32* %5
%30 = icmp sle i32 %29, 50
br i1 %30, label %31, label %62
31: ; preds = %28
%32 = load i32, i32* %3
%33 = mul nsw i32 10, %32
%34 = load i32, i32* %4
%35 = mul nsw i32 5, %34
%36 = add nsw i32 %33, %35
%37 = load i32, i32* %5
%38 = mul nsw i32 2, %37
%39 = add nsw i32 %36, %38
%40 = load i32, i32* %7
%41 = icmp eq i32 %39, %40
br i1 %41, label %42, label %58
42: ; preds = %31
%43 = load i32, i32* %3
%44 = load i32, i32* %4
%45 = add nsw i32 %43, %44
%46 = load i32, i32* %5
%47 = add nsw i32 %45, %46
%48 = load i32, i32* %3
%49 = call i64 @choose(i32 %47, i32 %48)
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = add nsw i32 %50, %51
%53 = load i32, i32* %4
%54 = call i64 @choose(i32 %52, i32 %53)
%55 = mul nsw i64 %49, %54
%56 = load i64, i64* %9
%57 = add nsw i64 %56, %55
store i64 %57, i64* %9
br label %58
58: ; preds = %42, %31
br label %59
59: ; preds = %58
%60 = load i32, i32* %5
%61 = add nsw i32 %60, 1
store i32 %61, i32* %5
br label %28
62: ; preds = %28
br label %63
63: ; preds = %62
%64 = load i32, i32* %4
%65 = add nsw i32 %64, 1
store i32 %65, i32* %4
br label %24
66: ; preds = %24
br label %67
67: ; preds = %66
%68 = load i32, i32* %3
%69 = add nsw i32 %68, 1
store i32 %69, i32* %3
br label %20
70: ; preds = %20
%71 = load i32, i32* %2
%72 = add nsw i32 %71, 1
%73 = load i64, i64* %9
%74 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %72, i64 %73)
br label %75
75: ; preds = %70
%76 = load i32, i32* %2
%77 = add nsw i32 %76, 1
store i32 %77, i32* %2
br label %13
78: ; preds = %13
%79 = load i32*, i32** %8
%80 = call i32 @fclose(i32* %79)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"dinner.in\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [18 x i8] c"Dinner #%d: %lld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %50
9: ; preds = %0, %45
%10 = phi i32 [ %46, %45 ], [ 0, %0 ]
%11 = call i32 @fscanf(i32* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %9, %42
%13 = phi i64 [ 0, %9 ], [ %36, %42 ]
%14 = phi i32 [ 0, %9 ], [ %43, %42 ]
%15 = mul nuw nsw i32 %14, 10
br label %16
16: ; preds = %12, %39
%17 = phi i64 [ %13, %12 ], [ %36, %39 ]
%18 = phi i32 [ 0, %12 ], [ %40, %39 ]
%19 = mul nuw nsw i32 %18, 5
%20 = add nuw nsw i32 %19, %15
br label %21
21: ; preds = %16, %35
%22 = phi i64 [ %17, %16 ], [ %36, %35 ]
%23 = phi i32 [ 0, %16 ], [ %37, %35 ]
%24 = shl nuw nsw i32 %23, 1
%25 = add nuw nsw i32 %20, %24
%26 = load i32, i32* %2
%27 = icmp eq i32 %25, %26
br i1 %27, label %28, label %35
28: ; preds = %21
%29 = add nuw nsw i32 %23, %18
%30 = add nuw nsw i32 %29, %14
%31 = call i64 @choose(i32 %30, i32 %14)
%32 = call i64 @choose(i32 %29, i32 %18)
%33 = mul nsw i64 %32, %31
%34 = add nsw i64 %33, %22
br label %35
35: ; preds = %21, %28
%36 = phi i64 [ %34, %28 ], [ %22, %21 ]
%37 = add nuw nsw i32 %23, 1
%38 = icmp eq i32 %37, 51
br i1 %38, label %39, label %21
39: ; preds = %35
%40 = add nuw nsw i32 %18, 1
%41 = icmp eq i32 %40, 21
br i1 %41, label %42, label %16
42: ; preds = %39
%43 = add nuw nsw i32 %14, 1
%44 = icmp eq i32 %43, 11
br i1 %44, label %45, label %12
45: ; preds = %42
%46 = add nuw nsw i32 %10, 1
%47 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i32 %46, i64 %36)
%48 = load i32, i32* %1
%49 = icmp slt i32 %46, %48
br i1 %49, label %9, label %50
50: ; preds = %45, %0
%51 = call i32 @fclose(i32* %5)
ret i32 0
}