birthday party _ codechef
DESCRIPTION
CODECHEFTRANSCRIPT
Problem code: CHEFBDAY SUBMITMY SUBMISSIONSALL SUBMISSIONS
Chef has invited his friends on his birthday party. There are total N friends that are coming at his home.You are given the arriving and leaving time of each friend and Q queries. Each Query consists of aninteger t, you have to output the number of friends that are present at time t at Chef's home.
Input
The first line contains T, the number of testcases.
The first line of each testcase contain two space separated integers N and Q, then follow N linescontaining two space separated integers ai bi, the arriving and leaving time of ith friend respectively.
Next Q lines contains a single integer t asking the number of friends at Chef's house present at time t.
Output
For each query, output the required answer in a new line.
Constraints1 ≤ T ≤ 101 ≤ N ≤ 1000001 ≤ Q ≤ 1000001 ≤ ai ≤ bi ≤ 1000001 ≤ t ≤ max of all bi
ExampleInput:13 31 22 22 3123
Output:13
BIRTHDAY PARTY
Be the first of your friends to like this.Like Share