Language: C++

#include <bits/stdc++.h>
using ll = long long;

constexpr ll mod = 1000000007; // 面倒なのでここで
inline constexpr ll extgcd(ll a, ll b, ll &x, ll &y){ ll g = a; x = 1; y = 0; if(b){ g = extgcd(b, a % b, y, x); y -= a / b * x; } return g; }
inline constexpr ll invmod(ll a, ll m = mod){ ll x = 0, y = 0; extgcd(a, m, x, y); return (x + m) % m; }
struct Modint{
    ll _num;
    constexpr Modint() : _num() { _num = 0; }
    constexpr Modint(ll x) : _num() { _num = x % mod; if(_num < 0) _num += mod; }
    inline constexpr Modint& operator= (const int &x){ _num = x % mod; if(_num<0) _num += mod; return *this; }
    inline constexpr Modint& operator= (const ll &x){ _num = x % mod; if(_num<0) _num += mod; return *this; }
    inline constexpr Modint& operator= (const Modint &x){ _num = x._num; return *this; }
    inline constexpr const Modint operator+ (const int &x) const { return Modint(_num + x); }
    inline constexpr const Modint operator+ (const ll &x) const { return Modint(_num + x); }
    inline constexpr const Modint operator+ (const Modint &x) const { ll a = _num + x._num; if(a >= mod) a -= mod; return Modint{a}; }
    inline constexpr Modint& operator+=(const int &x){ _num += x; _num %= mod; if(_num < 0) _num += mod; return *this; }
    inline constexpr Modint& operator+=(const ll &x){ _num += x; _num %= mod; if(_num < 0) _num += mod; return *this; }
    inline constexpr Modint& operator+=(const Modint &x){ _num += x._num; if(_num >= mod) _num -= mod; return *this; }
    inline constexpr Modint& operator++(){ if(_num == mod - 1) _num = 0; else _num++; return *this; }
    inline constexpr const Modint operator++(int){ const Modint ans = *this; if(_num == mod - 1) _num = 0; else _num++; return ans; }
    inline constexpr const Modint operator- (const int &x) const { return Modint(_num - x); }
    inline constexpr const Modint operator- (const ll &x) const { return Modint(_num - x); }
    inline constexpr const Modint operator- (const Modint &x) const { ll a = _num - x._num; if(a < 0) a += mod; return Modint{a}; }
    inline constexpr Modint& operator-=(const int &x){ _num -= x; _num %= mod; if(_num < 0) _num += mod; return *this; }
    inline constexpr Modint& operator-=(const ll &x){ _num -= x; _num %= mod; if(_num < 0) _num += mod; return *this; }
    inline constexpr Modint& operator-=(const Modint &x){ _num -= x._num; if(_num < 0) _num += mod; return *this; }
    inline constexpr Modint& operator--(){ if(_num == 0) _num = mod - 1; else _num--; return *this; }
    inline constexpr const Modint operator--(int){ const Modint ans = *this; if(_num == 0) _num = mod - 1; else _num--; return ans; }
    inline constexpr const Modint operator* (const int &x) const { return Modint(_num * (x % mod)); }
    inline constexpr const Modint operator* (const ll &x) const { return Modint(_num * (x % mod)); }
    inline constexpr const Modint operator* (const Modint &x) const { return Modint{_num * x._num % mod}; }
    inline constexpr Modint& operator*=(const int &x){ _num *= Modint(x); _num %= mod; return *this; }
    inline constexpr Modint& operator*=(const ll &x){ _num *= Modint(x); _num %= mod; return *this; }
    inline constexpr Modint& operator*=(const Modint &x){ _num *= x._num; _num %= mod; return *this; }
    inline constexpr const Modint operator/ (const int &x) const { return Modint(_num * invmod(Modint(x), mod)); }
    inline constexpr const Modint operator/ (const ll &x) const { return Modint(_num * invmod(Modint(x), mod)); }
    inline constexpr const Modint operator/ (const Modint &x) const { return Modint{_num * invmod(x._num, mod) % mod}; }
    inline constexpr Modint& operator/=(const int &x){ _num *= invmod(Modint(x), mod); _num %= mod; return *this; }
    inline constexpr Modint& operator/=(const ll &x){ _num *= invmod(Modint(x), mod); _num %= mod; return *this; }
    inline constexpr Modint& operator/=(const Modint &x){ _num *= invmod(x._num, mod); _num %= mod; return *this; }
    inline constexpr const Modint pow(const ll &x) const { ll i = 1; Modint ans = 1, cnt = *this; while(i <= x){ if(x & i){ ans *= cnt; x ^= i; } cnt *= cnt; i *= 2; } return ans; }
    inline constexpr operator ll() const { return _num; }
};
vector<Modint> fac(1, 1), inv(1, 1);
inline void reserve(ll a){
    if(fac.size() >= a) return;
    if(a < fac.size() * 2) a = fac.size() * 2;
    if(a >= mod) a = mod;
    while(fac.size() < a) fac.push_back(fac.back() * ll(fac.size()));
    inv.resize(fac.size());
    inv.back() = Modint(1) / fac.back();
    for(ll i = inv.size() - 1; !inv[i - 1]; i--) inv[i - 1] = inv[i] * i;
}
inline Modint fact(ll n){ if(n < 0) return 0; reserve(n + 1); return fac[n]; }
inline Modint perm(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[n - r]; }
inline Modint comb(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[r] * inv[n - r]; }
inline Modint Mcomb(ll n, ll r){ return comb(n + r - 1, n - 1); } // r個をn部屋に分ける

