Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

l, r = map(int, input().split())
ans = []
for i in range(l,r+1):
    for j in range(i+1,r+1):
        ans.append((i*j)%2019)
print(min(ans))


### FIXED CODE ###

l, r = map(int, input().split())
ans = []
for i in range(l, r+1):
    for j in range(i+1, r+1):
        if j == i+1:
            start = (i*j) % 2019
        tmp = (i*j) % 2019
        if tmp == 0:
            print(0)
            exit()
        if j != i+1 and tmp == start:
            break
        else:
            ans.append(tmp)
print(min(ans))
### BUGGY CODE ###

from collections import deque

H,W=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())
S=[input() for _ in range(H)]
visited=[[-1]*W for _ in range(H)]
visited[ch-1][cw-1]=0
h=deque([(ch-1,cw-1)])
c=0
while 1:
  done=[]
  while h:
    cx,cy=h.popleft()
    done.append((cx,cy))
    for dx,dy in [(0,1),(1,0),(0,-1),(-1,0)]:
      nx,ny = cx+dx,cy+dy
      if 0<=nx<H and 0<=ny<W and S[nx][ny]=='.' and visited[nx][ny]==-1:
        h.append((nx,ny))
        visited[nx][ny]=c
  for cx,cy in done:
    for dx in range(-2,3):
      for dy in range(-2,3):
        nx,ny = cx+dx,cy+dy
        if 0<=nx<H and 0<=ny<W and S[nx][ny]=='.' and visited[nx][ny]==-1:
          h.append((nx,ny))
          visited[nx][ny]=c+1
  if not h or visited[dh-1][dw-1]!=-1:
    break
  c+=1
print(visited[dh-1][dw-1])

### FIXED CODE ###

from collections import deque

H,W=map(int,input().split())
ch,cw=map(int,input().split())
dh,dw=map(int,input().split())
S=[input() for _ in range(H)]
visited=[[-1]*W for _ in range(H)]
visited[ch-1][cw-1]=0
h=deque([(ch-1,cw-1)])
c=0
while 1:
  done=[]
  while h:
    cx,cy=h.popleft()
    done.append((cx,cy))
    for dx,dy in [(0,1),(1,0),(0,-1),(-1,0)]:
      nx,ny = cx+dx,cy+dy
      if 0<=nx<H and 0<=ny<W and S[nx][ny]=='.' and visited[nx][ny]==-1:
        h.append((nx,ny))
        visited[nx][ny]=c
  for cx,cy in done:
    for dx in range(-2,3):
      for dy in range(-2,3):
        nx,ny = cx+dx,cy+dy
        if 0<=nx<H and 0<=ny<W and S[nx][ny]=='.' and visited[nx][ny]==-1:
          h.append((nx,ny))
          visited[nx][ny]=c+1
  if not h or visited[dh-1][dw-1]!=-1:
    break
  c+=1
print(visited[dh-1][dw-1])
### BUGGY CODE ###

N,M=map(int, input().split())
A=list(map(int, input().split()))
A=sorted(A)

L=[[0,0] for _ in range(M)]
for i in range(M):
    b,c=map(int, input().split())
    L[i][0]=b
    L[i][1]=c

L=sorted(L,reverse=True, key=lambda x: x[1])
X=[]
for l in L:
    b=l[0]
    c=l[1]
    n=min(b,N-len(X))
    X=X+[c]*n
    if len(X)==N:
        break
#print(X)
ans=0
for i in range(N):
    if len(X)>i:
        ans+=max(X[i],A[i])
    else:
        ans+=A[i]

print(ans)

### FIXED CODE ###

N, M=map(int, input().split())
A=list(map(int, input().split()))
bc=[]
for i in range(M):
  b, c=map(int, input().split())
  bc.append((c,b))
for i in range(N):
  bc.append((A[i], 1))
  
bc=sorted(bc, key=lambda x : x[0], reverse=True)

