#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 niceV[20000], nice;
  int a = 1, b = 1, c = 1, d = 1, Y = 0, X = 0;
  int r, s, i, j;
  scanf(" %d", &r);
  for (i = 1; i <= r; i++) {
    scanf(" %d", &s);
    a = 1, b = 1, c = 1, d = 1, Y = 0, X = 0;
    for (j = 0; j < s - 1; j++) {
      scanf(" %d", &nice);
      Y += nice;
      b = j + 2;
      if (Y < 0) {
        Y = 0;
        a = b;
      }
      if (Y > X) {
        X = Y;
        c = a;
        d = b;
      }
      if (Y == X && (b - a) > (d - c)) {
        X = Y;
        c = a;
        d = b;
      }
    }
    if (c != d)
      printf("The nicest part of route %d is between stops %d and %d\n", i, c,
             d);
    else
      printf("Route %d has no nice parts\n", i);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x138c0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x13898(%rbp)
movl   $0x1,-0x1389c(%rbp)
movl   $0x1,-0x138a0(%rbp)
movl   $0x1,-0x138a4(%rbp)
movl   $0x0,-0x138a8(%rbp)
movl   $0x0,-0x138ac(%rbp)
lea    0xe8b(%rip),%rdi
lea    -0x138b0(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x138b8(%rbp)
mov    -0x138b8(%rbp),%eax
cmp    -0x138b0(%rbp),%eax
jg     136d <main+0x24d>
lea    0xe5c(%rip),%rdi
lea    -0x138b4(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x13898(%rbp)
movl   $0x1,-0x1389c(%rbp)
movl   $0x1,-0x138a0(%rbp)
movl   $0x1,-0x138a4(%rbp)
movl   $0x0,-0x138a8(%rbp)
movl   $0x0,-0x138ac(%rbp)
movl   $0x0,-0x138bc(%rbp)
mov    -0x138bc(%rbp),%eax
mov    -0x138b4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1309 <main+0x1e9>
lea    0xdec(%rip),%rdi
lea    -0x13894(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x13894(%rbp),%eax
add    -0x138a8(%rbp),%eax
mov    %eax,-0x138a8(%rbp)
mov    -0x138bc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1389c(%rbp)
cmpl   $0x0,-0x138a8(%rbp)
jge    1264 <main+0x144>
movl   $0x0,-0x138a8(%rbp)
mov    -0x1389c(%rbp),%eax
mov    %eax,-0x13898(%rbp)
mov    -0x138a8(%rbp),%eax
cmp    -0x138ac(%rbp),%eax
jle    129a <main+0x17a>
mov    -0x138a8(%rbp),%eax
mov    %eax,-0x138ac(%rbp)
mov    -0x13898(%rbp),%eax
mov    %eax,-0x138a0(%rbp)
mov    -0x1389c(%rbp),%eax
mov    %eax,-0x138a4(%rbp)
mov    -0x138a8(%rbp),%eax
cmp    -0x138ac(%rbp),%eax
jne    12f0 <main+0x1d0>
mov    -0x1389c(%rbp),%eax
sub    -0x13898(%rbp),%eax
mov    -0x138a4(%rbp),%ecx
sub    -0x138a0(%rbp),%ecx
cmp    %ecx,%eax
jle    12f0 <main+0x1d0>
mov    -0x138a8(%rbp),%eax
mov    %eax,-0x138ac(%rbp)
mov    -0x13898(%rbp),%eax
mov    %eax,-0x138a0(%rbp)
mov    -0x1389c(%rbp),%eax
mov    %eax,-0x138a4(%rbp)
jmp    12f5 <main+0x1d5>
mov    -0x138bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138bc(%rbp)
jmp    11f6 <main+0xd6>
mov    -0x138a0(%rbp),%eax
cmp    -0x138a4(%rbp),%eax
je     1340 <main+0x220>
mov    -0x138b8(%rbp),%esi
mov    -0x138a0(%rbp),%edx
mov    -0x138a4(%rbp),%ecx
lea    0xcd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1354 <main+0x234>
mov    -0x138b8(%rbp),%esi
lea    0xcef(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1359 <main+0x239>
mov    -0x138b8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138b8(%rbp)
jmp    118b <main+0x6b>
xor    %eax,%eax
add    $0x138c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    125d <main+0x13d>
mov    $0x1,%ebp
lea    0x4(%rsp),%r14
jmp    117f <main+0x5f>
cs nopw 0x0(%rax,%rax,1)
lea    0xed5(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1(%rbp),%eax
cmp    0x8(%rsp),%ebp
mov    %eax,%ebp
jge    125d <main+0x13d>
lea    0xe7a(%rip),%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpl   $0x2,0x4(%rsp)
jl     1160 <main+0x40>
mov    %rbp,0x10(%rsp)
mov    $0x1,%r13d
xor    %r12d,%r12d
mov    $0x2,%r14d
xor    %r15d,%r15d
mov    $0x1,%ebx
mov    $0x1,%ebp
jmp    11d7 <main+0xb7>
nopl   0x0(%rax,%rax,1)
mov    0x4(%rsp),%eax
add    $0xffffffff,%eax
lea    0x1(%r14),%ecx
add    $0xffffffff,%r14d
cmp    %eax,%r14d
mov    %ecx,%r14d
jge    1230 <main+0x110>
lea    0xe22(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
add    0xc(%rsp),%r15d
cmovs  %r14d,%ebp
mov    $0x0,%eax
cmovs  %eax,%r15d
cmp    %r12d,%r15d
cmova  %ebp,%ebx
cmova  %r14d,%r13d
cmova  %r15d,%r12d
jb     11c0 <main+0xa0>
mov    %r14d,%eax
sub    %ebp,%eax
mov    %r13d,%ecx
sub    %ebx,%ecx
cmp    %ecx,%eax
jle    11c0 <main+0xa0>
mov    %ebp,%ebx
mov    %r14d,%r13d
mov    %r15d,%r12d
jmp    11c0 <main+0xa0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %r13d,%ebx
mov    0x10(%rsp),%rbp
lea    0x4(%rsp),%r14
je     1160 <main+0x40>
lea    0xdba(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
mov    %r13d,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1170 <main+0x50>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c" %d\00"
@.str.1 = [56 x i8] c"The nicest part of route %d is between stops %d and %d\0A\00"
@.str.2 = [28 x i8] c"Route %d has no nice parts\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 1
br i1 %9, label %57, label %10
10: ; preds = %0, %53
%11 = phi i32 [ %54, %53 ], [ 1, %0 ]
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = load i32, i32* %3
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %51
15: ; preds = %10, %39
%16 = phi i32 [ %43, %39 ], [ 0, %10 ]
%17 = phi i32 [ %42, %39 ], [ 0, %10 ]
%18 = phi i32 [ %28, %39 ], [ 0, %10 ]
%19 = phi i32 [ %41, %39 ], [ 1, %10 ]
%20 = phi i32 [ %40, %39 ], [ 1, %10 ]
%21 = phi i32 [ %27, %39 ], [ 1, %10 ]
%22 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%23 = load i32, i32* %1
%24 = add nsw i32 %23, %18
%25 = add nuw nsw i32 %16, 2
%26 = icmp slt i32 %24, 0
%27 = select i1 %26, i32 %25, i32 %21
%28 = select i1 %26, i32 0, i32 %24
%29 = icmp ugt i32 %28, %17
%30 = select i1 %29, i32 %27, i32 %20
%31 = select i1 %29, i32 %25, i32 %19
%32 = select i1 %29, i32 %28, i32 %17
%33 = icmp ult i32 %28, %17
br i1 %33, label %39, label %34
34: ; preds = %15
%35 = sub nsw i32 %25, %27
%36 = sub nsw i32 %31, %30
%37 = icmp sgt i32 %35, %36
br i1 %37, label %38, label %39
38: ; preds = %34
br label %39
39: ; preds = %15, %34, %38
%40 = phi i32 [ %27, %38 ], [ %30, %34 ], [ %30, %15 ]
%41 = phi i32 [ %25, %38 ], [ %31, %34 ], [ %31, %15 ]
%42 = phi i32 [ %28, %38 ], [ %32, %34 ], [ %32, %15 ]
%43 = add nuw nsw i32 %16, 1
%44 = load i32, i32* %3
%45 = add nsw i32 %44, -1
%46 = icmp slt i32 %43, %45
br i1 %46, label %15, label %47
47: ; preds = %39
%48 = icmp eq i32 %40, %41
br i1 %48, label %51, label %49
49: ; preds = %47
%50 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %40, i32 %41)
br label %53
51: ; preds = %10, %47
%52 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %11)
br label %53
53: ; preds = %49, %51
%54 = add nuw nsw i32 %11, 1
%55 = load i32, i32* %2
%56 = icmp slt i32 %11, %55
br i1 %56, label %10, label %57
57: ; preds = %53, %0
ret i32 0
}