//　exawizards2019_e
int main(){
    Modint ans = 1;
    ans /= 2;
    Modint cnt = ans;
    ll b, w;
    cin >> b >> w;
    for(int i = 0; i < b + w; i++){
        cout << ans << '\n';
        cnt /= 2;
        if(i >= w - 1) ans += comb(i, w - 1) * cnt;
        if(i >= b - 1) ans -= comb(i, b - 1) * cnt;
    }
}

Compiler output:
a.cc: In member function 'constexpr const Modint Modint::pow(const ll&) const':
a.cc:42:139: error: assignment of read-only reference 'x'
   42 |     inline constexpr const Modint pow(const ll &x) const { ll i = 1; Modint ans = 1, cnt = *this; while(i <= x){ if(x & i){ ans *= cnt; x ^= i; } cnt *= cnt; i *= 2; } return ans; }
      |                                                                                                                                         ~~^~~~
a.cc: At global scope:
a.cc:45:1: error: 'vector' does not name a type
   45 | vector<Modint> fac(1, 1), inv(1, 1);
      | ^~~~~~
a.cc: In function 'void reserve(ll)':
a.cc:47:8: error: 'fac' was not declared in this scope
   47 |     if(fac.size() >= a) return;
      |        ^~~
a.cc:48:12: error: 'fac' was not declared in this scope
   48 |     if(a < fac.size() * 2) a = fac.size() * 2;
      |            ^~~
a.cc:50:11: error: 'fac' was not declared in this scope
   50 |     while(fac.size() < a) fac.push_back(fac.back() * ll(fac.size()));
      |           ^~~
a.cc:51:5: error: 'inv' was not declared in this scope; did you mean 'int'?
   51 |     inv.resize(fac.size());
      |     ^~~
      |     int
a.cc:51:16: error: 'fac' was not declared in this scope
   51 |     inv.resize(fac.size());
      |                ^~~
a.cc: In function 'Modint fact(ll)':
a.cc:55:70: error: 'fac' was not declared in this scope; did you mean 'fact'?
   55 | inline Modint fact(ll n){ if(n < 0) return 0; reserve(n + 1); return fac[n]; }
      |                                                                      ^~~
      |                                                                      fact
a.cc: In function 'Modint perm(ll, ll)':
a.cc:56:85: error: 'fac' was not declared in this scope; did you mean 'fact'?
   56 | inline Modint perm(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[n - r]; }
      |                                                                                     ^~~
      |                                                                                     fact
a.cc:56:94: error: 'inv' was not declared in this scope; did you mean 'int'?
   56 | inline Modint perm(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[n - r]; }
      |                                                                                              ^~~
      |                                                                                              int
a.cc: In function 'Modint comb(ll, ll)':
a.cc:57:85: error: 'fac' was not declared in this scope; did you mean 'fact'?
   57 | inline Modint comb(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[r] * inv[n - r]; }
      |                                                                                     ^~~
      |                                                                                     fact
a.cc:57:94: error: 'inv' was not declared in this scope; did you mean 'int'?
   57 | inline Modint comb(ll n, ll r){ if(r < 0 || n < r) return 0; reserve(n + 1); return fac[n] * inv[r] * inv[n - r]; }
      |                                                                                              ^~~
      |                                                                                              int
a.cc: In function 'int main()':
a.cc:66:5: error: 'cin' was not declared in this scope; did you mean 'std::cin'?
   66 |     cin >> b >> w;
      |     ^~~
      |     std::cin
In file included from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:146,
                 from a.cc:1:
/usr/include/c++/14/iostream:62:18: note: 'std::cin' declared here
   62 |   extern istream cin;           ///< Linked to standard input
      |                  ^~~
a.cc:68:9: error: 'cout' was not declared in this scope; did you mean 'std::cout'?
   68 |         cout << ans << '\n';
      |         ^~~~
      |         std::cout
/usr/include/c++/14/iostream:63:18: note: 'std::cout' declared here
   63 |   extern ostream cout;          ///< Linked to standard output
      |                  ^~~~