#include using namespace std; #define rep(i,n) for (long long i=0;i<(long long)(n);i++) #define all(v) v.begin(),v.end() using ll=long long; using pll=pair; using tll=tuple; const ll INF=(1ll<<60); template void chmin(T &a,T b){ if(a>b){ a=b; } } template void chmax(T &a,T b){ if(a> m >> d >> k; vector month(14,31); month[2]=28; month[4]=30; month[6]=28; month[9]=28; month[11]=28; set st; for(ll i=d;i<=d+7-1;i++){ ll nowm=m,nowd=i; if(month[m]