ans=0
res=N
for x in bc:
  c=x[0]
  b=min(x[1], res)
  ans+=c*b
  res-=b
  if res==0:
    break
    
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))

arrSum = list(sum(A[:idx+1]) for idx in range(N))

ans = float('inf')
##2分する区切り目の左のインデックスi: 1 ～ (N - 3)
nextJ, nextK = -1, -1
for i in range(1, (N - 3) + 1):
    ##左側の区間の右端はi番目まである
    ##区切り目の左のインデックスj: 0 ～ (i - 1)
    buf = float('inf')
    nextJ = max(nextJ, 0)
    for j in range(nextJ, i):
        sumB = arrSum[j]
        sumC = arrSum[i] - arrSum[j]
        d = abs(sumB - sumC)
        if buf > d:
            buf = d
            P = sumB
            Q = sumC
            nextJ = j
    ##右側の区間の左端は(i + 1)番目
    ##区切り目の左のインデックスk: (i + 1) ～ (N - 2)
    buf = float('inf')
    nextK = max(nextK, (i + 1))
    for k in range(nextK, (N - 2) + 1):
        sumD = arrSum[k] - arrSum[i]
        sumE = arrSum[N-1] - arrSum[k]
        d = abs(sumD - sumE)
        if buf > d:
            buf = d
            R = sumD
            S = sumE
            nextK = k
    arr = list((P, Q, R, S))
    ans = min(ans, max(arr) - min(arr))
print(ans)

### FIXED CODE ###

##https://beta.atcoder.jp/contests/abc102/submissions/2779056
n = int(input())
a = list(map(int, input().split()))
s = [a[0]]
for i in range(n-1):
    s.append(s[i] + a[i+1])
ans = s[n-1]

##i,j,kは左側の区間の右端
##iは1からN-3まで
j = 0
k = 2             
for i in range(1, (n - 3) + 1):
    ##BC(i)DE
    ##BCの区間[0, i]: 最低でも2要素→0,1を取るのでi=1から
    ##DEの区間[i+1, N-1]: 最低でも2要素→N-2, N-1を取るので、i+1=N-2よりi=N-3まで

    ##B(j)C(i)DE
    #Bの区間[0, j]
    #Cの区間[j+1, i]
    ##sumB = s[j]
    ##sumC = s[i] - s[j]
    while abs(s[i] - 2 * s[j]) > abs(s[i] - 2 * s[j+1]):
        j += 1

    ##B(j)C(i)D(k)E
    #Dの区間[i+1, k]
    #Eの区間[k+1, N-1]
    ##sumD = s[k] - s[i]
    ##sumE = s[N-1] - s[k]
    while abs(s[n-1] - 2 * s[k] + s[i]) > abs(s[n-1] - 2 * s[k+1] + s[i]):
        k += 1
             
    pqrs = list((s[j],s[i]-s[j],s[k]-s[i],s[n-1]-s[k]))
    ans = min(ans, max(pqrs) - min(pqrs))
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

# input
N, Q = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(N - 1)]
px = [list(map(int, input().split())) for i in range(Q)]

# solve
ans = [0] * N
tree = [[] for i in range(N)]
for i in range(N):
    tree[0].append(i)
for i in range(1, N):
    tree[i].append(i)
for i in range(N - 1):
    if ab[i][0] != 1:
        tree[ab[i][0] - 1].append(ab[i][1] - 1)

for i in range(Q):
    point = px[i][0]
    for j in tree[point - 1]:
        ans[j] += px[i][1]

# output
for i in range(N):
    if i == N - 1:
        print(ans[i])
    else:
        print(ans[i], end=' ')


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10 ** 7)

# input & solve
input = sys.stdin.readline
N, Q = map(int, input().split())

to = [[] for _ in range(N)]
for i in range(N - 1):
    a, b = map(int, input().split())
    a -= 1
    b -= 1
    to[a].append(b)
    to[b].append(a)

