Language: C++

#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
using namespace std;

typedef long long ll;
typedef unsigned long long ul;
typedef unsigned int ui;
typedef long double ld;
const ll mod = 1000000007;
const ll INF = mod * mod;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef complex<ld> Point;
const ld eps = 1e-8;
const ld pi = acos(-1.0);
typedef pair<int, int> P;
typedef pair<ld, ld> LDP;
typedef pair<ll, ll> LP;
typedef vector<int> vec;
typedef vector<string> svec;
#define fr first
#define sc second
#define all(c) c.begin(),c.end()
#define pb push_back
#define int long long


ll mod_pow(ll x, ll n, ll m) {
    if(n == 0) return 1;
    ll res = mod_pow(x * x % m, n / 2, m);
    if(n & 1) res = res * x % m;
    return res;
}

void solve() {
    ll L, R; cin >> L >> R;
    ll ans = 0;
    rep(k, 62) {
        if(R < (1<<k)) continue;
        if((1<<k)* 2 - 1LL < L) continue;
        ll mimi = max(1<<k, L);
        ll maxi = min(mini * 2 - 1LL, R);
        ll dp[100][3][2][2];
        memset(dp, 0, sizeof(dp));
        dp[0][0][0][0] = 1LL;
        for(int i = 0; i < k; i++) {
            int p = (L & (1<<(k - i - 1)) ? 1 : 0);
            int q = (R & (1<<(k - i - 1)) ? 1 : 0);
            rep(a, 3) {
                rep(b, 2) {
                    rep(c, 2) {
                        
                            if(b == 1 && c == 1) {
                                rep(d, 3) (dp[i + 1][d][b][c] += dp[i][a][b][c]) %= mod;
                            } else if(b == 1 && c == 0) {
                                if(q == 1) {
                                    rep(d, 3) (dp[i + 1][d][b][c] += dp[i][a][b][c]) %= mod;
                                } else {
                                    if(c == 0)(dp[i + 1][1][b][c] += dp[i][a][b][c]) %= mod;
                                    if(c == 0)(dp[i + 1][2][b][c] += dp[i][a][b][c]) %= mod;
                                }
                            } else if(b == 0 && c == 1) {
                                if(p == 1) {
                                    rep(d, 3) (dp[i + 1][d][b][c] += dp[i][a][b][c]) %= mod;
                                } else {
                                    if(b == 0)(dp[i + 1][2][b][c] += dp[i][a][b][c]) %= mod;
                                }
                            } else if(b == 0 && c == 0) {
                                if(p == 1 && q == 1) {
                                    rep(d, 3)(dp[i + 1][d][b][c] += dp[i][a][b][c]) %= mod;
                                } else if(p == 0 && q == 1) {
                                    if(b == 0)(dp[i + 1][2][b][c] += dp[i][a][b][c]) %= mod;
                                } else if(p == 1 && q == 0) {
                                    if(c == 0)(dp[i + 1][1][b][c] += dp[i][a][b][c]) %= mod;
                                    if(c == 0)(dp[i + 1][2][b][c] += dp[i][a][b][c]) %= mod;
                                } else {
                                    if(b == 0 && c == 0)(dp[i + 1][2][b][c] += dp[i][a][b][c]) %= mod;
                                }
                            
                        }
                    }
                }
            }
            rep(j, 3) {
                rep(a, 2) {
                    rep(b, 2) {
                        (ans += dp[k][j][a][b]) %= mod;
                    }
                }
            }
        }
    }
    cout << (ans + mod) % mod << endl;
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(10);
	//init();
	solve();
	//cout << "finish" << endl;
    return 0;
}

Compiler output:
a.cc: In function 'void solve()':
a.cc:63:22: error: no matching function for call to 'max(int, ll&)'
   63 |         ll mimi = max(1<<k, L);
      |                   ~~~^~~~~~~~~
In file included from /usr/include/c++/14/string:51,
                 from /usr/include/c++/14/bits/locale_classes.h:40,
                 from /usr/include/c++/14/bits/ios_base.h:41,
                 from /usr/include/c++/14/ios:44,
                 from /usr/include/c++/14/ostream:40,
                 from /usr/include/c++/14/iostream:41,
                 from a.cc:1:
/usr/include/c++/14/bits/stl_algobase.h:257:5: note: candidate: 'template<class _Tp> constexpr const _Tp& std::max(const _Tp&, const _Tp&)'
  257 |     max(const _Tp& __a, const _Tp& __b)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:257:5: note:   template argument deduction/substitution failed:
a.cc:63:22: note:   deduced conflicting types for parameter 'const _Tp' ('int' and 'll' {aka 'long long int'})
   63 |         ll mimi = max(1<<k, L);
      |                   ~~~^~~~~~~~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note: candidate: 'template<class _Tp, class _Compare> constexpr const _Tp& std::max(const _Tp&, const _Tp&, _Compare)'
  303 |     max(const _Tp& __a, const _Tp& __b, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algobase.h:303:5: note:   candidate expects 3 arguments, 2 provided
In file included from /usr/include/c++/14/algorithm:61,
                 from a.cc:7:
/usr/include/c++/14/bits/stl_algo.h:5706:5: note: candidate: 'template<class _Tp> constexpr _Tp std::max(initializer_list<_Tp>)'
 5706 |     max(initializer_list<_Tp> __l)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5706:5: note:   candidate expects 1 argument, 2 provided
/usr/include/c++/14/bits/stl_algo.h:5716:5: note: candidate: 'template<class _Tp, class _Compare> constexpr _Tp std::max(initializer_list<_Tp>, _Compare)'
 5716 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
/usr/include/c++/14/bits/stl_algo.h:5716:5: note:   template argument deduction/substitution failed:
a.cc:63:22: note:   mismatched types 'std::initializer_list<_Tp>' and 'int'
   63 |         ll mimi = max(1<<k, L);
      |                   ~~~^~~~~~~~~
a.cc:64:23: error: 'mini' was not declared in this scope; did you mean 'mimi'?
   64 |         ll maxi = min(mini * 2 - 1LL, R);
      |                       ^~~~
      |                       mimi