#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*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int strtol(char *, int /*<<< orphan*/ *, int);
int main() {
  char str[4];
  fgets(str, 4, stdin);
  int n = strtol(&str[0], NULL, 10);
  int m = strtol(&str[2], NULL, 10);
  int hotel[n];
  for (int i = 0; i < n; i++) {
    scanf("%d", &hotel[i]);
  }
  int s;
  scanf("%d", &s);
  int vacant = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < m; j++) {
      if (hotel[i] % 10 == 0) {
        vacant += 1;
        if (vacant >= s) {
          printf("1\n");
          return 0;
        }
      } else {
        vacant = 0;
      }
      hotel[i] /= 10;
    }
  }
  printf("0\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e92(%rip),%rax
mov    (%rax),%edx
lea    -0x8(%rbp),%rdi
mov    %rdi,-0x58(%rbp)
mov    $0x4,%esi
call   1040 <fgets@plt>
mov    -0x58(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,-0x50(%rbp)
mov    $0xa,%edx
mov    %edx,-0x44(%rbp)
call   1050 <strtol@plt>
mov    -0x50(%rbp),%rsi
mov    -0x44(%rbp),%edx
mov    %eax,-0xc(%rbp)
lea    -0x6(%rbp),%rdi
call   1050 <strtol@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11fc <main+0xbc>
mov    -0x40(%rbp),%rsi
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe17(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11c7 <main+0x87>
lea    0xdfd(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    12d2 <main+0x192>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    12bf <main+0x17f>
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    128e <main+0x14e>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jl     1289 <main+0x149>
lea    0xd92(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x38(%rbp)
jmp    12ec <main+0x1ac>
jmp    1295 <main+0x155>
movl   $0x0,-0x2c(%rbp)
mov    -0x40(%rbp),%rax
movslq -0x30(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0xa,%esi
cltd
idiv   %esi
mov    %eax,%edx
mov    -0x40(%rbp),%rax
mov    %edx,(%rax,%rcx,4)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    122d <main+0xed>
jmp    12c4 <main+0x184>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    121a <main+0xda>
lea    0xd2d(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    0x2e90(%rip),%rax
mov    (%rax),%edx
lea    -0x34(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <fgets@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebx
lea    -0x32(%rbp),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %rsp,%r15
mov    %ebx,%r14d
lea    0xf(,%r14,4),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%r12
sub    %rcx,%r12
mov    %r12,%rsp
test   %ebx,%ebx
jle    1287 <main+0x147>
mov    %eax,-0x30(%rbp)
mov    %r15,-0x40(%rbp)
lea    0xe43(%rip),%r15
mov    %r14,%r13
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1060 <scanf@plt>
add    $0x4,%rbx
add    $0xffffffffffffffff,%r13
jne    11d0 <main+0x90>
lea    0xe14(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xe07(%rip),%rdi
test   %r14d,%r14d
jle    12a0 <main+0x160>
xor    %r10d,%r10d
mov    -0x2c(%rbp),%r9d
lea    0xdf2(%rip),%r8
xor    %edx,%edx
mov    -0x40(%rbp),%r15
mov    -0x30(%rbp),%r11d
jmp    122d <main+0xed>
nop
mov    %edx,%ecx
add    $0x1,%r10
mov    %ecx,%edx
cmp    %r14,%r10
je     12a4 <main+0x164>
test   %r11d,%r11d
jle    1220 <main+0xe0>
mov    (%r12,%r10,4),%esi
mov    %r11d,%ebx
jmp    1262 <main+0x122>
nopl   0x0(%rax,%rax,1)
movslq %esi,%rax
imul   $0x66666667,%rax,%rsi
mov    %rsi,%rax
shr    $0x3f,%rax
sar    $0x22,%rsi
add    %eax,%esi
mov    %esi,(%r12,%r10,4)
mov    %ecx,%edx
add    $0xffffffff,%ebx
je     1222 <main+0xe2>
imul   $0xcccccccd,%esi,%eax
add    $0x19999998,%eax
ror    %eax
xor    %ecx,%ecx
cmp    $0x19999998,%eax
ja     1240 <main+0x100>
add    $0x1,%edx
mov    %edx,%ecx
cmp    %r9d,%edx
jl     1240 <main+0x100>
mov    %r8,%rdi
jmp    12a4 <main+0x164>
lea    0xd72(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xd65(%rip),%rdi
jmp    12a4 <main+0x164>
mov    -0x40(%rbp),%r15
call   1030 <puts@plt>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@stdin = global i32 0
@.str = [3 x i8] c"%d\00"
@str = [2 x i8] c"0\00"
@str.3 = [2 x i8] c"1\00"
define i32 @main() {
%1 = alloca [4 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 4, i32 %4)
%6 = call i32 @strtol(i8* nocapture %3, i32* null, i32 10)
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 2
%8 = call i32 @strtol(i8* nocapture %7, i32* null, i32 10)
%9 = zext i32 %6 to i64
%10 = call i8* @llvm.stacksave()
%11 = alloca i32, i64 %9
%12 = icmp sgt i32 %6, 0
br i1 %12, label %22, label %13
13: ; preds = %0
%14 = bitcast i32* %2 to i8*
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %52
16: ; preds = %22
%17 = bitcast i32* %2 to i8*
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br i1 %12, label %19, label %52
19: ; preds = %16
%20 = icmp sgt i32 %8, 0
%21 = load i32, i32* %2
br label %28
22: ; preds = %0, %22
%23 = phi i64 [ %26, %22 ], [ 0, %0 ]
%24 = getelementptr inbounds i32, i32* %11, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %24)
%26 = add nuw nsw i64 %23, 1
%27 = icmp eq i64 %26, %9
br i1 %27, label %16, label %22
28: ; preds = %19, %48
%29 = phi i64 [ 0, %19 ], [ %50, %48 ]
%30 = phi i32 [ 0, %19 ], [ %49, %48 ]
br i1 %20, label %31, label %48
31: ; preds = %28
%32 = getelementptr inbounds i32, i32* %11, i64 %29
%33 = load i32, i32* %32
br label %34
34: ; preds = %31, %44
%35 = phi i32 [ %33, %31 ], [ %39, %44 ]
%36 = phi i32 [ 0, %31 ], [ %46, %44 ]
%37 = phi i32 [ %30, %31 ], [ %45, %44 ]
%38 = srem i32 %35, 10
%39 = sdiv i32 %35, 10
%40 = icmp eq i32 %38, 0
br i1 %40, label %41, label %44
41: ; preds = %34
%42 = add nsw i32 %37, 1
%43 = icmp slt i32 %42, %21
br i1 %43, label %44, label %52
44: ; preds = %34, %41
%45 = phi i32 [ %42, %41 ], [ 0, %34 ]
store i32 %39, i32* %32
%46 = add nuw nsw i32 %36, 1
%47 = icmp eq i32 %46, %8
br i1 %47, label %48, label %34
48: ; preds = %44, %28
%49 = phi i32 [ %30, %28 ], [ %45, %44 ]
%50 = add nuw nsw i64 %29, 1
%51 = icmp eq i64 %50, %9
br i1 %51, label %52, label %28
52: ; preds = %48, %41, %16, %13
%53 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %13 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %16 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str.3, i64 0, i64 0), %41 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0), %48 ]
%54 = bitcast i32* %2 to i8*
%55 = call i32 @puts(i8* dereferenceable(1) %53)
ret i32 0
}