ans = [0] * N
for i in range(Q):
    p, x = map(int, input().split())
    p -= 1
    ans[p] += x

def dfs(v, p=-1):
    for u in to[v]:
        if u == p:
            continue
        ans[u] += ans[v]
        dfs(u, v)

dfs(0)

# output
print(*ans)
### BUGGY CODE ###

import numpy as np


def f_modP(F, X):
    res = 0
    for i in range(len(F.c)):
        res += F.c[-(i+1)]*pow(X, i, P)
        res %= mod
    return int(res)


def modinv(X):
    return pow(X, P-2, P)


P = int(input())
A = list(map(int, input().split()))

is_0 = []
is_1 = []

for i in range(P):
    if A[i] == 1:
        is_1.append(i)
    else:
        is_0.append(i)
mod = P
f = np.poly1d([1])

for v in is_0:
    f *= np.poly1d([1, -v])
    d = f.c.copy()
    f = np.poly1d(d % P)


G_que = []

for v in is_1:
    values = int(f_modP(f,v))
    G_que.append((v, modinv(values)))

G = np.poly1d([0])
g = 0

for i in range(len(G_que)):
    basement = np.poly1d([1])
    for j in range(len(G_que)):
        if j != i:
            v, modvalue = G_que[j]
            basement *= np.poly1d([1, -v])
            g = basement.c.copy()
            basement = np.poly1d(g % P)
    V_basement = f_modP(basement, G_que[i][0])
    G += basement*(G_que[i][1]*modinv(V_basement) % P)

f *= G
ans = f.c.astype(int)
ans %= P
ADD = [0]*(P-len(ans))
ans = list(ans)

print(*(ADD + ans)[::-1])


### FIXED CODE ###

class Combi():
    def __init__(self, N, mod):
        self.power = [1 for _ in range(N+1)]
        self.rev = [1 for _ in range(N+1)]
        self.mod = mod
        for i in range(2, N+1):
            self.power[i] = (self.power[i-1]*i) % self.mod
        self.rev[N] = pow(self.power[N], self.mod-2, self.mod)
        for j in range(N, 0, -1):
            self.rev[j-1] = (self.rev[j]*j) % self.mod

    def C(self, K, R):
        if K < R:
            return 0
        else:
            return ((self.power[K])*(self.rev[K-R])*(self.rev[R])) % self.mod

    def P(self, K, R):
        if K < R:
            return 0
        else:
            return (self.power[K])*(self.rev[K-R]) % self.mod


P = int(input())
c = Combi(P-1, P)
A = list(map(int,input().split()))
ans = [0 for i in range(P)]
for i in range(P):
    if A[i] != 0:
        ans[0] += 1
        for j in range(P):
            ans[j] -= c.C(P-1, j)*pow(-i, P-1-j,P) 
for i in range(P):
    ans[i] %= P
print(*ans)
### BUGGY CODE ###

N = int(input())
A = input().split()

for a in A:
    A[A.index(a)] = int(a)
# print(sum(A))

# mid = N // 2

# print(A[:mid])
# print(A[mid:])


left = A[0]
right = A[-1]

front = 1
back = 1
for _ in range(N-2):
    if left > right:
        right += A[-1 - back]
        back += 1
    else:
        left += A[front]
        front += 1
    # print(left)
    # print(right)
    # print()



# print(left)
# print(right)
# if N % 2 == 1:
#     if right > left:
#         left += A[i]
#         i += 1
#     else:
#         right += A[-1 - i]

# print(left)
# print(right)

print(abs(left-right))


### FIXED CODE ###

N = int(input())
# A = input().split()
A = list(map(int, input().split()))
# f = open("tmp.text")
# A = list(map(int, f.read().split()))



