#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int T, n, ans;
  scanf("%d", &T);
  while (T--) {
    ans = 0;
    scanf("%d", &n);
    ans += n / 100;
    n %= 100;
    ans += n / 50;
    n %= 50;
    ans += n / 10;
    n %= 10;
    ans += n / 5;
    n %= 5;
    ans += n / 2;
    n %= 2;
    ans += n / 1;
    printf("%d\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     122a <main+0x10a>
movl   $0x0,-0x10(%rbp)
lea    0xe9f(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x32,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x1,%ecx
cltd
idiv   %ecx
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xed1(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jb     1220 <main+0x100>
lea    0xeb5(%rip),%r14
mov    %rsp,%r15
lea    0xeae(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
movslq (%rsp),%rcx
imul   $0x51eb851f,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rax
add    %edx,%eax
imul   $0x64,%eax,%edx
sub    %edx,%ecx
movsbl %cl,%edx
lea    (%rdx,%rdx,4),%esi
lea    (%rdx,%rsi,8),%edx
movzwl %dx,%edx
movswl %dx,%esi
shr    $0xf,%edx
shr    $0xb,%esi
add    %dl,%sil
movsbl %sil,%edx
add    %edx,%eax
movzbl %dl,%edx
imul   $0x32,%edx,%edx
sub    %dl,%cl
movsbl %cl,%ecx
imul   $0x67,%ecx,%edx
movzwl %dx,%esi
shr    $0xa,%edx
shr    $0xf,%esi
add    %dl,%sil
movsbl %sil,%edx
add    %edx,%eax
movzbl %dl,%edx
add    %edx,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
movsbl %cl,%ecx
imul   $0x67,%ecx,%edx
movzwl %dx,%esi
shr    $0x9,%edx
shr    $0xf,%esi
add    %dl,%sil
movsbl %sil,%edx
add    %edx,%eax
movzbl %dl,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%cl
mov    %ecx,%ebx
shr    $0x7,%bl
add    %cl,%bl
mov    %ebx,%edx
sar    %dl
movsbl %dl,%esi
add    %eax,%esi
and    $0xfe,%bl
sub    %bl,%cl
movsbl %cl,%eax
mov    %eax,(%rsp)
add    %eax,%esi
mov    %r12,%rdi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jae    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %37, label %9
9: ; preds = %0, %9
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 100
%13 = srem i32 %11, 100
%14 = trunc i32 %13 to i8
%15 = sdiv i8 %14, 50
%16 = sext i8 %15 to i32
%17 = add nsw i32 %12, %16
%18 = srem i8 %14, 50
%19 = sdiv i8 %18, 10
%20 = sext i8 %19 to i32
%21 = add nsw i32 %17, %20
%22 = srem i8 %18, 10
%23 = sdiv i8 %22, 5
%24 = sext i8 %23 to i32
%25 = add nsw i32 %21, %24
%26 = srem i8 %22, 5
%27 = sdiv i8 %26, 2
%28 = sext i8 %27 to i32
%29 = add nsw i32 %25, %28
%30 = srem i8 %26, 2
%31 = sext i8 %30 to i32
store i32 %31, i32* %2
%32 = add nsw i32 %29, %31
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%34 = load i32, i32* %1
%35 = add nsw i32 %34, -1
store i32 %35, i32* %1
%36 = icmp eq i32 %34, 0
br i1 %36, label %37, label %9
37: ; preds = %9, %0
ret i32 0
}