#Lutece1921. 好吃不过饺子

好吃不过饺子

Migrated from Lutece 1921 好吃不过饺子

All parts of this problem, including description, images, samples, data and checker, might be broken. If you find bugs in this problem, please contact the admins.

Description

饺子发现身边危机四伏!有nn个人站在一维平面上,每个人的坐标为AiA_i,能量值为BiB_i。饺子有cc种方法可以推测出有多少人想吃饺子,请你求出每种方法可以得出的想吃饺子的人数。

Input

第一行两个值 nn105),c(c10)n(n\le 10^5), c(c\le 10)
接下来nn行每行两个值$A_i,B_i(1\le A_i\le 10^9,1\le B_i\le 10^4,A_i\le A_j$ ifif i<j)i<j)
接下来cc行,每行包含三个数K,function,lengthK,function,length
其中
KK可能为gt或者lt,代表大于或者小于
functionfunction可能为minmax或者avg,代表最小,最大或者平均
lengthlength是一个整数(1length109)(1\le length\le 10^9)
K,function,lengthK,function,length的意思为对于第ii号人,如果BiB_i KK[Ailength,Ai)[A_i-length,A_i)范围内的所有人能量值的functionfunction值,说明该人想吃饺子,特别的如果范围内一个人也没有,则这个人不想吃饺子

Output

对于每种方法,输出想吃饺子的人数

Samples

10 2
60 30
120 28
180 35
240 34
300 40
360 31
420 28
480 2
540 42
600 30
gt avg 7200
lt min 300
4
2

Resources

2018 UESTC Training for Data Structures