Problem:


Score : 300 points

Problem Statement

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.

Constraints

1 \leq N \leq 10^6

N is an integer.

Input

Input is given from Standard Input in the following format:

N

Output

Print the answer modulo 10^9 + 7.

Sample Input 1

2

Sample Output 1

2

Two sequences \{0,9\} and \{9,0\} satisfy all conditions.

Sample Input 2

1

Sample Output 2

0

Sample Input 3

869121

Sample Output 3

2511445



Sample input:
2


Sample output:
2

Submission status: Runtime Error

Solution code:
N=int(input())
if N==1:
  ans=0
else:
  x=N*(N-1)/2*10**(N-2)
  ans=x%(7+10**9)
print(int(ans))

Submission status: Runtime Error

Solution code:
N=int(input())
if N==1:
  ans=0
else:
  x=N*(N-1)/2*10**(N-2)
  ans=x/(7+10**9)
print(ans)

Submission status: Runtime Error

Solution code:
 tmp = 10 ** 9 + 7
def div(n,T):
    _ = 1
    for t in range(T):
        _ *= n
        _ %= tmp
    return _
    
N = int(input())
a = div(10,N)
b = div(9,N)
c = div(8,N)

print((a + c - 2 * b) % tmp

Submission status: Runtime Error

Solution code:
mod = 10 ** 9 + 7

N = int(input())

result = 0

ten = pow(10, N, mod)
nine = pow(9, N, mod)
eight = pow(8, N, mod)

result = (ten - 2 * nine + eight) % mode

print(result)

Submission status: Runtime Error

Solution code:
n = int(input())
m=int(1e9+7)
print(((pow(10,n,m)+pow(8,n,m)-2*pow(9,n,m))%m)

Submission status: Runtime Error

Solution code:
mod = 10**9+7

def fact(n):
  ans = 1
  for num in range(n):
    ans = (ans*(num+1))%mod
  return ans
def power(a,m,mod):
  if m == 0:
    return 1
  elif m%2 == 0:
    return power(a*a%mod,m//2,mod)%mod
  else:
    return a*power(a,m-1,mod)%mod
  

N = int(input())
if N == 1:
  print(0)
else:
  ans = 0
  for n1 in range(N-1):
    n1 += 1
    for n2 in range(N-n1):
      n2 += 1
      tmp1 = (fact(N)**2) % mod
      tmp2 = fact(N-n1)
      tmp3 = fact(N-n2)
	  tmp1 *= power(tmp1,mod-2,mod)*power(tmp2,mod-2,mod)*power(fact(n1),mod-2,mod)*power(fact(n2),mod-2,mod)*power(8,N-n1-n2,mod)
      ans += tmp1
print(ans)

Submission status: Runtime Error

Solution code:
n = int(input())
MOD = 10**9 + 7
ans = pow(10,n,MOD) - 2*pow(9.n,MOD) - pow(8,n,MOD)
print(ans%MOD)

Submission status: Runtime Error

Solution code:
n = int(input())
mod = 10**9+7
print ((pow(10,N,mod) - 2*pow(9,N,mod) + pow(8,N,mod)) % mod)

Submission status: Runtime Error

Solution code:
n = int(input())
print(pow(10, n, mod) - 2*pow(9, n, mod) - pow(9, n, mod))

Submission status: Runtime Error

Solution code:
N = int(input())
MOD = 10 ** 9 + 7
if N == 1:
  print(0)
  exit()
a = 1
b = 1
c = 1
for i in range(N):
  a = pow(10, n, MOD)
  b = pow(9, n, MOD)
  c = pow(8, n, MOD)
ans = a - (2 * b) + c
if ans < 0:
  ans += MOD
print(ans)

Submission status: Runtime Error

Solution code:
def main():
    n = int(input())
    mod = 10 ** 9 + 7 #素数
    
    def modpow(x, n, mod):
        res = 1
        while n:
            if n % 2:
                res *= x % mod
                res %= res
            x *= x % mod
            n >>= 1
        return res
 
    # 全パターン:10 ** n
    all_p = modpow(10, n, mod)
    # 0を含まないパタンーン:9 ** n
    not_0 = modpow(9, n, mod)
    # 9を含まないパターン:9 ** n
    not_9 = modpow(9, n, mod)
    # 0と９を含まないパターン:8 ** n
    not_0_9 = modpow(8, n, mod)
    # 条件のパターン
    ans = (all_p - not_0 - not_9 + not_0_9) % mod
    print(ans)
 
if __name__ == '__main__':
    main()

Submission status: Runtime Error

Solution code:
def bekijou(a,x):
  MOD = 1000000009
  ret = 1
  for _ in range(x):
    ret *= a
    ret %= MOD
    
n=int(input())
ret = 0
sum = bekijou(9,n)
MOD = 1000000009
ret = (2 * sum) % MOD
ret += MOD - bekijou(8,n)
ret = bekijou(10,n) + MOD - ret
print(ret)

Submission status: Runtime Error

Solution code:
import math
import sys

a=1000000007
def modd(x, y):
    z=1
    for i in range(y):
        z=z*x%a
    return z

j=int(sys.argv[1])
ans=modd(10, j)-modd(9, j)-modd(9, j)+modd(8, j)
print(ans%a)

Submission status: Runtime Error

Solution code:
import math

a=1000000007
def modd(x, y):
    z=1
    for i in range(y):
        z=z*x%a
    return z

j=int(sys.argv[1])
ans=modd(10, j)-modd(9, j)-modd(9, j)+modd(8, j)
print(ans%a)

Submission status: Runtime Error

Solution code:
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <ctype.h>
#include <cstdlib>
#include <cmath>
#include <stack>
#define _GLIBCXX_DEBUG
using namespace std;

int main()
{
    int n;
    cin >> n;
    long long a = 1, b = 1, c = 1;
    for (int i = 0; i < n; i++)
    {
        a *= 10;
        a %= 1000000007;
        b *= 9;
        b %= 1000000007;
        c *= 8;
        c %= 1000000007;
    }
    cout << (a-b-b+c+1000000007)%1000000007 << endl;
}

Submission status: Runtime Error

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

#define pb(a) push_back((a))
#define mp(a, b) make_pair((a), (b))
#define REP(a, b) for (ll i = (a); i < (b); i++)
#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 IREP(a, b) for (ll i = (a); i >= (b); i--)
#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
#define sz(x) (long long)(x.size())
#define flash                         \
    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
#define debug(x) cout << #x << "=" << x << endl
#define debug2(x, y) cout << #x << "=" << x << " " << #y << "=" << y << endl;
#define debug3(x, y, z) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define debug4(x, y, z, w) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define debug5(x, y, z, w, t)      \
    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug6(p, x, y, z, w, t)                            \
    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug7(o, p, x, y, z, w, t) \
    cout << #o << " " << o << " ";  \
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;
#define derr(x) cerr << #x << "=" << x << endl;
#define derr2(x, y) cerr << #x << "=" << x << " " << #y << "=" << y << endl;
#define derr3(x, y, z) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define derr4(x, y, z, w) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define derr5(x, y, z, w, t)       \
    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr6(p, x, y, z, w, t)                             \
    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr7(o, p, x, y, z, w, t) \
    cerr << #o << " " << o << " "; \
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;
#define checkpoint cerr << "At checkpoint : " << checkpoint_counter++ << endl;

#else
#define debug(x) ;
#define debug2(x, y) ;
#define debug3(x, y, z) ;
#define debug4(x, y, z, q) ;
#define debug5(x, y, z, r, t) ;
#define debug6(x, y, z, r, t, s) ;
#define debug7(x, y, z, r, t, s, u) ;
#define wait ;
#define derr(x) ;
#define derr2(x, y) ;
#define derr3(x, y, z) ;
#define derr4(x, y, z, q) ;
#define derr5(x, y, z, r, t) ;
#define derr6(x, y, z, r, t, s) ;
#define derr7(x, y, z, r, t, f, u) ;
#define checkpoint ;
#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }
#define present(container, element) (container.find(element) != container.end())
#define endl "\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;
}

Submission status: Runtime Error

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

#define pb(a) push_back((a))
#define mp(a, b) make_pair((a), (b))
#define REP(a, b) for (ll i = (a); i < (b); i++)
#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 IREP(a, b) for (ll i = (a); i >= (b); i--)
#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
#define sz(x) (long long)(x.size())
#define flash                         \
    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
#define debug(x) cout << #x << "=" << x << endl
#define debug2(x, y) cout << #x << "=" << x << " " << #y << "=" << y << endl;
#define debug3(x, y, z) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define debug4(x, y, z, w) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define debug5(x, y, z, w, t)      \
    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug6(p, x, y, z, w, t)                            \
    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug7(o, p, x, y, z, w, t) \
    cout << #o << " " << o << " ";  \
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;
#define derr(x) cerr << #x << "=" << x << endl;
#define derr2(x, y) cerr << #x << "=" << x << " " << #y << "=" << y << endl;
#define derr3(x, y, z) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define derr4(x, y, z, w) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define derr5(x, y, z, w, t)       \
    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr6(p, x, y, z, w, t)                             \
    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr7(o, p, x, y, z, w, t) \
    cerr << #o << " " << o << " "; \
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;
#define checkpoint cerr << "At checkpoint : " << checkpoint_counter++ << endl;

#else
#define debug(x) ;
#define debug2(x, y) ;
#define debug3(x, y, z) ;
#define debug4(x, y, z, q) ;
#define debug5(x, y, z, r, t) ;
#define debug6(x, y, z, r, t, s) ;
#define debug7(x, y, z, r, t, s, u) ;
#define wait ;
#define derr(x) ;
#define derr2(x, y) ;
#define derr3(x, y, z) ;
#define derr4(x, y, z, q) ;
#define derr5(x, y, z, r, t) ;
#define derr6(x, y, z, r, t, s) ;
#define derr7(x, y, z, r, t, f, u) ;
#define checkpoint ;
#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }
#define present(container, element) (container.find(element) != container.end())
#define endl "\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;
}

Submission status: Runtime Error

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

#define pb(a) push_back((a))
#define mp(a, b) make_pair((a), (b))
#define REP(a, b) for (ll i = (a); i < (b); i++)
#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 IREP(a, b) for (ll i = (a); i >= (b); i--)
#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
#define sz(x) (long long)(x.size())
#define flash                         \
    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
#define debug(x) cout << #x << "=" << x << endl
#define debug2(x, y) cout << #x << "=" << x << " " << #y << "=" << y << endl;
#define debug3(x, y, z) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define debug4(x, y, z, w) cout << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define debug5(x, y, z, w, t)      \
    cout << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug6(p, x, y, z, w, t)                            \
    cout << #p << " " << p << " " << #x << "=" << x << " "; \
    debug4(y, z, w, t);
#define debug7(o, p, x, y, z, w, t) \
    cout << #o << " " << o << " ";  \
    debug6(p, x, y, z, w, t);
#define wait  \
    int xxxx; \
    cin >> xxxx;
#define derr(x) cerr << #x << "=" << x << endl;
#define derr2(x, y) cerr << #x << "=" << x << " " << #y << "=" << y << endl;
#define derr3(x, y, z) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << endl;
#define derr4(x, y, z, w) cerr << #x << "=" << x << " " << #y << "=" << y << " " << #z << "=" << z << " " << #w << "=" << w << endl;
#define derr5(x, y, z, w, t)       \
    cerr << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr6(p, x, y, z, w, t)                             \
    cerr << #p << " " << p << " " << #x << "=" << x << " "; \
    derr4(y, z, w, t);
#define derr7(o, p, x, y, z, w, t) \
    cerr << #o << " " << o << " "; \
    derr6(p, x, y, z, w, t);
ll checkpoint_counter = 0;
#define checkpoint cerr << "At checkpoint : " << checkpoint_counter++ << endl;

#else
#define debug(x) ;
#define debug2(x, y) ;
#define debug3(x, y, z) ;
#define debug4(x, y, z, q) ;
#define debug5(x, y, z, r, t) ;
#define debug6(x, y, z, r, t, s) ;
#define debug7(x, y, z, r, t, s, u) ;
#define wait ;
#define derr(x) ;
#define derr2(x, y) ;
#define derr3(x, y, z) ;
#define derr4(x, y, z, q) ;
#define derr5(x, y, z, r, t) ;
#define derr6(x, y, z, r, t, s) ;
#define derr7(x, y, z, r, t, f, u) ;
#define checkpoint ;
#endif

#define print_matrix(a, n, m) \
    REPE(0, n, 0, m) { cout << (a)[i][j] << ((j == m - 1) ? '\n' : ' '); }
#define present(container, element) (container.find(element) != container.end())
#define endl "\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;
}