# left = 0
# right = N - 1
# tmp = 10**9
# while True:
#     # print(left)
#     # print(right)
#     mid = (left + right) // 2
#     # print("mid: " + str(mid))
#     lnum = A[:mid+1]
#     rnum = A[mid+1:]
#     # print(lnum)
#     # print(rnum)
#     new = abs(sum(lnum) - sum(rnum))
#     if tmp == new:
#         break
#     if tmp > new:
#         tmp = new
#     if lnum > rnum:
#         right = mid

#     # print("tmp: "+str(tmp))
#     # input()
#     if left == right:
#         break

# print(tmp)



left = A[0]
right = A[-1]

front = 1
back = 1
for _ in range(N-2):
    if left > right:
        right += A[-1 - back]
        back += 1
    else:
        left += A[front]
        front += 1

print(abs(left-right))
### BUGGY CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
A=n1()

A.sort()
A=deque(A)
d=defaultdict(int)
for j in A:
    d[j]+=1     

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    #divisors.sort()
    return divisors

ans=0
while len(A)>0:
    a=A.popleft()
    l=make_divisors(a)

    for i in l:
        if i==a:
            if d[i]>1:
                break
        elif d[i]>0:
            break
    else:
        ans+=1
print(ans)

### FIXED CODE ###


def s0():return input()
def s1():return input().split()
def s2(n):return [input() for x in range(n)]
def s3(n):return [input().split() for _ in range(n)]
def s4(n):return [[x for x in s] for s in s2(n)]
def n0():return int(input())
def n1():return [int(x) for x in input().split()]
def n2(n):return [int(input()) for _ in range(n)]
def n3(n):return [[int(x) for x in input().split()] for _ in range(n)]
def t3(n):return [tuple(int(x) for x in input().split()) for _ in range(n)]
def p0(b,yes="Yes",no="No"): print(yes if b else no)
# from sys import setrecursionlimit
# setrecursionlimit(1000000)
from collections import Counter,deque,defaultdict
# import itertools
# import math
# import networkx as nx
# from bisect import bisect_left,bisect_right
# from heapq import heapify,heappush,heappop
n=n0()
A=n1()

A.sort()
m=A[-1]

d=defaultdict(int)
d2=defaultdict(int)

for i in A:
    d2[i]+=1

ans=0
for a in A:
    if d[a]==0:
        if d2[a]<=1:
            ans+=1
        i=a
        while i<=m:
            d[i]=1
            i+=a
print(ans)
### BUGGY CODE ###

#D問題
N, M = map(int, input().split())
A = list(map(int, input().split()))
for i in range(M):
    B, C = map(int, input().split())
    if min(A) < C:
        for j in range(B):
            A.remove(min(A))
            A.append(C)
            if min(A) >= C:
                break
                

print(sum(A))




### FIXED CODE ###

import heapq as hq
N, M = map(int, input().split())
A = list(map(int,input().split()))
A = [(-i,1) for i in A]
hq.heapify(A)
for i in range(M):
    B, C = map(int, input().split())
    hq.heappush(A,(-C,B))
sum_A = 0
for i in range(N):
    add_num = hq.heappop(A)
    sum_A += add_num[0]*-1
    if add_num[1] > 1:
        hq.heappush(A,(add_num[0],add_num[1]-1))
print(sum_A)
### BUGGY CODE ###

N, A, B = [int(x) for x in input().split()]

ans = 0
flag = True
list = ''
if A + B == N:
    ans = A
elif A == 0:
    ans = 0
else:
    while flag == True:
        for a in range(A):
            ans = ans + 1
            list += 'b'
            if len(list) == N:
                flag = False
                break
        for b in range(B):
            list += 'r'
            if len(list) == N:
                flag = False
                break
print(ans)

### FIXED CODE ###

N, A, B = [int(x) for x in input().split()]

