import collections
import heapq
import sys
import math
import itertools
import bisect
from io import BytesIO, IOBase
import os
def value(): return tuple(map(int, input().split()))
def values(): return tuple(map(int, sys.stdin.readline().split()))
def inlst(): return [int(i) for i in input().split()]
def inlsts(): return [int(i) for i in sys.stdin.readline().split()]
def inp(): return int(input())
def inps(): return int(sys.stdin.readline())
def instr(): return input()
def stlst(): return [i for i in input().split()]
def solve():
n, k, q = values()
l = [0]*(200003)
mn, mx = 200003, 0
for i in range(n):
a, b = values()
mn = min(mn, a)
mx = max(mx, b)
l[a] += 1
l[b+1] -= 1
arr = [0]*(200003)
for i in range(200001):
l[i+1] += l[i]
if l[i] >= k:
arr[i] = 1
for i in range(200001):
arr[i+1] += arr[i]
for _ in range(q):
a, b = values()
tot = arr[b]-arr[a-1]
sys.stdout.write(str(tot)+"\n")
solve()
#include <iostream>
#include <algorithm>
#define For(i,n,uu) for(int i=uu;i<n;++i)
using namespace std;
typedef long long ll;
typedef long double ld;
const int Max_N=200001;
int D[Max_N],sum[Max_N];
void reset(int s)
{
For(i,Max_N,0)
D[i]=s;
}
main ()
{
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int n,k,q; cin>>n>>k>>q;//tinh tu 1 -> 200000
reset(0);
For(i,n,0)
{
int a,b; cin>>a>>b;
D[a-1]++;
if (b<200000) D[b]--;
}
sum[0]=0;
int a0=0;
For(i,Max_N,1)
{
sum[i]=sum[i-1]+( a0 + D[i-1] >= k);
a0+=D[i-1];
}
//solve
For(i,q,0)
{
int a,b;
cin>>a>>b;
cout<<sum[b]-sum[a-1]<<endl;
}
return 0;
}
677A - Vanya and Fence | 1621A - Stable Arrangement of Rooks |
472A - Design Tutorial Learn from Math | 1368A - C+= |
450A - Jzzhu and Children | 546A - Soldier and Bananas |
32B - Borze | 1651B - Prove Him Wrong |
381A - Sereja and Dima | 41A - Translation |
1559A - Mocha and Math | 832A - Sasha and Sticks |
292B - Network Topology | 1339A - Filling Diamonds |
910A - The Way to Home | 617A - Elephant |
48A - Rock-paper-scissors | 294A - Shaass and Oskols |
1213A - Chips Moving | 490A - Team Olympiad |
233A - Perfect Permutation | 1360A - Minimal Square |
467A - George and Accommodation | 893C - Rumor |
227B - Effective Approach | 1534B - Histogram Ugliness |
1611B - Team Composition Programmers and Mathematicians | 110A - Nearly Lucky Number |
1220B - Multiplication Table | 1644A - Doors and Keys |