#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 */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, ...);
int main() {
  FILE *f = fopen("INP.TXT", "r");
  char a;
  short n, m;
  fscanf(f, "%hd", &n);
  m = n / 2;
  for (; n; n--) {
    fscanf(f, "%hhd", &a);
    if (a == 1)
      m--;
  }
  fclose(f);
  f = fopen("OUT.TXT", "w");
  fputs((m < 0) ? "YES\n" : "NO\n", f);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
lea    0xeab(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x14(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
movswl -0x14(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %ax,-0x16(%rbp)
cmpw   $0x0,-0x14(%rbp)
je     11dc <main+0x9c>
mov    -0x10(%rbp),%rdi
lea    0xe6c(%rip),%rsi
lea    -0x11(%rbp),%rdx
mov    $0x0,%al
call   1050 <fscanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x1,%eax
jne    11c6 <main+0x86>
mov    -0x16(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x16(%rbp)
jmp    11cb <main+0x8b>
mov    -0x14(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x14(%rbp)
jmp    118c <main+0x4c>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
lea    0xe27(%rip),%rdi
lea    0xe28(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x10(%rbp)
movswl -0x16(%rbp),%ecx
lea    0xe1b(%rip),%rdi
lea    0xe0f(%rip),%rax
cmp    $0x0,%ecx
cmovl  %rax,%rdi
mov    -0x10(%rbp),%rsi
call   1040 <fputs@plt>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xeb2(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
lea    0xea6(%rip),%rsi
lea    0x6(%rsp),%rdx
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <fscanf@plt>
movzwl 0x6(%rsp),%eax
test   %ax,%ax
je     11db <main+0x9b>
movzwl %ax,%eax
mov    %eax,%ecx
shr    $0xf,%ecx
add    %eax,%ecx
movswl %cx,%ebp
shr    %ebp
lea    0xe7b(%rip),%r14
lea    0x5(%rsp),%r15
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1050 <fscanf@plt>
xor    %eax,%eax
cmpb   $0x1,0x5(%rsp)
sete   %al
sub    %eax,%ebp
addw   $0xffff,0x6(%rsp)
jne    11a0 <main+0x60>
test   %bp,%bp
lea    0xe4f(%rip),%rax
lea    0xe4d(%rip),%r14
cmovs  %rax,%r14
jmp    11e2 <main+0xa2>
lea    0xe40(%rip),%r14
mov    %rbx,%rdi
call   1030 <fclose@plt>
lea    0xe22(%rip),%rdi
lea    0xe23(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1040 <fputs@plt>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%hd\00"
@.str.3 = [5 x i8] c"%hhd\00"
@.str.4 = [8 x i8] c"OUT.TXT\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [5 x i8] c"YES\0A\00"
@.str.7 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i8
%4 = alloca i16
%5 = alloca i16
store i32 0, i32* %1
%6 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %2
%7 = load i32*, i32** %2
%8 = call i32 (i32*, i8*, ...) @fscanf(i32* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i16* %4)
%9 = load i16, i16* %4
%10 = sext i16 %9 to i32
%11 = sdiv i32 %10, 2
%12 = trunc i32 %11 to i16
store i16 %12, i16* %5
br label %13
13: ; preds = %26, %0
%14 = load i16, i16* %4
%15 = icmp ne i16 %14, 0
br i1 %15, label %16, label %29
16: ; preds = %13
%17 = load i32*, i32** %2
%18 = call i32 (i32*, i8*, ...) @fscanf(i32* %17, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%19 = load i8, i8* %3
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %25
22: ; preds = %16
%23 = load i16, i16* %5
%24 = add i16 %23, -1
store i16 %24, i16* %5
br label %25
25: ; preds = %22, %16
br label %26
26: ; preds = %25
%27 = load i16, i16* %4
%28 = add i16 %27, -1
store i16 %28, i16* %4
br label %13
29: ; preds = %13
%30 = load i32*, i32** %2
%31 = call i32 @fclose(i32* %30)
%32 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %32, i32** %2
%33 = load i16, i16* %5
%34 = sext i16 %33 to i32
%35 = icmp slt i32 %34, 0
%36 = zext i1 %35 to i64
%37 = select i1 %35, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
%38 = load i32*, i32** %2
%39 = call i32 @fputs(i8* %37, i32* %38)
%40 = load i32*, i32** %2
%41 = call i32 @fclose(i32* %40)
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"INP.TXT\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [4 x i8] c"%hd\00"
@.str.3 = [5 x i8] c"%hhd\00"
@.str.4 = [8 x i8] c"OUT.TXT\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [5 x i8] c"YES\0A\00"
@.str.7 = [4 x i8] c"NO\0A\00"
define i32 @main() {
%1 = alloca i8
%2 = alloca i16
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = bitcast i16* %2 to i8*
%5 = call i32 (i32*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i16* %2)
%6 = load i16, i16* %2
%7 = icmp eq i16 %6, 0
br i1 %7, label %23, label %8
8: ; preds = %0
%9 = sdiv i16 %6, 2
br label %10
10: ; preds = %8, %10
%11 = phi i16 [ %16, %10 ], [ %9, %8 ]
%12 = call i32 (i32*, i8*, ...) @fscanf(i32* %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%13 = load i8, i8* %1
%14 = icmp eq i8 %13, 1
%15 = sext i1 %14 to i16
%16 = add i16 %11, %15
%17 = load i16, i16* %2
%18 = add i16 %17, -1
store i16 %18, i16* %2
%19 = icmp eq i16 %18, 0
br i1 %19, label %20, label %10
20: ; preds = %10
%21 = icmp slt i16 %16, 0
%22 = select i1 %21, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0)
br label %23
23: ; preds = %20, %0
%24 = phi i8* [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), %0 ], [ %22, %20 ]
%25 = call i32 @fclose(i32* %3)
%26 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%27 = call i32 @fputs(i8* %24, i32* %26)
%28 = call i32 @fclose(i32* %26)
ret i32 0
}