#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, double, double);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  double sum = 0, price, discount = 0;
  int user, n, i, cnt = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    scanf("%d %lf", &user, &price);
    cnt += user;
    sum += (user >= 20)
               ? price * user * 80.0 / 100
               : ((user / 2) * 2) * price * 90.0 / 100 + (user % 2) * price;
    discount += (user >= 20) ? price * user * 20.0 / 100
                             : ((user / 2) * 2) * price * 10.0 / 100;
  }
  printf("%d\n%.2f\n%.0f", cnt, sum / cnt, discount);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x30(%rbp)
lea    0xedb(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    12ae <main+0x18e>
lea    0xeb9(%rip),%rdi
lea    -0x24(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x24(%rbp),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x14,-0x24(%rbp)
jl     11c4 <main+0xa4>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe66(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe4a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
jmp    1214 <main+0xf4>
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
cvtsi2sd %eax,%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  0xe25(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xe11(%rip),%xmm0
divsd  %xmm0,%xmm1
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cvtsi2sd %edx,%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x14,-0x24(%rbp)
jl     125d <main+0x13d>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0x24(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xddd(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xdb1(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1291 <main+0x171>
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  0xd9c(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd78(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    115f <main+0x3f>
mov    -0x30(%rbp),%esi
movsd  -0x10(%rbp),%xmm0
cvtsi2sdl -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
lea    0xd67(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20,%rsp
lea    0xef5(%rip),%rdi
xor    %ebx,%ebx
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    1238 <main+0x118>
xorpd  %xmm1,%xmm1
lea    0xed7(%rip),%r14
lea    0x4(%rsp),%r15
lea    0x8(%rsp),%r12
xor    %ebx,%ebx
xor    %ebp,%ebp
xorpd  %xmm0,%xmm0
jmp    11e0 <main+0xc0>
nopl   0x0(%rax,%rax,1)
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
and    $0xfffffffe,%ecx
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm4
movapd %xmm4,%xmm3
mulsd  0xe69(%rip),%xmm3
mov    %eax,%edx
sub    %ecx,%edx
xorps  %xmm1,%xmm1
cvtsi2sd %edx,%xmm1
movsd  0xe5e(%rip),%xmm5
divsd  %xmm5,%xmm3
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  0xe52(%rip),%xmm4
movsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    %eax,%ebx
divsd  %xmm5,%xmm4
movsd  0x18(%rsp),%xmm1
addsd  %xmm4,%xmm1
add    $0x1,%ebp
cmp    (%rsp),%ebp
jge    1240 <main+0x120>
movsd  %xmm0,0x10(%rsp)
movsd  %xmm1,0x18(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    $0x14,%eax
jl     1170 <main+0x50>
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
mulsd  0x8(%rsp),%xmm4
movapd %xmm4,%xmm1
mulsd  0xdf6(%rip),%xmm1
movsd  0xdde(%rip),%xmm5
divsd  %xmm5,%xmm1
mulsd  0xdea(%rip),%xmm4
jmp    11be <main+0x9e>
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
xorps  %xmm2,%xmm2
cvtsi2sd %ebx,%xmm2
divsd  %xmm2,%xmm0
lea    0xde0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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