#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*/ preprocess(int *);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *, int *);
int main(void) {
  int N, M, accumulateNumDistinctInt[5001];
  preprocess(accumulateNumDistinctInt);
  while (scanf("%d %d", &N, &M) > 0) {
    printf("%d\n",
           accumulateNumDistinctInt[M] - accumulateNumDistinctInt[N - 1]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4e30,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x4e30(%rbp),%rdi
call   1050 <preprocess@plt>
lea    0xeab(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
cmp    $0x0,%rax
jle    1197 <main+0x67>
movslq -0xc(%rbp),%rax
mov    -0x4e30(%rbp,%rax,4),%esi
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
cltq
sub    -0x4e30(%rbp,%rax,4),%esi
lea    0xe79(%rip),%rdi
call   1030 <printf@plt>
jmp    114e <main+0x1e>
xor    %eax,%eax
add    $0x4e30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x4e38,%rsp
lea    0x10(%rsp),%rdi
call   1050 <preprocess@plt>
lea    0xeb1(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
call   1040 <scanf@plt>
test   %rax,%rax
jle    11ad <main+0x7d>
lea    0xe9c(%rip),%r14
lea    0xe8f(%rip),%r15
lea    0xc(%rsp),%r12
lea    0x8(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
movslq 0x8(%rsp),%rax
mov    0x10(%rsp,%rax,4),%esi
movslq 0xc(%rsp),%rax
sub    0xc(%rsp,%rax,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1040 <scanf@plt>
test   %rax,%rax
jg     1180 <main+0x50>
xor    %eax,%eax
add    $0x4e38,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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