To stay woke and attentive during classes, Karen needs some coffee! [Image] 

Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she has spent some time reading several recipe books, including the universally acclaimed "The Art of the Covfefe".

She knows n coffee recipes. The i-th recipe suggests that coffee should be brewed between l_{i} and r_{i} degrees, inclusive, to achieve the optimal taste.

Karen thinks that a temperature is admissible if at least k recipes recommend it.

Karen has a rather fickle mind, and so she asks q questions. In each question, given that she only wants to prepare coffee with a temperature between a and b, inclusive, can you tell her how many admissible integer temperatures fall within the range?


-----Input-----

The first line of input contains three integers, n, k (1 ≤ k ≤ n ≤ 200000), and q (1 ≤ q ≤ 200000), the number of recipes, the minimum number of recipes a certain temperature must be recommended by to be admissible, and the number of questions Karen has, respectively.

The next n lines describe the recipes. Specifically, the i-th line among these contains two integers l_{i} and r_{i} (1 ≤ l_{i} ≤ r_{i} ≤ 200000), describing that the i-th recipe suggests that the coffee be brewed between l_{i} and r_{i} degrees, inclusive.

The next q lines describe the questions. Each of these lines contains a and b, (1 ≤ a ≤ b ≤ 200000), describing that she wants to know the number of admissible integer temperatures between a and b degrees, inclusive.


-----Output-----

For each question, output a single integer on a line by itself, the number of admissible integer temperatures between a and b degrees, inclusive.


-----Examples-----
Input
3 2 4
91 94
92 97
97 99
92 94
93 97
95 96
90 100

Output
3
3
0
4

Input
2 1 1
1 1
200000 200000
90 100

Output
0



-----Note-----

In the first test case, Karen knows 3 recipes.  The first one recommends brewing the coffee between 91 and 94 degrees, inclusive.  The second one recommends brewing the coffee between 92 and 97 degrees, inclusive.  The third one recommends brewing the coffee between 97 and 99 degrees, inclusive. 

A temperature is admissible if at least 2 recipes recommend it.

She asks 4 questions.

In her first question, she wants to know the number of admissible integer temperatures between 92 and 94 degrees, inclusive. There are 3: 92, 93 and 94 degrees are all admissible.

In her second question, she wants to know the number of admissible integer temperatures between 93 and 97 degrees, inclusive. There are 3: 93, 94 and 97 degrees are all admissible.

In her third question, she wants to know the number of admissible integer temperatures between 95 and 96 degrees, inclusive. There are none.

In her final question, she wants to know the number of admissible integer temperatures between 90 and 100 degrees, inclusive. There are 4: 92, 93, 94 and 97 degrees are all admissible.

In the second test case, Karen knows 2 recipes.  The first one, "wikiHow to make Cold Brew Coffee", recommends brewing the coffee at exactly 1 degree.  The second one, "What good is coffee that isn't brewed at at least 36.3306 times the temperature of the surface of the sun?", recommends brewing the coffee at exactly 200000 degrees. 

A temperature is admissible if at least 1 recipe recommends it.

In her first and only question, she wants to know the number of admissible integer temperatures that are actually reasonable. There are none.

Difficulty: interview

Starter code:

Solutions:
n, k, q = list(map(int, input().split()))
recipe_in = []
for i in range(n):
    l, r = list(map(int, input().split()))
    recipe_in.append((l, r))

query_in = []
for i in range(q):
    l, r = list(map(int, input().split()))
    query_in.append((l, r))

MAX = 200000 + 10
recipes = [0 for i in range(MAX)]
for recipe in recipe_in:
    l, r = recipe
    recipes[l] += 1
    recipes[r + 1] -= 1
for i in range(1, MAX):
    recipes[i] += recipes[i - 1]

cnts = [0 for i in range(MAX)]
for i in range(MAX):
    if recipes[i] >= k:
        cnts[i] += 1
for i in range(1, MAX):
    cnts[i] += cnts[i - 1]

for query in query_in:
    l, r = query
    ans = cnts[r] - cnts[l - 1]
    print(ans)


