#include #include #include #include #include #include using ll = long long int; using P = std::pair; using E = std::pair; const int INF = (1<<30); const ll INFLL = (1ll<<60); const ll MOD = 998244353ll; #define l_ength size void mul_mod(ll& a, ll b){ a *= b; a %= MOD; } void add_mod(ll& a, ll b){ a = (a v,ans; int main(void){ int t,r,m=0,i,n,s,j,p; std::cin >> t >> r; for(i=0; i> n; for(j=0; j> s; ++m; v.push_back(P(s,m)); } std::sort(v.begin(),v.end()); p = 1; for(i=0; i