#include #include using namespace atcoder; //#include // using namespace boost::multiprecision; #include using namespace std; // std:: を省略 using ll = long long; using ld = long double; using i128 = __int128_t; using ull = unsigned long long; using P = pair; #define rep(i, n) for (ll i = 0; i < ll(n); ++i) #define REP(i, x, n) for (ll i = x; i < ll(n); ++i) #define DREP(i, r, l) for (ll i = (ll)(r)-1; i >= (ll)(l); --i) #define drep(i, n) DREP(i, n, 0) #define all(x) begin(x), end(x) #define rall(x) rbegin(x), rend(x) #define MAX *max_element #define MIN *min_element #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define eb emplace_back #define fi first #define se second #define p_queue priority_queue #define pcnt __builtin_popcountll mt19937_64 rng(20250627); template struct is_iterable : false_type {}; template struct is_iterable())), decltype(std::end(std::declval()))>> : true_type {}; template constexpr bool is_iterable_v = is_iterable::value; // 前方宣言 (debug_pr が debug_tuple の中で使われ、debug_tuple が debug_pr の中で使われる可能性があるため) template std::enable_if_t && !std::is_pointer_v && !std::is_same_v, void> debug_pr( const T& x); void debug_pr(const string& s); void debug_pr(const char* s); template void debug_pr(const pair& p); template void debug_pr(const tuple& t); // debug_tupleより先に宣言が必要 template std::enable_if_t && !std::is_same_v, void> debug_pr(const T& v); void debug_pr(std::nullptr_t); template std::enable_if_t, void> debug_pr(const T& p); // template // std::enable_if_t debug_tuple(const tuple&) {} // template // std::enable_if_t debug_tuple(const tuple& t){ // if(I) cerr << ", "; // 最初の要素でなければコンマを出力 // debug_pr(std::get(t)); // 現在の要素を出力 // debug_tuple(t); // 次の要素を処理 // } // SFINAE を使った enable_if_t の引数の修正 template typename std::enable_if_t debug_tuple(const tuple&) { // ベースケース: タプルの全ての要素を表示し終わったら何もしない } template typename std::enable_if_t < I // 戻り値の型として enable_if_t を使用 debug_tuple(const tuple& t) { if (I > 0) { // Iが0より大きい場合(つまり2番目以降の要素の場合)にコンマを出力 cerr << ", "; } debug_pr(std::get(t)); // 現在の要素をデバッグ出力 debug_tuple(t); // 次の要素を再帰的にデバッグ出力 } // debug_pr の定義 (ユーザー提供のものをベースに) template std::enable_if_t && !std::is_pointer_v && !std::is_same_v, void> debug_pr( const T& x) { cerr << x; } inline void debug_pr(const string& s) { cerr << '"' << s << '"'; } inline void debug_pr(const char* s) { cerr << '"' << s << '"'; } // const char* を追加 template void debug_pr(const pair& p) { cerr << '('; debug_pr(p.first); cerr << ", "; debug_pr(p.second); cerr << ')'; } // tuple 用の debug_pr は debug_tuple を呼び出す template void debug_pr(const tuple& t) { cerr << '('; debug_tuple<0>(t); // 常にインデックス0から開始 cerr << ')'; } template std::enable_if_t && !std::is_same_v, void> debug_pr(const T& v) { cerr << '['; bool f = false; // 最初はfalse for (const auto& x : v) { if (f) { cerr << ", "; // 2番目以降の要素の前にコンマとスペース } debug_pr(x); f = true; } cerr << ']'; } inline void debug_pr(std::nullptr_t) { cerr << "nullptr"; } template std::enable_if_t, void> debug_pr(const T& p) { if (p == nullptr) { cerr << "nullptr"; } else { cerr << '*'; // ポインタであることを示す debug_pr(*p); // ポインタの指す先の値を表示 } } void debug_out() { } // ベースケース template void debug_out(const Head& h, const Tail&... tl) { debug_pr(h); if constexpr (sizeof...(tl) > 0) { // パラメータパックが空でなければ cerr << ", "; debug_out(tl...); } } #ifdef LOCAL #define dbg(...) \ cerr << "\e[33m[ " << #__VA_ARGS__ << " ] = ", debug_out(__VA_ARGS__), cerr << " (" << __LINE__ << ")\e[0m" << endl #else #define dbg(...) (void)0 #endif template ostream& operator<<(ostream& os, const pair& p) { // pairの出力 os << "(" << p.first << ", " << p.second << ")"; return os; } inline void println(const long double& x) { cout << fixed << setprecision(30) << x << '\n'; } template inline bool chmax(T& a, T b) { return a < b ? a = b, 1 : 0; } template inline bool chmin(T& a, T b) { return a > b ? a = b, 1 : 0; } template inline void input(T&... a) { ((cin >> a), ...); } // 可変長引数入力 template inline void input(vector& v) { for (T& x : v) cin >> x; } // vector入力 template inline void print(const T& a, const U&... b) { cout << a; ((cout << ' ' << b), ...); } // 可変長引数出力 (スペース区切り) template inline void println(const T& a, const U&... b) { print(a, b...); cout << '\n'; } // 可変長引数出力 (スペース区切り + 改行) inline void println() { cout << '\n'; } // 改行のみ template inline void print(vector& A) { rep(i, A.size()) { if (i) cout << ' '; cout << A[i]; } } // vector出力 template inline void println(vector& A) { print(A); cout << '\n'; } // vector出力 + 改行 inline void yn(bool ok) { cout << (ok ? "Yes\n" : "No\n"); } // Yes/No出力 const ll INF = 4e18; const ll mod = 1e9 + 7; // using mint = modint998244353; const ll dx[] = {-1, 1, 0, 0, 1, 1, -1, -1}; const ll dy[] = {0, 0, -1, 1, 1, -1, 1, -1}; // 2^nの数え上げはDPで解けるかも? // 全探索の高速化といえばDP // DPは配る遷移ともらう遷移の両方を考察する // 問題の振り返り書け // めんどくさい計算とかは関数にしたら楽 // 誤差などが怖いときは移項などをして整数で考えるようにする // 式変形をしたら見通しが良くなる // 問題を分解する // すべての問題を解けると思って考える // ゲームをしているならDPを考える // DPは初期値も大事 // 問題文をちゃんと読んで誤読をしない!! // alias xx='g++ -D_GLIBCXX_DEBUG -fsanitize=undefined,address -fno-sanitize-recover=all -Wall -Wextra -Wshadow' void solve() { ll l, r; input(l, r); ll ans = 0; REP(i, l + 1, r + 1) { if (i - 1 == 295) ans++; if (i - 1 == 416) ans++; if (i - 1 == 420) ans++; } println(ans); return; } // Answerは出力するべき形式に合わせる using Answer = string; // Inputは基本stringで大丈夫 using Input = string; Answer solve_wrapped(const Input& in) { // solve関数を使用して、それから出力されたものをいい感じに受け取る istringstream iss(in); ostringstream oss; auto* cin_old = cin.rdbuf(iss.rdbuf()); auto* cout_old = cout.rdbuf(oss.rdbuf()); // 既存 solve 呼び出し solve(); cin.rdbuf(cin_old); cout.rdbuf(cout_old); return oss.str(); } Answer solve_naive(const Input& in) { // 愚直解を書く関数 // 入力を受け取るときは iss >> と書く // 出力するときは oss << と書く istringstream iss(in); ostringstream oss; return oss.str(); } Input gen_case() { stringstream ss; // 出力するときは ss << を使う // l~rの間でランダムな数を生成する(l,rを含む) auto randint = [](auto l, auto r) { return uniform_int_distribution>(l, r)(rng); }; ll w = randint(3, 10); ll h = randint(3, 10); ll n = randint(3, 5); ss << w << " " << h << " " << n << endl; rep(i, n) { ss << randint(1, w) << " " << randint(1, h) << endl; } return ss.str(); } // ランダムテストを実行する関数 void stress() { for (long long tc = 1;; ++tc) { Input in = gen_case(); Answer out1 = solve_wrapped(in); Answer out2 = solve_naive(in); if (out1 != out2) { cerr << "WA on tc #" << tc << "\n"; cerr << "input:\n" << in; cerr << "mine:\n" << out1; cerr << "naive:\n" << out2; // 愚直解の答えとsolve関数の答えが違うなら終了する break; } if (tc % 1000 == 0) cerr << tc << " cases ✓ なのだ\n"; } } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); solve(); // stress(); return 0; }