#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
    return list(map(int, stdin.readline().split()))
#lines = stdin.readlines()


n, k, q = rint()
r = [0 for i in range(200001)]
l = [0 for i in range(200001)]

for i in range(n):
    ll, rr = rint()
    r[rr] += 1
    l[ll] += 1

f = [0 for i in range(200001)]
for i in range(1,200001):
    f[i] = f[i-1] + l[i] - r[i-1]

ss = [0 for i in range(200002)]
for i in range(200000, 0, -1):
    if f[i] >= k:
        ss[i] = ss[i+1] + 1
    else:
        ss[i] = ss[i+1]

for i in range(q):
    ll, rr = rint()
    print( ss[ll] - ss[rr+1])




n, k, q = list(map(int, input().split()))

MAX_TEMP = 200000 + 10
temps = [0 for x in range(MAX_TEMP)]

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

sums = [0 for x in range(MAX_TEMP)]
count = 0
for i in range(1, MAX_TEMP):
    count += temps[i]
    if count >= k:
        sums[i] = 1
    sums[i] += sums[i - 1]

answers = []
for i in range(q):
    a, b = list(map(int, input().split()))
    answers.append(sums[b] - sums[a - 1])

for ans in answers:
    print(ans)


from sys import stdin, stdout


def read_ints():
    return list(map(int, stdin.readline().split()))
# lines = stdin.readlines()


n, k, q = read_ints()

MAX_TEMP = 200000 + 10
temps = [0 for x in range(MAX_TEMP)]

for i in range(n):
    l, r = read_ints()
    temps[l] += 1
    temps[r + 1] -= 1

sums = [0 for x in range(MAX_TEMP)]
count = 0
for i in range(1, MAX_TEMP):
    count += temps[i]
    if count >= k:
        sums[i] = 1
    sums[i] += sums[i - 1]

for i in range(q):
    a, b = read_ints()
    print(sums[b] - sums[a - 1])


from sys import stdin, stdout


def read_ints():
    return list(map(int, stdin.readline().split()))
# lines = stdin.readlines()


n, k, q = read_ints()

MAX_TEMP = 200000 + 2
temps = [0] * MAX_TEMP

for i in range(n):
    l, r = read_ints()
    temps[l] += 1
    temps[r + 1] -= 1

sums = [0] * MAX_TEMP
count = 0
for i in range(1, MAX_TEMP):
    count += temps[i]
    if count >= k:
        sums[i] = 1
    sums[i] += sums[i - 1]

for i in range(q):
    a, b = read_ints()
    print(sums[b] - sums[a - 1])


n, k, q = list(map(int, input().split()))
recipes = [0] * (200000 + 2)
res = []

for _ in range(n):
    l, r = list(map(int, input().split()))
    recipes[l] += 1
    recipes[r+1] -= 1

for i in range(1, len(recipes)):
    recipes[i] += recipes[i-1]

for i in range(1, len(recipes)):
    recipes[i] = 1 if recipes[i] >= k else 0
    recipes[i] += recipes[i-1]

for _ in range(q):
    a, b = list(map(int, input().split()))
    res.append((recipes[b] - recipes[a-1]))

print('\n'.join(map(str, res)))


from itertools import accumulate

MAX = 200002

n, k, q = list(map(int, input().split()))

info = [0] * MAX
for i in range(n):
    l, r = list(map(int, input().split()))
    info[l] += 1
    info[r + 1] -= 1

acc = 0
for ind, diff in enumerate(info):
    acc += diff
    if acc >= k:
        info[ind] = 1
    else:
        info[ind] = 0

pref = list(accumulate(info))
ans = []
for i in range(q):
    l, r = list(map(int, input().split()))
    ans.append(str(pref[r] - pref[l - 1]))

print('\n'.join(ans))


n,k,q = list(map(int,input().split()))
from itertools import accumulate
count = [0 for _ in range(200002)]

for _ in range(n):
    l,r = list(map(int,input().split()))
    count[l] += 1
    count[r+1] -= 1