Submission status: Runtime Error

Solution code:
import sys
input = sys.stdin.readline
mod = int(1e9)+7

def solve():
    n=int(input())
    if n<3:
        print(0)
        return
    dp=[0]*2001
    dp[3]=dp[4]=dp[5]=1
    for i in range(6,n+1):
        dp[i]=(dp[i-1]+dp[i-3])%mod
    print(dp[n])

if __name__=="__main__":
    solve()

Submission status: Runtime Error

Solution code:
def binexp(b):
  res = 1
  while b>0:
    if b&1:
      res *= a
      res%=mod
    a *= a
    a%=mod
    b>>=1
  return res
mod = 1000000007
n = int(input())
if n==1:
  print(0)
elif n==2:
  print(1)
else:
  count = 1
  n -= 2
  ans = binexp(n)
  print(ans)

Submission status: Runtime Error

Solution code:
#include <bits/stdc++.h>
#include <stdio.h>
#include <string.h>
#define rep(i,n) for (int i=0; i<n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>; 

ll n;
ll MOD = 1000000007;

int main(){
  cin>>n;
  if(n<2) cout<<"0"<<endl;
  else{
    ll ans = n * (n-1) % MOD;
    for(int i=0; i<n-2; i++){
      cout<<ans<<endl;
      ans = ans * 10 % MOD;
    }
    cout<<ans;
  }
}

