#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int n;
  double var;
  double sum;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%lf", &var);
    if (var <= 100000)
      sum = var / 10;
    else if (var <= 200000)
      sum = 10000 + (var - 100000) * 7.5 / 100;
    else if (var <= 400000)
      sum = 10000 + 7500 + (var - 200000) * 5 / 100;
    else if (var <= 600000)
      sum = 10000 + 7500 + 10000 + (var - 400000) * 3 / 100;
    else if (var <= 1000000)
      sum = 10000 + 7500 + 10000 + 6000 + (var - 600000) * 1.5 / 100;
    else
      sum = 10000 + 7500 + 10000 + 6000 + 6000 + (var - 1000000) / 100;
    printf("%.0lf\n", sum);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xf4a(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    133d <main+0x21d>
lea    0xf28(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  0xe92(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1194 <main+0x74>
movsd  -0x10(%rbp),%xmm0
movsd  0xef2(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    131e <main+0x1fe>
movsd  0xe6c(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     11e6 <main+0xc6>
movsd  -0x10(%rbp),%xmm1
movsd  0xe4c(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xeb0(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe64(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe90(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1319 <main+0x1f9>
movsd  0xe22(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1238 <main+0x118>
movsd  -0x10(%rbp),%xmm1
movsd  0xe02(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xe4e(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe12(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xe2e(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1314 <main+0x1f4>
movsd  0xdd8(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     128a <main+0x16a>
movsd  -0x10(%rbp),%xmm1
movsd  0xdb8(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xdec(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xdc0(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xdcc(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    130f <main+0x1ef>
movsd  0xd8e(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     12dc <main+0x1bc>
movsd  -0x10(%rbp),%xmm1
movsd  0xd6e(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xd8a(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd6e(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd6a(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    130a <main+0x1ea>
movsd  -0x10(%rbp),%xmm1
movsd  0xd37(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xd3b(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xd27(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    130f <main+0x1ef>
jmp    1314 <main+0x1f4>
jmp    1319 <main+0x1f9>
jmp    131e <main+0x1fe>
movsd  -0x18(%rbp),%xmm0
lea    0xd5d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <main+0x28>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xf77(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1294 <main+0x174>
lea    0xf5c(%rip),%r14
lea    0x10(%rsp),%r15
lea    0xf54(%rip),%rbx
xor    %ebp,%ebp
jmp    117d <main+0x5d>
nop
divsd  0xea0(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jge    1294 <main+0x174>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0xe68(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1160 <main+0x40>
movsd  0xe6a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1200 <main+0xe0>
movsd  0xe84(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1225 <main+0x105>
movsd  0xe96(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    124a <main+0x12a>
movsd  0xea4(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    126f <main+0x14f>
addsd  0xeb2(%rip),%xmm0
divsd  0xe3a(%rip),%xmm0
addsd  0xeaa(%rip),%xmm0
jmp    1168 <main+0x48>
nopl   0x0(%rax,%rax,1)
addsd  0xe10(%rip),%xmm0
mulsd  0xe10(%rip),%xmm0
divsd  0xe10(%rip),%xmm0
addsd  0xe10(%rip),%xmm0
jmp    1168 <main+0x48>
addsd  0xe13(%rip),%xmm0
mulsd  0xe13(%rip),%xmm0
divsd  0xdeb(%rip),%xmm0
addsd  0xe0b(%rip),%xmm0
jmp    1168 <main+0x48>
addsd  0xe0e(%rip),%xmm0
mulsd  0xe0e(%rip),%xmm0
divsd  0xdc6(%rip),%xmm0
addsd  0xe06(%rip),%xmm0
jmp    1168 <main+0x48>
addsd  0xe09(%rip),%xmm0
mulsd  0xe09(%rip),%xmm0
divsd  0xda1(%rip),%xmm0
addsd  0xe01(%rip),%xmm0
jmp    1168 <main+0x48>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 0, i32* %5
br label %7
7: ; preds = %66, %0
%8 = load i32, i32* %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %69
11: ; preds = %7
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%13 = load double, double* %3
%14 = fcmp ole double %13, 1.000000e+05
br i1 %14, label %15, label %18
15: ; preds = %11
%16 = load double, double* %3
%17 = fdiv double %16, 1.000000e+01
store double %17, double* %4
br label %63
18: ; preds = %11
%19 = load double, double* %3
%20 = fcmp ole double %19, 2.000000e+05
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load double, double* %3
%23 = fsub double %22, 1.000000e+05
%24 = fmul double %23, 7.500000e+00
%25 = fdiv double %24, 1.000000e+02
%26 = fadd double 1.000000e+04, %25
store double %26, double* %4
br label %62
27: ; preds = %18
%28 = load double, double* %3
%29 = fcmp ole double %28, 4.000000e+05
br i1 %29, label %30, label %36
30: ; preds = %27
%31 = load double, double* %3
%32 = fsub double %31, 2.000000e+05
%33 = fmul double %32, 5.000000e+00
%34 = fdiv double %33, 1.000000e+02
%35 = fadd double 1.750000e+04, %34
store double %35, double* %4
br label %61
36: ; preds = %27
%37 = load double, double* %3
%38 = fcmp ole double %37, 6.000000e+05
br i1 %38, label %39, label %45
39: ; preds = %36
%40 = load double, double* %3
%41 = fsub double %40, 4.000000e+05
%42 = fmul double %41, 3.000000e+00
%43 = fdiv double %42, 1.000000e+02
%44 = fadd double 2.750000e+04, %43
store double %44, double* %4
br label %60
45: ; preds = %36
%46 = load double, double* %3
%47 = fcmp ole double %46, 1.000000e+06
br i1 %47, label %48, label %54
48: ; preds = %45
%49 = load double, double* %3
%50 = fsub double %49, 6.000000e+05
%51 = fmul double %50, 1.500000e+00
%52 = fdiv double %51, 1.000000e+02
%53 = fadd double 3.350000e+04, %52
store double %53, double* %4
br label %59
54: ; preds = %45
%55 = load double, double* %3
%56 = fsub double %55, 1.000000e+06
%57 = fdiv double %56, 1.000000e+02
%58 = fadd double 3.950000e+04, %57
store double %58, double* %4
br label %59
59: ; preds = %54, %48
br label %60
60: ; preds = %59, %39
br label %61
61: ; preds = %60, %30
br label %62
62: ; preds = %61, %21
br label %63
63: ; preds = %62, %15
%64 = load double, double* %4
%65 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %64)
br label %66
66: ; preds = %63
%67 = load i32, i32* %5
%68 = add nsw i32 %67, 1
store i32 %68, i32* %5
br label %7
69: ; preds = %7
%70 = load i32, i32* %1
ret i32 %70
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %48, %0
ret i32 0
9: ; preds = %0, %48
%10 = phi i32 [ %51, %48 ], [ 0, %0 ]
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%12 = load double, double* %2
%13 = fcmp ugt double %12, 1.000000e+05
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = fdiv double %12, 1.000000e+01
br label %48
16: ; preds = %9
%17 = fcmp ugt double %12, 2.000000e+05
br i1 %17, label %23, label %18
18: ; preds = %16
%19 = fadd double %12, -1.000000e+05
%20 = fmul double %19, 7.500000e+00
%21 = fdiv double %20, 1.000000e+02
%22 = fadd double %21, 1.000000e+04
br label %48
23: ; preds = %16
%24 = fcmp ugt double %12, 4.000000e+05
br i1 %24, label %30, label %25
25: ; preds = %23
%26 = fadd double %12, -2.000000e+05
%27 = fmul double %26, 5.000000e+00
%28 = fdiv double %27, 1.000000e+02
%29 = fadd double %28, 1.750000e+04
br label %48
30: ; preds = %23
%31 = fcmp ugt double %12, 6.000000e+05
br i1 %31, label %37, label %32
32: ; preds = %30
%33 = fadd double %12, -4.000000e+05
%34 = fmul double %33, 3.000000e+00
%35 = fdiv double %34, 1.000000e+02
%36 = fadd double %35, 2.750000e+04
br label %48
37: ; preds = %30
%38 = fcmp ugt double %12, 1.000000e+06
br i1 %38, label %44, label %39
39: ; preds = %37
%40 = fadd double %12, -6.000000e+05
%41 = fmul double %40, 1.500000e+00
%42 = fdiv double %41, 1.000000e+02
%43 = fadd double %42, 3.350000e+04
br label %48
44: ; preds = %37
%45 = fadd double %12, -1.000000e+06
%46 = fdiv double %45, 1.000000e+02
%47 = fadd double %46, 3.950000e+04
br label %48
48: ; preds = %18, %32, %44, %39, %25, %14
%49 = phi double [ %15, %14 ], [ %22, %18 ], [ %29, %25 ], [ %36, %32 ], [ %43, %39 ], [ %47, %44 ]
%50 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %49)
%51 = add nuw nsw i32 %10, 1
%52 = load i32, i32* %1
%53 = icmp slt i32 %51, %52
br i1 %53, label %9, label %8
}