mod = int(N % (A + B))
kake = int(N // (A + B))
if mod <= A:
    print(kake*A + mod)
else:
    print(kake*A + A)
### BUGGY CODE ###

N,K = [int(i) for i in input().split()]
A = [1]+[int(i) for i in input().split()]

P = 1
for i in range(1,N+1):
    A[i] *= A[i-1]

for i in range(K+1,N+1):
    if A[i]/A[i-K] > A[i-1]/A[i-K-1]:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

N,K = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]

for i in range(K,N):
    if A[i] > A[i-K]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

n,p = list(map(int,input().split()))
S = input()

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if int(s)%p == 0:
      ans += i+1
  print(ans)
  exit()

M = [0]*p
pre = 0
ans = 0
i = 0
for s in S[::-1]:
  pre = (int(s)*(10**i) +pre)%p
  M[pre] += 1
  i += 1

M[0] += 1
ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)


### FIXED CODE ###

n,p = list(map(int,input().split()))
S = input()

if p == 2 or p == 5:
  ans = 0
  for i,s in enumerate(S):
    if int(s)%p == 0:
      ans += i+1
  print(ans)
  exit()

def MS(i,s,pre):
  return (s*i +pre)%p
 
M = [0]*p
M[0] = 1
t = 1
now = 0
for i in S[::-1]:
    i = int(i)
    now += i*t
    now %= p
    M[now] += 1
    t = t*10%p

ans = sum(map(lambda m:(m*(m-1))//2, M))
print(ans)
### BUGGY CODE ###

s = input()
x = int(input())
n = len(s)

pos = [[] for __ in range(256)]
for i in range(n):
    pos[ord(s[i])].append(i)

f = set()
for c in range(97, 123):
    for i in pos[c]:
        for j in range(i, n):
            f.add(s[i:j+1])
            if len(f) >= 10000:
                break
    if len(f) >= x:
        break

def cmp(u, v):
    while len(u) < len(v): u = u + '1'
    while len(u) > len(v): v = v + '1'
    return u > v

p = [u for u in f]
for i in range(len(p)):
    for j in range(i+1, len(p)):
        if cmp(p[i], p[j]):
            p[i], p[j] = p[j], p[i]

print(p[x - 1])

### FIXED CODE ###

s = input()
x = int(input())
n = len(s)

pos = [[] for __ in range(256)]
for i in range(n):
    pos[ord(s[i])].append(i)

f = set()
for c in range(97, 123):
    for i in pos[c]:
        for j in range(x):
            f.add(s[i:i+j+1])
    if len(f) >= x:
        break

p = [u for u in f]
p.sort()
print(p[x - 1])
### BUGGY CODE ###

from sys import stdin
S = input()
Q = int(input())
reverse = 0
head = []
tail = []

for i in range(Q):
    readline = stdin.readline
    s = readline().split()
    if int(s[0]) == 1:
        reverse = (reverse + 1) % 2
    else:
        if int(s[1]) == 1:
            if reverse == 1:
                tail.append(s[2])
            else:
                head.insert(0, s[2])
        else:
            if reverse == 1:
                head.insert(0, s[2])
            else:
                tail.append(s[2])
head = ''.join(head)
tail = ''.join(tail)
if reverse == 1:
    print(tail[::-1]+S[::-1]+head[::-1])
else:
    print(head+S+tail)

### FIXED CODE ###

def main():
    from sys import stdin
    from collections import deque
    S = input()
    Q = int(input())
    reverse = 0
    head = []
    tail = []
    head_deque = deque(head)
    tail_deque = deque(tail)
    
    for _ in [0] * Q:
        readline = stdin.readline
        s = readline().split()
        if int(s[0]) == 1:
            if reverse == 1:
                reverse = 0
            else:
                reverse = 1
        else:
            if int(s[1]) == 1:
                if reverse == 1:
                    tail.append(s[2])
                else:
                    head_deque.appendleft(s[2])
            else:
                if reverse == 1:
                    head_deque.appendleft(s[2])
                else:
                    tail.append(s[2])
    head = list(head_deque)
    head = ''.join(head)
    tail = ''.join(tail)
    if reverse == 1:
        print(tail[::-1]+S[::-1]+head[::-1])
    else:
        print(head+S+tail)
        
main()
### BUGGY CODE ###

import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from collections import defaultdict
def main():
    k = int(input())
    if k % 2 == 0:
        print(-1)
        sys.exit()
    rems = defaultdict(int)
    n = 7
    next_digit = 70
    r = 1
    while True:
        rem = n % k
        if rem == 0:
            print(r)
            sys.exit()
        elif rems[rem]:
            print(-1)
            sys.exit()
        else:
            rems[rem] = 1
            n += next_digit
            next_digit *= 10
            r += 1
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    k = int(input())
    if k % 2 == 0 or k % 5 == 0:
        print(-1)
        sys.exit()
    p = 7
    plus = 7
    amari = set()
    r = 1
    while (p % k) != 0:
        if p in amari:
            print(r, -1, p)
            sys.exit()
        else:
            amari.add(p)
            plus = (plus * 10) % k
            p += plus
            p = p % k
            r += 1
    print(r)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=0
    for i in range(k):
      if i%2==0:
        out+=len(S)//2
      else:
        out+=len(S)//2+1
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))