Submission status: Runtime Error

Solution code:
n =int(input())
Sum=(10**n)-(9**n)-(9**n)+(8**n)
Print( Sum)

Submission status: Runtime Error

Solution code:
n =int(input())
Print((10**n)-(9**n)-(9**n)+(8**n))

Submission status: Runtime Error

Solution code:
N =int(input())
Print(10**n-9**n-9**n+8**n)

Submission status: Runtime Error

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

const int64_t mod=1000000007;
int main(){
  int64_t n,a=1,b=1,c=1;
  cin >> n;
  for(int i=0;i<n;i++){
    a*=10;a%=mod;
    b*=9;b%=mod;
    c*=8;c%=mod;
  }
  cout << (mod+a-b-b+c)%mod << endl;
  return 0;
}

Submission status: Runtime Error

Solution code:
import sys
sys.setrecursionlimit(250000)

from scipy.special import comb
# a = comb(n, r)

def main():
    # a,b,c,d = map(int, input().split())
    n = int(input())

    sum = 10**n - 9**n*2 + 8**n
    # temp = (10 ** 9 + 7)
    # sum = 0
    # if n >= 2:
    #     for i in range(2, n+1):
    #         a = int(comb(i, 2)) * 2
    #         a = (a * 8**(i-2)) % temp
    #         sum = sum + a
    # else:
    #     print(0)

    print(sum % (10 ** 9 + 7))

    # if a < 0  and b < 0 and c < 0 and d < 0 :
    #     print(a*c)
    # elif a < 0  from scipy.special import comb
    # # a = comb(n, r)
    # a = comb(n, r, exact=True)and b < 0 and c < 0 and d >= 0 :
    #     print(a * c)
    # elif a < 0  and b < 0 and c >= 0 and d > 0 :
    #     print(b*c)
    # elif a < 0  and b > 0 and c < 0 and d < 0 :
    #     print(a*c)
    # elif a < 0  and b >= 0 and c < 0 and d >= 0 :
    #     print(max(a*c, b*d))
    # elif a < 0 and b > 0 and c > 0 and d > 0:
    #     print(b*d)
    # elif a > 0  and b > 0 and c < 0 and d < 0 :
    #     print(a*d)
    # elif a > 0  and b > 0 and c < 0 and d > 0 :
    #     print(b*d)
    # elif  a > 0  and b >0 and c > 0 and d > 0 :
    #     print(b*d)

    #
    # pairs=[]
    # for i in range(n):
    #     pairs.append(list(map(int, input().split())))
    #
    # dp =  [[0] * 10001 for i in range(101)]
    # for j in range(0, 10001):
    #     for i in range(0,n):
    #         if j >= pairs[i][1]:
    #             dp[i+1][j] = max(dp[i][j-pairs[i][1]] + pairs[i][0], dp[i][j])
    #         else:
    #             dp[i+1][j] = dp[i][j]
    #
    # print(dp[n][w])
