#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 stu[100000], n, m, i;
  int current = 0, max = 0;
  scanf("%d %d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &stu[i]);
    current += stu[i];
    if (i >= m)
      current -= stu[i - m];
    if (max < current)
      max = current;
  }
  printf("%d", max);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x61aa0(%rbp)
movl   $0x0,-0x61aa4(%rbp)
lea    0xeb3(%rip),%rdi
lea    -0x61a94(%rbp),%rsi
lea    -0x61a98(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x61a9c(%rbp)
mov    -0x61a9c(%rbp),%eax
cmp    -0x61a94(%rbp),%eax
jge    1227 <main+0x107>
movslq -0x61a9c(%rbp),%rax
lea    -0x61a90(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0x61a9c(%rbp),%rax
mov    -0x61a90(%rbp,%rax,4),%eax
add    -0x61aa0(%rbp),%eax
mov    %eax,-0x61aa0(%rbp)
mov    -0x61a9c(%rbp),%eax
cmp    -0x61a98(%rbp),%eax
jl     11f0 <main+0xd0>
mov    -0x61a9c(%rbp),%eax
sub    -0x61a98(%rbp),%eax
cltq
mov    -0x61a90(%rbp,%rax,4),%ecx
mov    -0x61aa0(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x61aa0(%rbp)
mov    -0x61aa4(%rbp),%eax
cmp    -0x61aa0(%rbp),%eax
jge    120e <main+0xee>
mov    -0x61aa0(%rbp),%eax
mov    %eax,-0x61aa4(%rbp)
jmp    1213 <main+0xf3>
mov    -0x61a9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a9c(%rbp)
jmp    116c <main+0x4c>
mov    -0x61aa4(%rbp),%esi
lea    0xdcf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x61a90,%rsp
lea    0xeca(%rip),%rdi
xor    %r15d,%r15d
lea    0x8(%rsp),%rsi
lea    0xc(%rsp),%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    11be <main+0x9e>
lea    0xeab(%rip),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
xor    %r12d,%r12d
jmp    1189 <main+0x69>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    %r12d,%r15d
cmovl  %r12d,%r15d
add    $0x1,%rbp
movslq 0x8(%rsp),%rax
add    $0x4,%rbx
cmp    %rax,%rbp
jge    11be <main+0x9e>
lea    (%rsp,%rbx,1),%rsi
add    $0x10,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
add    0x10(%rsp,%rbp,4),%r12d
movslq 0xc(%rsp),%rax
cmp    %rax,%rbp
jl     1170 <main+0x50>
shl    $0x2,%rax
neg    %rax
add    %rsp,%rax
add    $0x10,%rax
sub    (%rax,%rbp,4),%r12d
jmp    1170 <main+0x50>
lea    0xe3e(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x61a90,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d %d\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x 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* %6
store i32 0, i32* %7
%8 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %4)
store i32 0, i32* %5
br label %9
9: ; preds = %43, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %46
13: ; preds = %9
%14 = load i32, i32* %5
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %15
%17 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %5
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = load i32, i32* %6
%23 = add nsw i32 %22, %21
store i32 %23, i32* %6
%24 = load i32, i32* %5
%25 = load i32, i32* %4
%26 = icmp sge i32 %24, %25
br i1 %26, label %27, label %36
27: ; preds = %13
%28 = load i32, i32* %5
%29 = load i32, i32* %4
%30 = sub nsw i32 %28, %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = load i32, i32* %6
%35 = sub nsw i32 %34, %33
store i32 %35, i32* %6
br label %36
36: ; preds = %27, %13
%37 = load i32, i32* %7
%38 = load i32, i32* %6
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %42
40: ; preds = %36
%41 = load i32, i32* %6
store i32 %41, i32* %7
br label %42
42: ; preds = %40, %36
br label %43
43: ; preds = %42
%44 = load i32, i32* %5
%45 = add nsw i32 %44, 1
store i32 %45, i32* %5
br label %9
46: ; preds = %9
%47 = load i32, i32* %7
%48 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
%49 = load i32, i32* %1
ret i32 %49
}

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