Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)
    
for i in range(Q):
    answer=0
    for j in range(m):
        if p[i]<=l[j]:
            if r[j]<=q[i]:
                answer+=1
    print(answer)


Fixed submission:
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

grid=[[0]*(n+1) for i in range(n+1)]

for i in range(m):
    grid[l[i]][r[i]]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        grid[i][j]+=grid[i-1][j]
        grid[i][j]+=grid[i][j-1]
        grid[i][j]-=grid[i-1][j-1]
    
for i in range(Q):
    print(grid[q[i]][q[i]]-grid[q[i]][p[i]-1]-grid[p[i]-1][q[i]]+grid[p[i]-1][p[i]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)
    
for i in range(Q):
    answer=0
    for j in range(m):
        if p[i]<=l[j] and r[j]<=q[i]:
            answer+=1
    print(answer)

Fixed submission:
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

grid=[[0]*(n+1) for i in range(n+1)]

for i in range(m):
    grid[l[i]][r[i]]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        grid[i][j]+=grid[i-1][j]
        grid[i][j]+=grid[i][j-1]
        grid[i][j]-=grid[i-1][j-1]
    
for i in range(Q):
    print(grid[q[i]][q[i]]-grid[q[i]][p[i]-1]-grid[p[i]-1][q[i]]+grid[p[i]-1][p[i]-1])

Buggy python submission (verdict: Runtime Error):
l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)
    
for i in range(Q):
    answer=0
    for j in range(m):
        if p[i]<=l[j] and r[j]<=q[i]:
            answer+=1
    print(answer)

Fixed submission:
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

grid=[[0]*(n+1) for i in range(n+1)]

for i in range(m):
    grid[l[i]][r[i]]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        grid[i][j]+=grid[i-1][j]
        grid[i][j]+=grid[i][j-1]
        grid[i][j]-=grid[i-1][j-1]
    
for i in range(Q):
    print(grid[q[i]][q[i]]-grid[q[i]][p[i]-1]-grid[p[i]-1][q[i]]+grid[p[i]-1][p[i]-1])

Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

def ans(l,r,p,q):
    if p<=l and r<=q:
        return 1
    else:
        return 0


for i in range(Q):
    answer=0
    for j in range(m):
        answer+=int(ans(l[j],r[j],p[i],q[i])) 
    print(answer)

Fixed submission:
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

grid=[[0]*(n+1) for i in range(n+1)]

for i in range(m):
    grid[l[i]][r[i]]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        grid[i][j]+=grid[i-1][j]
        grid[i][j]+=grid[i][j-1]
        grid[i][j]-=grid[i-1][j-1]
    
for i in range(Q):
    print(grid[q[i]][q[i]]-grid[q[i]][p[i]-1]-grid[p[i]-1][q[i]]+grid[p[i]-1][p[i]-1])

Buggy python submission (verdict: Runtime Error):
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

def ans(l,r,p,q):
    if p<=l and r<=q:
        return 1


for i in range(Q):
    answer=0
    for j in range(m):
        a=l[j]
        b=r[j]
        c=p[i]
        d=q[i]
        answer+=ans(a,b,c,d)  
    print(answer)

Fixed submission:
n,m,Q=map(int,input().split())

l=[]
r=[]
for i in range(m):
    a,b=map(int,input().split())
    l.append(a)
    r.append(b)

p=[]
q=[]    
for i in range(Q):
    c,d=map(int,input().split())
    p.append(c)
    q.append(d)

grid=[[0]*(n+1) for i in range(n+1)]

for i in range(m):
    grid[l[i]][r[i]]+=1

for i in range(1,n+1):
    for j in range(1,n+1):
        grid[i][j]+=grid[i-1][j]
        grid[i][j]+=grid[i][j-1]
        grid[i][j]-=grid[i-1][j-1]
    
for i in range(Q):
    print(grid[q[i]][q[i]]-grid[q[i]][p[i]-1]-grid[p[i]-1][q[i]]+grid[p[i]-1][p[i]-1])