main()

Submission status: Runtime Error

Solution code:
from sys import setrecursionlimit
setrecursionlimit(1<<30)
def f(i,b1,b2):
  if i==n:
    return b1 and b2
  if z[i][b1][b2]==-1:
    z[i][b1][b2]=sum(f(i+1,b1 or j==0,b2 or j==9) for j in xrange(10))%(pow(10,9)+7)
  return z[i][b1][b2]
n=input()
z=[[[-1 for _1 in xrange(2)] for _2 in xrange(2)] for _3 in xrange(n+1)]
print f(0,False,False)

Submission status: Runtime Error

Solution code:
N = input()
satisfied_pattern = 10**N - (2*(9**N) - 8**N)
output = satisfied_pattern % (10**9+7)
print(output)

Submission status: Runtime Error

Solution code:
N=int(input())
ans=10**n-2*(9**n)+8**n
ans=ans%1000000007
print(ans)

Submission status: Runtime Error

Solution code:
a, b, c, d = list(map(int, input().split()))
R=max([b*d, a*d, a*c, b*c])
print(R)

Submission status: Runtime Error

Solution code:
n=int(input())
mod=10**9+7
exlcusion=2*pow(9,n,mod)-pow(8,n,mod)
total=pow(10,n,mod)
ans=total-exclusion%mod
print(total)