ok = 0
count2 = [0 for _ in range(200002)]
for i,v in enumerate(count):
    ok += v
    if ok >= k:
        count2[i] = 1
    else:
        count2[i] = 0
prefixe = list(accumulate(count2))
res = []
for _ in range(q):
    l,r = list(map(int,input().split()))
    res.append(str(prefixe[r]-prefixe[l-1]))
print('\n'.join(res))
        
    


import sys
n, k, q = map(int, sys.stdin.readline().split())
check = [0]*200012
for i in range(n):
    l, r = map(int,sys.stdin.readline().split())
    check[l] += 1
    check[r+1] -= 1
for i in range(200001):
    check[i+1] += check[i]
    if check[i] >= k:
        check[i] = 1
    else:
        check[i] = 0

for i in range(200000):
    check[i+1] += check[i]


for i in range(q):
    count = 0
    a, b = map(int, sys.stdin.readline().split())
    sys.stdout.write(str(check[b] - check[a-1])+"\n")

#!/usr/bin/env python3
from sys import stdin, stdout

def rint():
    return map(int, stdin.readline().split())
#lines = stdin.readlines()


n, k, q = rint()
r = [0 for i in range(200001)]
l = [0 for i in range(200001)]

for i in range(n):
    ll, rr = rint()
    r[rr] += 1
    l[ll] += 1

f = [0 for i in range(200001)]
for i in range(1,200001):
    f[i] = f[i-1] + l[i] - r[i-1]

ss = [0 for i in range(200002)]
for i in range(200000, 0, -1):
    if f[i] >= k:
        ss[i] = ss[i+1] + 1
    else:
        ss[i] = ss[i+1]

for i in range(q):
    ll, rr = rint()
    print( ss[ll] - ss[rr+1])

#!/usr/bin/env python3
import sys
from itertools import accumulate

def main():
    n, k, q = list(map(int, sys.stdin.readline().split()))
    ary = [0] * 2000001
    num_valid = [0] * 2000001
    max_temp = -1
    for __ in range(n):
        s, t = list(map(int, sys.stdin.readline().split()))
        ary[s-1] += 1
        ary[t] -= 1

    tot = 0
    for indx in range(len(num_valid)-1):
        tot += ary[indx]
        num_valid[indx + 1] = num_valid[indx] + (tot >= k)

    for __ in range(q):
        s, t = list(map(int, sys.stdin.readline().split()))
        print(num_valid[t]- num_valid[s -1])




def __starting_point():
    main()

__starting_point()

def main():
    n, k, q = list(map(int, input().split()))
    l, res = [0] * 200002, []
    for _ in range(n):
        a, b = list(map(int, input().split()))
        l[a] += 1
        l[b + 1] -= 1
    a = 0
    for i, b in enumerate(l):
        a += b
        l[i] = a >= k
    a = 0
    for i, b in enumerate(l):
        if b:
            a += 1
        l[i] = a
    for _ in range(q):
        a, b = list(map(int, input().split()))
        res.append(l[b] - l[a - 1])
    print('\n'.join(map(str, res)))


def __starting_point():
    main()

__starting_point()

# IAWT
n, k, q = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(n)]
qs = [list(map(int, input().split())) for i in range(q)]

def answer(q):
    a, b = q
    if a == 1:
        print(l3[b-1])
    else:
        print(l3[b-1]-l3[a-2])

l2 = [0] * 200000
l3 = [0] * 200000
adds = [0] * 200000
mins = [0] * 200000
for r in l:
    adds[r[0]-1] += 1
    mins[r[1]-1] += 1
l2[0] = adds[0] - mins[0]
if adds[0] >= k: l3[0] = 1
for i in range(1, 200000):
    l2[i] = l2[i-1] + adds[i]
    if l2[i] >= k:
        l3[i] = 1
    l2[i] -= mins[i]

for i in range(1, 200000):
    l3[i] = l3[i-1] + l3[i]

for q in qs:
    answer(q)


import math
from sys import stdin, stdout
input = stdin.readline


