#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 s;
  scanf("%d", &s);
  int arr[20], j, i, k, p, sum = 0;
  for (i = 0; i < s; j++) {
    scanf("%d", &arr[i]);
  }
  scanf("%d", &k);
  for (j = 0; j <= s - k; j++) {
    sum = 0;
    for (p = j; p < j + k; p++)
      sum = sum + arr[j];
    printf("%d\n", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x74(%rbp)
movl   $0x0,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1185 <main+0x65>
movslq -0x68(%rbp),%rax
lea    -0x60(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe8e(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    1150 <main+0x30>
lea    0xe74(%rip),%rdi
lea    -0x6c(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x64(%rbp)
mov    -0x64(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x6c(%rbp),%ecx
cmp    %ecx,%eax
jg     1204 <main+0xe4>
movl   $0x0,-0x74(%rbp)
mov    -0x64(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    -0x64(%rbp),%ecx
add    -0x6c(%rbp),%ecx
cmp    %ecx,%eax
jge    11e7 <main+0xc7>
mov    -0x74(%rbp),%eax
movslq -0x64(%rbp),%rcx
add    -0x60(%rbp,%rcx,4),%eax
mov    %eax,-0x74(%rbp)
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    11ba <main+0x9a>
mov    -0x74(%rbp),%esi
lea    0xe12(%rip),%rdi
call   1030 <printf@plt>
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
jmp    119c <main+0x7c>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x68,%rsp
lea    0xecf(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1162 <main+0x42>
lea    0xeb7(%rip),%r14
lea    0x10(%rsp),%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jg     1150 <main+0x30>
lea    0xe97(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
cmp    %eax,0x8(%rsp)
jge    118a <main+0x6a>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%ebp
xor    %r15d,%r15d
lea    0xe6a(%rip),%r14
xor    %ebx,%ebx
jmp    11c7 <main+0xa7>
nopl   (%rax)
mov    %r14,%rdi
call   1030 <printf@plt>
lea    0x1(%r15),%rcx
movslq 0x8(%rsp),%rdx
movslq 0xc(%rsp),%rax
sub    %rax,%rdx
add    $0x1,%ebp
add    $0xffffffff,%ebx
cmp    %rdx,%r15
mov    %rcx,%r15
jge    117d <main+0x5d>
mov    $0x0,%esi
test   %eax,%eax
jle    11a0 <main+0x80>
add    %r15d,%eax
cmp    %eax,%ebp
cmovg  %ebp,%eax
add    %ebx,%eax
imul   0x10(%rsp,%r15,4),%eax
mov    %eax,%esi
jmp    11a0 <main+0x80>

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

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