Language: C++

#include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
constexpr int inf = numeric_limits<int>::max()/2;
constexpr long long linf = numeric_limits<long long>::max()/3;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct double{ double d; explicit double(double x) : d(x){} };
ostream& operator<<(ostream& os,const double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename t> ostream& operator<<(ostream& os,const vector<t>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename t,typename u> ostream& operator<<(ostream& os, const map<t,u>& mp){ os << "{"; for(auto& p : mp){ os << p << ","; } os << "}"; return os; }
template<typename t,typename u> ostream& operator<<(ostream& os,const pair<t,u>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
template<typename t> ostream& operator<<(ostream& os,const set<t>& st){ os<<"{"; for(t v:st) os<<v<<","; os <<"}"; return os; }
template<typename t,typename u> inline void chmax(t &x,u y){ if(y>x) x = y; }
template<typename t,typename u> inline void chmin(t &x,u y){ if(y<x) x = y; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
//constexpr double eps = 1e-14; 
constexpr double eps = 1e-10; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

string l;

ll mod_pow(ll x,ll n,ll mod){
    ll res=1;
    x %= mod;
    while(n){
        if(n&1) res = (res*x)%mod;
        x = (x*x)%mod;
        n>>=1;
    }
    return res;
}

ll memo[100005][2][100];

ll rec(int k,bool flag,ll num){
    if(memo[k][flag][num] >= 0){
        return memo[k][flag][num];
    }

    if(k == l.size()){
        return memo[k][flag][num] = mod_pow(2,num,mod);
    }


    if(flag){   // 未満確定
        // (0,0) (0,1) (1,0)
        ll res = rec(k+1,true,num+1);
        //ll res = rec(k+1,true,(num*2)%mod);
        res += rec(k+1,true,num);
        res %= mod;
        return memo[k][flag][num] = res;
    }else{      // 未満未確定
        if(l[k] == '0'){
            // (0,0)
            ll res = rec(k+1,false,num);
            return memo[k][flag][num] = res;
        }else if(l[k] == '1'){
            // (0,0)
            // (0,1) (1,0)
            ll res = rec(k+1,true,num);
            res += rec(k+1,false,num+1);
            res %= mod;
            return memo[k][flag][num] = res;
        }
    }
    return 0;
}

int main(){
    cin >> l;

    rep(i,100005) rep(j,2) rep(k,100) memo[i][j][k] = -1;

    cout << rec(0,false,0) << endl;
}


Compiler output:
a.cc:17:8: error: expected identifier before 'double'
   17 | struct double{ double d; explicit double(double x) : d(x){} };
      |        ^~~~~~
a.cc:17:14: error: expected unqualified-id before '{' token
   17 | struct double{ double d; explicit double(double x) : d(x){} };
      |              ^
a.cc: In function 'std::ostream& operator<<(std::ostream&, double)':
a.cc:18:87: error: request for member 'd' in 'x', which is of non-class type 'const double'
   18 | ostream& operator<<(ostream& os,const double x){ os << fixed << setprecision(20) << x.d; return os; }
      |                                                                                       ^