class N:
    def __init__(self, il, ir, val, l, r):
        self.il = il
        self.ir = ir
        self.val = val
        self.l = l
        self.r = r

    def __str__(self):
        return ' il = ' + str(self.il) + ' ir = ' + str(self.ir) + ' val = ' + str(self.val)

    def get_amount(self,left,right,func):
        if self.il==left and self.ir==right:
            return self.val
        elif self.l.il<=left and self.l.ir>=right:
            return self.l.get_amount(left,right,func)
        elif self.r.il<=left and self.r.ir>=right:
            return self.r.get_amount(left,right,func)
        else:
            return func(self.l.get_amount(left,self.l.ir,func),self.r.get_amount(self.r.il,right,func))


class ST:
    def __init__(self, arr, threshold):
        t1 = []
        t2 = []
        for i, val in enumerate(arr):
            t1.append(N(i, i, int(val >= threshold), None, None))
        while len(t1) + len(t2) > 1:
            while len(t1) >= 2:
                a = t1.pop()
                b = t1.pop()
                t2.append(self.__get_next(a, b))
            if len(t1) > 0:
                t2.append(t1.pop())
            t1, t2 = t2, t1
        self.r = t1[0]

    def __get_next(self, a, b):
        if a.il > b.il:
            a, b = b, a
        n = N(a.il, b.ir, self.__func(a.val, b.val), a, b)
        return n

    def __func(self, a, b):
        return a + b

    def request(self, l, r):
        root = self.r
        answ = 0
        if l == r:
            while not (root.il == l and root.ir == r):
                if l >= root.l.il and r <= root.l.ir:
                    root = root.l
                else:
                    root = root.r
            answ = self.__func(answ, root.val)
            return answ

        if root.il == l and root.ir == r:
            return root.val
        f = True
        while f:
            if root.l.il <= l and root.l.ir >= r:
                root = root.l
            elif root.r.il <= l and root.r.ir >= r:
                root = root.r
            else:
                f = False
        left = root.l
        right = root.r
        while not left.il == l:
            if l < left.r.il:
                answ = self.__func(answ, left.r.val)
                left = left.l
            else:
                left = left.r
        answ = self.__func(answ, left.val)

        while not right.ir == r:
            if r > right.l.ir:
                answ = self.__func(answ, right.l.val)
                right = right.r
            else:
                right = right.l
        answ = self.__func(answ, right.val)
        return answ

    def req(self,l,r):
        return self.r.get_amount(l,r,self.__func)



'''
class ST:

    def __init__(self, arr, min_r):
        self.len = (math.ceil(math.log(len(arr), 2))) ** 2
        self.t = [0] * (4 * len(arr))
        for i in range(0, len(arr)):
            self.t[self.len + i] = int(arr[i] >= min_r)

        for i in range(self.len - 1, 0, -1):
            self.t[i] = self.__func(self.t[i * 2], self.t[i * 2 + 1])

    def __func(self, l, r):
        return l + r

    def request(self, left, right):
        l = self.len + left
        r = self.len + right
        ans = 0
        while l <= r:
            if l % 2 == 1:
                ans = self.__func(ans, self.t[l])
            if r % 2 == 0:
                ans = self.__func(ans, self.t[r])
            l = int((l + 1) / 2)
            r = int((r - 1) / 2)
        return ans'''

gradus = [0 for i in range(200002)]
recipes, min_r, questions = list(map(int, input().split()))
adds = []

for i in range(recipes):
    l, r = list(map(int, input().split()))
    if l == r:
        adds.append(l)
    else:
        gradus[l] -= 1
        gradus[r+1] += 1
counter = 0

for i in range(0, len(gradus)):
    if gradus[i] < 0:
        counter += abs(gradus[i])
    elif gradus[i] > 0:
        counter -= gradus[i]
    gradus[i] = counter
for i in adds:
    gradus[i] += 1

tree = ST(gradus, min_r)
res = []

for i in range(questions):
    l, r = list(map(int, input().split()))
    res.append(str(tree.request(l, r)))


