#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 */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *, int, int);
scalar_t__ scanf(char *, int *);
int main(void) {
  int n, max_count = 0, count[30001] = {0};
  scanf("%d", &n);
  while (scanf("%d", &n) != EOF) {
    if (++count[n] > max_count)
      max_count = count[n];
  }
  for (n = 1; n < 30001; n++)
    if (count[n] == max_count)
      printf("%d %d\n", n, max_count);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d4d0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x1d4d0(%rbp),%rdi
xor    %esi,%esi
mov    $0x1d4c4,%edx
call   1040 <memset@plt>
lea    0xe9d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe8d(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%rax
je     11bd <main+0x8d>
movslq -0x8(%rbp),%rcx
mov    -0x1d4d0(%rbp,%rcx,4),%eax
add    $0x1,%eax
mov    %eax,-0x1d4d0(%rbp,%rcx,4)
cmp    -0xc(%rbp),%eax
jle    11b8 <main+0x88>
movslq -0x8(%rbp),%rax
mov    -0x1d4d0(%rbp,%rax,4),%eax
mov    %eax,-0xc(%rbp)
jmp    116c <main+0x3c>
movl   $0x1,-0x8(%rbp)
cmpl   $0x7531,-0x8(%rbp)
jge    120a <main+0xda>
movslq -0x8(%rbp),%rax
mov    -0x1d4d0(%rbp,%rax,4),%eax
cmp    -0xc(%rbp),%eax
jne    11f7 <main+0xc7>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
jmp    11fc <main+0xcc>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11c4 <main+0x94>
xor    %eax,%eax
add    $0x1d4d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1d4d8,%rsp
lea    0x10(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x1d4c4,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xea8(%rip),%r14
lea    0xc(%rsp),%r15
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x2e6e(%rip),%r12
cmp    (%r12),%rax
je     11b8 <main+0x88>
xor    %ecx,%ecx
lea    0xe77(%rip),%r14
lea    0xc(%rsp),%r15
xchg   %ax,%ax
movslq 0xc(%rsp),%rax
mov    0x10(%rsp,%rax,4),%edx
lea    0x1(%rdx),%ebx
mov    %ebx,0x10(%rsp,%rax,4)
cmp    %ecx,%edx
cmovl  %ecx,%ebx
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    %ebx,%ecx
cmp    (%r12),%rax
jne    1190 <main+0x60>
movl   $0x1,0xc(%rsp)
mov    $0x1,%esi
lea    0xe37(%rip),%r14
jmp    11e1 <main+0xb1>
xchg   %ax,%ax
lea    0x1(%rsi),%eax
mov    %eax,0xc(%rsp)
cmp    $0x7530,%esi
mov    %eax,%esi
jge    11fa <main+0xca>
movslq %esi,%rax
cmp    %ebx,0x10(%rsp,%rax,4)
jne    11d0 <main+0xa0>
mov    %r14,%rdi
mov    %ebx,%edx
call   1030 <printf@plt>
mov    0xc(%rsp),%esi
jmp    11d0 <main+0xa0>
xor    %eax,%eax
add    $0x1d4d8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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