Submission status: Runtime Error

Solution code:
#!/usr/bin/env python3
import sys

MOD = 1000000007  # type: int


def solve(N: int):
    return print((10**N - 2*9**N + 8**N))

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    solve(N)

if __name__ == '__main__':
    main()
~                                                                                                                                        
~

Submission status: Runtime Error

Solution code:
N = int(input())

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

Submission status: Runtime Error

Solution code:
import os
import sys
from collections import defaultdict, Counter
from itertools import product, permutations,combinations, accumulate
from operator import itemgetter
from bisect import bisect_left,bisect
from heapq import heappop,heappush,heapify
from math import ceil, floor, sqrt, factorial
from copy import deepcopy
 
def main():
    n = int(input()) % (10**9+7)
    num = 0
    ans = (10**n) - 2(9**n) + (8**n) 
    print(ans%810**9+7)
    

if __name__ == "__main__":
    main()

Submission status: Runtime Error

Solution code:
n = int(input())

mod = 10 ** 9 + 7

re = (10 ** n) - (2 * (9 ** n)) - (8 ** n)

if n = 1:
    print(0)
else:
    print(re)

Submission status: Runtime Error

Solution code:
n = input()
mod = 10**9 + 7
ans = (pow(10, n, mod) - ((2 * pow(9, n, mod)) % mod - pow(8, n, mod) + mod) % mod + mod) % mod
print(ans)

Submission status: Runtime Error

Solution code:
n=int(input())
mod=10**9+7
print((pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod)%mod)

Submission status: Runtime Error

Solution code:
# 整数の入力
N = int(input())

print((10 ** N - 2* 9 **N + 8 ** N)) % (10 ** 9 + 7)