### FIXED CODE ###

S=list(input())
k=int(input())

cnt,ans=0,0
T=S+S
for i in range(1,len(T)):
  if T[i-1]==T[i]:
    cnt+=1
  else:
    ans+=(cnt+1)//2
    cnt=0
  if i==len(S)-1:
    ans+=(cnt+1)//2
    tmp=ans

if len(S)==1:
  print(k//2)
  exit()
if len(S)==2:
  if S[0]==S[1]:
    print(k)
  else:
    print(0)
  exit()
  
if len(set(T))==1:
  if len(S)%2==0:
    print(len(S)//2*k)
  else:
    out=(len(S)//2)*(k-(k//2))+(len(S)//2+1)*(k//2)
    print(out)
  exit()
      
print(tmp+(ans-tmp)*(k-1))
### BUGGY CODE ###

N, K  = map(int, input().split())
L = [list(map(int, input().split())) for _ in range(K)]
S = set()
for l in L:
  S = S|set([i for i in range(l[0], l[1]+1)])
DP = [0]*N
DP[0]=1
for i in range(1, N):
  for j in S:
    if i>=j:
      DP[i] += DP[i-j]
      DP[i] %= 998244353
print(DP[-1])

### FIXED CODE ###

N, K = map(int, input().split())
L = []
for _ in range(K):
  a, b = map(int, input().split())
  L.append((a,b))
L.sort()
DP_1 = [0]*N
DP_2 = [0]*(N+1)
DP_1[0], DP_2[1] = 1, 1
mod = 998244353
for i in range(1, N):
  for l in L:
    if l[0]>i:
      break
    elif l[1]>i:
      DP_1[i] += DP_2[i-l[0]+1]
      DP_1[i] %= mod
    elif l[1]<=i:
      DP_1[i] += DP_2[i-l[0]+1]-DP_2[i-l[1]]
      DP_1[i] %= mod
  DP_2[i+1] = DP_2[i] + DP_1[i]
  DP_2[i+1] %= mod
print(DP_1[-1]%mod)
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))

for i in range(N):
    print(A.count(i+1))


### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
cnt = []
[cnt.append(0) for _ in range(len(A))]

for i in A:
    cnt[i-1] += 1

for i in range(N-1):
    print(cnt[i])

print("0")
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
L=[(i,A[i]) for i in range(N)]
B=sorted(L,key=lambda x: x[1],reverse=True)
S=0
i=0
for j in range(1,N):
    if j%2==1:
        S+=B[0][1]
        del B[0]
    else:
        S+=B[0][1]
print(S)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
B=sorted(A,reverse=True)
S=0
i=0
for j in range(1,N):
    if j%2==1:
        S+=B[i]
        i+=1
    else:
        S+=B[i]
print(S)
### BUGGY CODE ###

def xor(a, b):
    xor = a ^ b
    return xor


n = int(input())
a = list(map(int, input().split()))

count = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        count += xor(a[i], a[j])

print(count % (10 ** 9 + 7))


### FIXED CODE ###

import numpy as np

n = int(input())
s = input().split()
a = []
for i in range(n):
    a.append(int(s[i]))
arr = np.array(a)
# arr = np.array([int(i) for i in input().split()])

mod = 10 ** 9 + 7
ans = 0

for i in range(60):
    #arrについて2進数を右へ論理シフトした値になる？
    c1 = np.count_nonzero(arr & 1)
    ans += 2 ** i * c1 * (n - c1)
    arr >>= 1

print(ans % mod)
### BUGGY CODE ###

R, C, K = map(int, input().split())
p = []
for k in range(K):
  p.append(list(map(int, input().split())))

maps = [[0 for _ in range(C)] for _ in range(R)]
for k in range(K):
  maps[p[k][0]-1][p[k][1]-1] += p[k][2]

point = [[[0, 0, 0] for _ in range(C)] for _ in range(R)]

point[0][0][0] = maps[0][0]

for k in range(R + C):
  for r in range(max(0, k - C + 1), min(k+1, R)):
    c = k - r
    a, b, d = point[r][c]
    if r < R - 1:
      point[r+1][c][0] = maps[r+1][c] + max(a, b, d)      
    if c < C - 1:
      x = maps[r][c+1]
      y = point[r][c+1]
      y[0] = max(y[0], x, a)
      y[1] = max(a + x, b)
      y[2] = max(b + x, d)
      point[r][c+1] = y

print(max(point[-1][-1][0:3]))

### FIXED CODE ###

R, C, K = map(int, input().split())
# = int(input())
p = []
for k in range(K):
  p.append(list(map(int, input().split())))

maps = [[0 for _ in range(C)] for _ in range(R)]
for k in range(K):
  maps[p[k][0]-1][p[k][1]-1] += p[k][2]

point1 = [[0 for _ in range(C)] for _ in range(R)]
point2 = [[0 for _ in range(C)] for _ in range(R)]
point3 = [[0 for _ in range(C)] for _ in range(R)]

point1[0][0] = maps[0][0]

for r in range(R):
  for c in range(C):
    a, b, d = point1[r][c], point2[r][c], point3[r][c]  
    if c < C - 1:
      x = maps[r][c+1]
      point1[r][c+1] = max(point1[r][c+1], x, a)
      point2[r][c+1] = max(point2[r][c+1], a + x, b)
      point3[r][c+1] = max(point3[r][c+1], b + x, d)
    if r < R - 1:
      point1[r+1][c] = maps[r+1][c] + max(a, b, d)


print(max(point1[-1][-1], point2[-1][-1], point3[-1][-1]))
### BUGGY CODE ###

n, m, qqq = map(int, input().split())
LR = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    LR[l-1][r-1]+=1


for i in range(qqq):
    p, q = map(int, input().split())
    ans = 0
    for i in range(p-1, n):
        for j in range(q):
            ans += LR[i][j]
    print(ans)
# print(LR)


### FIXED CODE ###

n, m, qqq = map(int, input().split())
DP = [[0 for _ in range(n)]for __ in range(n)]

for i in range(m):
    l, r = map(int, input().split())
    DP[l-1][r-1]+=1


#DP = [[0 for _ in range(n)]for __ in range(n)]
for i in range(n-1)[::-1]:
    for j in range(1,n):
        DP[i][j] += DP[i+1][j]+DP[i][j-1]-DP[i+1][j-1]

for i in range(qqq):
    p, q = map(int, input().split())
    print(DP[p-1][q-1])
# print(DP)