#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);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main() {
  int n, b, d, c = 0, a = 0, x;
  scanf("%d %d %d\n", &n, &b, &d);
  while (n--) {
    scanf("%d", &x);
    if (x <= b) {
      a += x;
      if (a > d) {
        ++c;
        a = 0;
      }
    }
  }
  printf("%d", c);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11b8 <main+0x98>
lea    0xe98(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11b3 <main+0x93>
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    11ae <main+0x8e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
jmp    11b3 <main+0x93>
jmp    1157 <main+0x37>
mov    -0x14(%rbp),%esi
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
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    0xecf(%rip),%rdi
xor    %ebx,%ebx
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
xor    %eax,%eax
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    116b <main+0x4b>
lea    0xeb3(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe98(%rip),%r14
lea    0xc(%rsp),%r15
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    118b <main+0x6b>
nopl   (%rax)
mov    %dl,%cl
add    %ecx,%ebx
subl   $0x1,0x8(%rsp)
jb     1150 <main+0x30>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    0x14(%rsp),%eax
jg     1184 <main+0x64>
add    %ebp,%eax
xor    %ebp,%ebp
xor    %ecx,%ecx
cmp    0x10(%rsp),%eax
setg   %dl
jg     1180 <main+0x60>
mov    %eax,%ebp
jmp    1180 <main+0x60>

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
br label %9
9: ; preds = %29, %0
%10 = load i32, i32* %2
%11 = add nsw i32 %10, -1
store i32 %11, i32* %2
%12 = icmp ne i32 %10, 0
br i1 %12, label %13, label %30
13: ; preds = %9
%14 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%15 = load i32, i32* %7
%16 = load i32, i32* %3
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %29
18: ; preds = %13
%19 = load i32, i32* %7
%20 = load i32, i32* %6
%21 = add nsw i32 %20, %19
store i32 %21, i32* %6
%22 = load i32, i32* %6
%23 = load i32, i32* %4
%24 = icmp sgt i32 %22, %23
br i1 %24, label %25, label %28
25: ; preds = %18
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
store i32 0, i32* %6
br label %28
28: ; preds = %25, %18
br label %29
29: ; preds = %28, %13
br label %9
30: ; preds = %9
%31 = load i32, i32* %5
%32 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %31)
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%10 = load i32, i32* %1
%11 = add nsw i32 %10, -1
store i32 %11, i32* %1
%12 = icmp eq i32 %10, 0
br i1 %12, label %33, label %13
13: ; preds = %0, %27
%14 = phi i32 [ %29, %27 ], [ 0, %0 ]
%15 = phi i32 [ %28, %27 ], [ 0, %0 ]
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %4
%18 = load i32, i32* %2
%19 = icmp sgt i32 %17, %18
br i1 %19, label %27, label %20
20: ; preds = %13
%21 = add nsw i32 %17, %14
%22 = load i32, i32* %3
%23 = icmp sgt i32 %21, %22
%24 = zext i1 %23 to i32
%25 = add nsw i32 %15, %24
%26 = select i1 %23, i32 0, i32 %21
br label %27
27: ; preds = %20, %13
%28 = phi i32 [ %15, %13 ], [ %25, %20 ]
%29 = phi i32 [ %14, %13 ], [ %26, %20 ]
%30 = load i32, i32* %1
%31 = add nsw i32 %30, -1
store i32 %31, i32* %1
%32 = icmp eq i32 %30, 0
br i1 %32, label %33, label %13
33: ; preds = %27, %0
%34 = phi i32 [ 0, %0 ], [ %28, %27 ]
%35 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %34)
ret i32 0
}