Submission status: Runtime Error

Solution code:
  N = int(input())
  print((10**N -9**N -9**N +8**N)% (10**9+7))

Submission status: Runtime Error

Solution code:
import math
import itertools
def fact(n):  
    if (n <= 1): 
        return 1
          
    return n * fact(n - 1)  
  
def nPr(n, r):  
      
    return math.floor(fact(n) /
                fact(n - r))  



from math import *
  
# Function to find the nCr 
def printNcR(n, r): 
  
    # p holds the value of n*(n-1)*(n-2)..., 
    # k holds the value of r*(r-1)... 
    p = 1
    k = 1
  
    # C(n, r) == C(n, n-r), 
    # choosing the smaller value 
    if (n - r < r): 
        r = n - r 
  
    if (r != 0):  
        while (r): 
            p *= n 
            k *= r 
  
            # gcd of p, k 
            m = gcd(p, k) 
  
            # dividing by gcd, to simplify product 
            # division by their gcd saves from the overflow 
            p //= m 
            k //= m 
  
            n -= 1
            r -= 1
  
        # k should be simplified to 1 
        # as C(n, r) is a natural number 
        # (denominator should be 1 )  
  
    else: 
        p = 1
  
    # if our approach is correct p = ans and k =1 
    print(p) 
N = int(input())

#list化
#L = len(list(itertools.permutations(ll, 2)))
amari = 1000000007
P = nPr(N, 2)
R = 10**(N-2)-P
#JL = len(list(itertools.product(l, repeat=N)))%amari
#R = len(list(itertools.product(r, repeat=N)))%amari

print((P*R)%amari)

Submission status: Runtime Error

Solution code:
N = int(input())
MOD = 1000000000 + 7
def power_func(a,n,p):
    bi = str(format(n,"b"))#2進表現に
    res = 1
    for i in range(len(bi)):
        res = (res*res) %p
        if bi[i] == "1":
            res = (res*a) %p
    return res
print(str((power_func(10, N, MOD) - 2 * power_func(9, N, MOD) + power_func(8, N, MOD) % MOD))

Submission status: Runtime Error

Solution code:
N = int(input())
cnt = N*(N-1)
less = 8 ** (N-2)
d = 10**9 + 7
ans = cnt * less
x=N-2
for i in range(x+1):
    for j in range(x+1):
        if i == 0 and j ==0: continue
        if i + j <= x:
            l = [0]*(1+i) +[9]*(1+j) +[-1]*(x-i-j)
            ans += len(set(list(itertools.permutations(l, N))))
print(ans%d)

Submission status: Runtime Error

Solution code:
import math
import itertools
def fact(n):  
    if (n <= 1): 
        return 1
          
    return n * fact(n - 1)  
  
def nPr(n, r):  
      
    return math.floor(fact(n) /
                fact(n - r))  



from math import *
  
# Function to find the nCr 
def printNcR(n, r): 
  
    # p holds the value of n*(n-1)*(n-2)..., 
    # k holds the value of r*(r-1)... 
    p = 1
    k = 1
  
    # C(n, r) == C(n, n-r), 
    # choosing the smaller value 
    if (n - r < r): 
        r = n - r 
  
    if (r != 0):  
        while (r): 
            p *= n 
            k *= r 
  
            # gcd of p, k 
            m = gcd(p, k) 
  
            # dividing by gcd, to simplify product 
            # division by their gcd saves from the overflow 
            p //= m 
            k //= m 
  
            n -= 1
            r -= 1
  
        # k should be simplified to 1 
        # as C(n, r) is a natural number 
        # (denominator should be 1 )  
  
    else: 
        p = 1
  
    # if our approach is correct p = ans and k =1 
    print(p) 
N = int(input())

#list化
#L = len(list(itertools.permutations(ll, 2)))
amari = 1000000007
P = nPr(N, 2)
R = 10*(N-2)-P
#JL = len(list(itertools.product(l, repeat=N)))%amari
#R = len(list(itertools.product(r, repeat=N)))%amari

print((P*R)%amari)

Submission status: Runtime Error

Solution code:
#
# 178C
#
import math
import sys

MOD = 10**9+7
num = input()
n = int(num)

def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

p = 10 ** 9 + 7
N = 10 ** 6  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)