print('\n'.join(res))


import sys

def main():
    n,k,q=list(map(int,sys.stdin.readline().split()))
    maxtemp=200001
    deltatemp_plus=[0]*maxtemp
    deltatemp_minus=[0]*maxtemp
    for i in range(n):
        li,ri=list(map(int,sys.stdin.readline().split()))
        deltatemp_plus[li]+=1
        deltatemp_minus[ri]+=1
    
    temp=[0]*maxtemp
    cumsum=0
    for i in range(maxtemp):
        cumsum+=deltatemp_plus[i]
        temp[i]=cumsum
        cumsum-=deltatemp_minus[i]
    
    goodtemp=[0]*maxtemp
    goodtemp[0]=1 if temp[0]>=k else 0
    for i in range(1,maxtemp):
        adder=1 if temp[i]>=k else 0
        goodtemp[i]=goodtemp[i-1]+adder
        
    for iq in range(q):
        ai,bi=list(map(int,sys.stdin.readline().split()))
        if ai==0: result=goodtemp[bi]
        else: result=goodtemp[bi]-goodtemp[ai-1]
        sys.stdout.write(str(result)+'\n')
    
main()



n, k, q = map(int, input().split())
c = [0] * 200003

for i in range(n):
    a, b = map(int, input().split())
    c[a] += 1
    c[b + 1] -= 1
    
for i in range(1, len(c)):
    c[i] += c[i-1]

c[0] = 1 if c[0] >= k else 0
for i in range(1, len(c)):
    c[i] = 1 if c[i] >= k else 0
    c[i] += c[i-1]

ans = ''
for i in range(q):
    a, b = map(int, input().split())
    ans += str(c[b]-c[a-1]) + '\n'

print(ans, end='')


n, k, q = map(int, input().split())
c = [0] * 200003

for i in range(n):
    a, b = map(int, input().split())
    c[a] += 1
    c[b + 1] -= 1
    
for i in range(1, len(c)):
    c[i] += c[i-1]

c[0] = 1 if c[0] >= k else 0
for i in range(1, len(c)):
    c[i] = 1 if c[i] >= k else 0
    c[i] += c[i-1]

ans = ''
for i in range(q):
    a, b = map(int, input().split())
    ans += str(c[b]-c[a-1]) + '\n'

print(ans, end='')


n,m,k1=map(int,input().split())
l1=[0]*200003
for i in range(n) :
    a,b=map(int,input().split())
    l1[a]+=1
    l1[b+1]-=1
for i in range(1,200003) :
    l1[i]=l1[i-1]+l1[i]
l1[0]=0
for i in range(1,len(l1)) :
    if l1[i]>=m :
        l1[i]=l1[i-1]+1
    else :
        l1[i]=l1[i-1]
V=''
for i in range(k1) :
    a,b=map(int,input().split())
    V+=str(l1[b]-l1[a-1])+'\n'
print(V, end='')

    



n, k, q = map(int, input().split())

x = [0] * 200005

for _ in range(n):
    l, r = map(int, input().split())

    x[l] += 1
    x[r+1] -= 1

for i in range(1,200005):
    x[i] += x[i-1]
    x[i-1] = [0,1][x[i-1]>=k]

for i in range(1,200005):
    x[i] += x[i-1]

res = ''

for _ in range(q):
    l, r = map(int, input().split())

    res += str(x[r]-x[l-1]) + "\n"

print(res, end='')


import sys
input=sys.stdin.readline
print=sys.stdout.write
n,k,q=map(int,input().split())
ar=[0]*(200000+2)
def f(l,r):
    ar[l]+=1
    ar[r+1]-=1
for x in range(n):
    a,b=map(int,input().split())
    f(a,b)
for x in range(1,200000+1):
    ar[x]+=ar[x-1]
for x in range(1,200000+1):
    ar[x]=ar[x] >= k
for x in range(1,200000+1):
    ar[x]+=ar[x-1]
for el in range(q):
    a,b=map(int,input().split())
    print(str((ar[b]-ar[a-1]))+"\n")