#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 *, float);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int t, i, j, n[1000], a, m;
  float p, c, s;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    scanf("%f", &s);
    m = 0;
    c = 0;
    for (j = 1; j <= s; j++) {
      scanf("%d", &n[j]);
      m = m + n[j];
    }
    a = m / s;
    for (j = 1; j <= s; j++) {
      if (n[j] > a)
        c++;
    }
    p = (c * 100) / s;
    printf("%.3f%\n", p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xfd0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecf(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     129e <main+0x17e>
lea    0xead(%rip),%rdi
lea    -0xfc4(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0xfb8(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xfc0(%rbp)
ff
movl   $0x1,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm1
movss  -0xfc4(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
jb     11e3 <main+0xc3>
movslq -0x10(%rbp),%rax
lea    -0xfb0(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xfb8(%rbp),%eax
movslq -0x10(%rbp),%rcx
add    -0xfb0(%rbp,%rcx,4),%eax
mov    %eax,-0xfb8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1188 <main+0x68>
cvtsi2ssl -0xfb8(%rbp),%xmm0
ff
divss  -0xfc4(%rbp),%xmm0
ff
cvttss2si %xmm0,%eax
mov    %eax,-0xfb4(%rbp)
movl   $0x1,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm1
movss  -0xfc4(%rbp),%xmm0
ff
ucomiss %xmm1,%xmm0
jb     125c <main+0x13c>
movslq -0x10(%rbp),%rax
mov    -0xfb0(%rbp,%rax,4),%eax
cmp    -0xfb4(%rbp),%eax
jle    1249 <main+0x129>
movss  0xdcb(%rip),%xmm0
addss  -0xfc0(%rbp),%xmm0
ff
movss  %xmm0,-0xfc0(%rbp)
ff
jmp    124e <main+0x12e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1204 <main+0xe4>
movss  0xd9c(%rip),%xmm0
mulss  -0xfc0(%rbp),%xmm0
ff
divss  -0xfc4(%rbp),%xmm0
ff
movss  %xmm0,-0xfbc(%rbp)
ff
movss  -0xfbc(%rbp),%xmm0
ff
lea    0xd83(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114b <main+0x2b>
xor    %eax,%eax
add    $0xfd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xfb8,%rsp
lea    0xed0(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1256 <main+0x136>
mov    $0x1,%ebp
lea    0xeb3(%rip),%r12
lea    0xea6(%rip),%r13
jmp    1193 <main+0x73>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mulss  0xe8c(%rip),%xmm0
divss  %xmm1,%xmm0
mov    %r12,%rdi
call   1030 <printf@plt>
lea    0x1(%rbp),%eax
cmp    0xc(%rsp),%ebp
mov    %eax,%ebp
jge    1256 <main+0x136>
lea    0xe71(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm1
ucomiss 0xe4d(%rip),%xmm1
mov    $0x0,%r14d
jb     11fb <main+0xdb>
xor    %r14d,%r14d
mov    $0x2,%r15d
lea    0x14(%rsp),%rbx
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
movss  0x8(%rsp),%xmm1
add    (%rbx),%r14d
add    $0x4,%rbx
add    $0x1,%r15d
ucomiss %xmm0,%xmm1
jae    11d0 <main+0xb0>
xorps  %xmm0,%xmm0
movss  0xdfa(%rip),%xmm3
ucomiss %xmm3,%xmm1
jb     1170 <main+0x50>
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
divss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
xorps  %xmm2,%xmm2
mov    $0x1,%ecx
movaps %xmm2,%xmm0
jmp    1247 <main+0x127>
nopl   0x0(%rax)
add    $0x1,%rcx
xorps  %xmm2,%xmm2
cvtsi2ss %ecx,%xmm2
ucomiss %xmm2,%xmm1
movaps %xmm0,%xmm2
jb     1170 <main+0x50>
addss  %xmm3,%xmm0
cmp    %eax,0x10(%rsp,%rcx,4)
jg     1230 <main+0x110>
movaps %xmm2,%xmm0
jmp    1230 <main+0x110>
xor    %eax,%eax
add    $0xfb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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