#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int currentCount = 0, maxCount = 0, maxValue, currentValue, input = 1;
  while (1) {
    scanf("%d", &input);
    if (!input) {
      break;
    }
    if (input == currentValue) {
      currentCount++;
    } else {
      if (maxCount < currentCount) {
        maxCount = currentCount;
        maxValue = currentValue;
      }
      currentValue = input;
      currentCount = 1;
    }
  }
  printf("%d\n%d", maxCount, maxValue);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x18(%rbp)
lea    0xeb8(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x18(%rbp)
jne    1163 <main+0x43>
jmp    11a7 <main+0x87>
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    117d <main+0x5d>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11a2 <main+0x82>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1195 <main+0x75>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
movl   $0x1,-0x8(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movl   $0x1,0x4(%rsp)
lea    0xec9(%rip),%rdi
lea    0x4(%rsp),%r15
mov    %r15,%rsi
call   1040 <scanf@plt>
xor    %ebx,%ebx
mov    0x4(%rsp),%eax
mov    $0x1,%r12d
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%esi
mov    %ebp,%edi
lea    0x1(%rdx),%r13d
cmp    %edx,%ebx
cmovge %ebx,%edx
cmovl  %ecx,%ebp
mov    %eax,%r14d
cmp    %ecx,%eax
cmovne %r12d,%r13d
mov    %edx,%ebx
cmove  %esi,%ebx
cmove  %edi,%ebp
lea    0xe7b(%rip),%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
mov    %r14d,%ecx
mov    %r13d,%edx
test   %eax,%eax
jne    1160 <main+0x40>
lea    0xe5b(%rip),%rdi
mov    %ebx,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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