#include #include using namespace std; using i64 = long long; class range {private: struct I{int x;int operator*(){return x;}bool operator!=(I& lhs){return x v(N); int nya = 0, nyo = 0; for(int i : range(N)) { int y = i + yy + 1; int dd = day_of_week(y, m, d); if(dd == x) { nya++; if(i < q) { nyo++; } } } i64 res = nya * p + nyo; printf("%lld\n", res); return 0; }