Problem: How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions?    * 0 \leq A_i \leq 9   * There exists some i such that A_i=0 holds.   * There exists some i such that A_i=9 holds.  The answer can be very large, so output it modulo 10^9 + 7.

Submission attempts (in order):
#include <bits/stdc++.h>
using namespace std;

#define pb(a) push_back((a))


#define REP2(a, b) for (ll j = (a); j < (b); j++)
#define REPE(a, b, c, d) \
    REP(a, b)            \
    for (ll j = (c); j < (d); j++)
#define REPV(a, b, c) for (ll(a) = b; (a) < (c); (a)++)

#define IREP2(a, b) for (ll j = (a); j >= (b); j--)
#define IREPV(a, b, c) for (ll(a) = b; (a) >= (c); (a)--)
#define all(v) (v).begin(), (v).end()
#define trvs(c) for (auto &it : c)
#define INF 1e18


    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define F first
#define S second
#define MOD 1000000007

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define _DEBUG 1
#if _DEBUG





    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << 
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;





    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << 
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;


#else







#define wait ;








#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }



// auto cmp = [](pair<ll, pair<ll, ll>> a, pair<ll, pair<ll, ll>> b) {
//     if (a.F == b.F)
//         return a.S.F > b.S.F;
//     return a.F > b.F;
// };
//decltype(cmp)
// set.count(x)==0 not present
// accumulate (all(a),sum) or accumulate(all(a),sum,myfunc)
//partial_sum(all(a),b)   a and b are vectors puts prefix array of a in b
// partial_sum(all(a),b,myfunc)
//g++ -std=c++17 .\ans.cpp | ./a.exe
bool cmp(ll a, ll b)
{
    if (abs(a) == abs(b))
    {
        return a > b;
    }
    return abs(a) > abs(b);
}

long long binpow(long long a, long long b, long long m = MOD)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    ll n;
    cin >> n;
    ll ans = (binpow(10, n) % MOD - 2 * binpow(9, n) % MOD + binpow(8, n) MOD + MOD) % MOD;
    cout << ans << endl;
}

int main()
{
    flash


    ll t;
    // cin >> t;
    // while (t--)
    solve();
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define pb(a) push_back((a))


#define REP2(a, b) for (ll j = (a); j < (b); j++)
#define REPE(a, b, c, d) \
    REP(a, b)            \
    for (ll j = (c); j < (d); j++)
#define REPV(a, b, c) for (ll(a) = b; (a) < (c); (a)++)

#define IREP2(a, b) for (ll j = (a); j >= (b); j--)
#define IREPV(a, b, c) for (ll(a) = b; (a) >= (c); (a)--)
#define all(v) (v).begin(), (v).end()
#define trvs(c) for (auto &it : c)
#define INF 1e18


    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define F first
#define S second
#define MOD 1000000007

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define _DEBUG 1
#if _DEBUG





    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << 
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;





    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << 
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;


#else







#define wait ;








#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }



// auto cmp = [](pair<ll, pair<ll, ll>> a, pair<ll, pair<ll, ll>> b) {
//     if (a.F == b.F)
//         return a.S.F > b.S.F;
//     return a.F > b.F;
// };
//decltype(cmp)
// set.count(x)==0 not present
// accumulate (all(a),sum) or accumulate(all(a),sum,myfunc)
//partial_sum(all(a),b)   a and b are vectors puts prefix array of a in b
// partial_sum(all(a),b,myfunc)
//g++ -std=c++17 .\ans.cpp | ./a.exe
bool cmp(ll a, ll b)
{
    if (abs(a) == abs(b))
    {
        return a > b;
    }
    return abs(a) > abs(b);
}

long long binpow(long long a, long long b, long long m = MOD)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    ll n;
    cin >> n;
    ll ans = (binpow(10, n) % MOD - 2 * binpow(9, n) % MOD + binpow(8, n)% MOD + MOD) % MOD;
    cout << ans << endl;
}

int main()
{
    flash


    ll t;
    // cin >> t;
    // while (t--)
    solve();
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

#include <bits/stdc++.h>
using namespace std;

#define pb(a) push_back((a))


#define REP2(a, b) for (ll j = (a); j < (b); j++)
#define REPE(a, b, c, d) \
    REP(a, b)            \
    for (ll j = (c); j < (d); j++)
#define REPV(a, b, c) for (ll(a) = b; (a) < (c); (a)++)

#define IREP2(a, b) for (ll j = (a); j >= (b); j--)
#define IREPV(a, b, c) for (ll(a) = b; (a) >= (c); (a)--)
#define all(v) (v).begin(), (v).end()
#define trvs(c) for (auto &it : c)
#define INF 1e18


    ios_base::sync_with_stdio(false); \
    cin.tie(0);                       \
    cout.tie(0);
#define F first
#define S second
#define MOD 1000000007

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define _DEBUG 1
#if _DEBUG





    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);

    cout << 
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;





    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);

    cerr << 
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;


#else







#define wait ;








#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }



// auto cmp = [](pair<ll, pair<ll, ll>> a, pair<ll, pair<ll, ll>> b) {
//     if (a.F == b.F)
//         return a.S.F > b.S.F;
//     return a.F > b.F;
// };
//decltype(cmp)
// set.count(x)==0 not present
// accumulate (all(a),sum) or accumulate(all(a),sum,myfunc)
//partial_sum(all(a),b)   a and b are vectors puts prefix array of a in b
// partial_sum(all(a),b,myfunc)
//g++ -std=c++17 .\ans.cpp | ./a.exe
bool cmp(ll a, ll b)
{
    if (abs(a) == abs(b))
    {
        return a > b;
    }
    return abs(a) > abs(b);
}

long long binpow(long long a, long long b, long long m = MOD)
{
    a %= m;
    long long res = 1;
    while (b > 0)
    {
        if (b & 1)
            res = res * a % m;
        a = a * a % m;
        b >>= 1;
    }
    return res;
}

void solve()
{
    ll n;
    cin >> n;
    ll ans = (binpow(10, n) % MOD - (2 * binpow(9, n)) % MOD + binpow(8, n)% MOD + MOD) % MOD;
    cout << ans << endl;
}

int main()
{
    flash


    ll t;
    // cin >> t;
    // while (t--)
    solve();
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

n = int(input())

ans = (pow(10, n)-2*pow(9, n)+pow(8, n)) % (10**9+7)
print(ans)


Verdicts: Runtime Error

Runtime Error

Runtime Error

Accepted