#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long ll; typedef pair P; long long int INF = 3e18; double Pi = 3.1415926535897932384626; vector G[500005]; vector

tree[500010]; priority_queue pql; priority_queue

pqp; //big priority queue priority_queue ,greater > pqls; priority_queue ,greater

> pqps1,pqps2; //small priority queue //top pop int dx[8]={1,0,-1,0,1,1,-1,-1}; int dy[8]={0,1,0,-1,1,-1,-1,1}; char dir[] = "DRUL"; //ll bit[500005]; //↓,→,↑,← #define p(x) cout<> n >> k; for(i=0;i> a >> b; b = min(b,a+k); for(j=a;j<=b;j++){ x[num] = j; num ++; } //p(num); } //p(num); sort(x,x+num); for(i=0;i