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 < (1LL<<k)) continue;
        if((1LL<<k)* 2 - 1LL < L) continue;
        ll mimi = max(1LL<<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 {
                                    (dp[i + 1][1][b][c] += dp[i][a][b][c]) %= mod;
                                    (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 {
                                    (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:64:23: error: 'mini' was not declared in this scope; did you mean 'mimi'?
   64 |         ll maxi = min(mini * 2 - 1LL, R);
      |                       ^~~~
      |                       mimi