if n=="1":
    print("0")
    sys.exit()
elif n=="2":
    print("2")
    sys.exit()

MOD = 10**9 + 7
N = 10**5

fact = [1]*(N+1)
rfact = [1]*(N+1)
r = 1
for i in range(1, N+1):
  fact[i] = r = r * i % MOD
rfact[N] = r = pow(fact[N], MOD-2, MOD)
for i in range(N, 0, -1):
  rfact[i-1] = r = r * i % MOD

# nPk (mod MOD) を求める
def perm(n, k):
  return fact[n] * rfact[n-k] % MOD

# nCk (mod MOD) を求める
def comb(n, k):
  return fact[n] * rfact[k] * rfact[n-k] % MOD

kai = perm(n, 1)
print(kai)
tem = n-2
#ans = ((10*tem) % MOD * math.factorial(int(n))% MOD) % MOD
ans = (10*tem*kai)%MOD
print(ans)

Submission status: Runtime Error

Solution code:
from scipy.special import perm
n = int(input())
def re_factorial(n):
    if n < 2:
        return 1
    return n * re_factorial(n-1)
mas = n-2 # 0と9は必ず使う
#print(perm(n, 2))
if mas == 0:
  print(2)
elif n == 0:
  print(1)
else:
  #res = (permutations_count(n, 2) * 10^mas)%(10^9 + 7)
  res = (re_factorial(n)%1000000007 * int(perm(n, 2))%1000000007 * 10**mas%1000000007) %1000000007
  print(int(res))

Submission status: Runtime Error

Solution code:
import math

def permutations_count(n, r):
    return (math.factorial(n) // math.factorial(n - r)) % mod

N = int(input())

mod = 10**9 + 7

ans = ((permutations_count(N, 2) * (8 ** (N - 2))) + permutations_count(N, 2)) % mod

print(ans % mod)

Submission status: Runtime Error

Solution code:
def P(x):
    if x == 0:
        return 1
    return x * P(x - 1)
    
N = int(input())

if N == 1:
    print(0)
else:
    print(P(N) * 9**(N-2))

Submission status: Runtime Error

Solution code:
from scipy.special import comb as c
N = int(input())
if N == 1: print(0)
else:
  ans = 0
  for i in range(1, N):
    ans += c(i+1, N-1, exact=True)
print(ans % (10 ** 9 + 7))

Submission status: Runtime Error

Solution code:
MOD = 1000000007
n = int(input())
a = 1
b=1
c=1
for i in range(n):
    a=a*10%MOD
    b=b*9%MOD
    c=c*8%MOD
print (a-2*b+c)%MOD

Submission status: Runtime Error

Solution code:
import math
def combinations_count(N, r):
    return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))
 
# 整数の入力
N = int(input())
r = 2
 
print(combinations_count(N, r) * 10**(N-r) % (10**9 +7))

Submission status: Runtime Error

Solution code:
N=int(input())
if N==1:
    print(0)
elif N==2:
    a=8
    print(a)
elif N==3:
    b=28
    print(a+b)
elif N==4:
    c=56
    print(a+b+c)
elif N==5:
    d=70
    print(a+b+c+d)
elif N==6:
    print(a+b+c+d+c)
elif N==7:
    print(a+b+c+d+c+b)
elif N==8:
    print(a+b+c+d+c+b+a)
elif N==9:
    print(a+b+c+d+c+b+a+1)

Submission status: Runtime Error

Solution code:

def cal(N):
  for n in range(3,N+1):
    left = N - n
    right = n
    if left < 6:
      return 1
    else:
      return 1 + cal(left)

    if right < 6:
      return 1
    else:
      return 1 + cal(right)
    
    
S = int(input())

if S < 3:
  print(0)
  exit()
else:
  ans = cal(S)
  print((1+ans)%dekai())