alexjercan/bugnet huggingface dataset:
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
ll mod = 1e9 + 7;
ll d[1000001][2][2];
int n;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  cin >> n;

  ll ans = 0;
  d[0][0][0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int j = 0; j < 2; j++) {
      for (int k = 0; k < 2; k++) {
        if (j == 0 && k == 0) {
          d[i][j][k] += d[i - 1][j][k] * (ll)8;
          d[i][j][k] %= mod;
        } else if (j == 0 && k == 1) {
          d[i][j][k] += d[i - 1][0][0];
          d[i][j][k] %= mod;
          d[i][j][k] += d[i - 1][j][k] * (ll)9;
          d[i][j][k] %= mod;
        } else if (j == 1 && k == 0) {
          d[i][j][k] += d[i - 1][0][0];
          d[i][j][k] %= mod;
          d[i][j][k] += d[i - 1][j][k] * (ll)9;
          d[i][j][k] %= mod;
        } else {
          d[i][j][k] += d[i - 1][1][0];
          d[i][j][k] %= mod;
          d[i][j][k] += d[i - 1][0][1];
          d[i][j][k] %= mod;
          d[i][j][k] += d[i - 1][j][k] * (ll)10;
          d[i][j][k] %= mod;
        }
      }
    }
  }

  cout << d[n][1][1] << '\\n';
}


Error: 0

Fixed submission:

#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
ll mod = 1e9 + 7;
ll d[100001][11][2][2];
int n;

ll go(int x, int y, int z, int r) {
  if (x == n) {
    if (z == 1 && r == 1)
      return 1;
    else
      return 0;
  }
  ll &ret = d[x][y][z][r];
  if (ret != -1)
    return ret;
  ret = 0;
  for (int i = 0; i <= 9; i++) {
    if (i == 0) {
      if (z == 0) {
        ret += go(x + 1, i, 1, r);
        ret %= mod;
      }
    } else if (i == 9) {
      if (r == 0) {
        ret += go(x + 1, i, z, 1);
        ret %= mod;
      }
    } else {
      ret += go(x + 1, i, z, r);
      ret %= mod;
    }
  }
  return ret;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);

  cin >> n;

  memset(d, -1, sizeof(d));
  ll ans = 0;
  for (int i = 0; i <= 9; i++) {
    if (i == 0) {
      ans += go(1, i, 1, 0);
      ans %= mod;
    } else if (i == 9) {
      ans += go(1, i, 0, 1);
      ans %= mod;
    } else {
      ans += go(1, i, 0, 0);
      ans %= mod;
    }
  }

  cout << ans << '\\n';
}
Problem p02554 (C++) — buggy submission, verdict: Time Limit Exceeded

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

long long mod = 1000000007, ara[1000009], tra[1000009], nra[1000009],
          xra[1000009];

long long bigmod(long long n, long long p) {
  if (p == 0)
    return 1;
  if (p % 2 == 0) {
    long long ret = bigmod(n, p / 2);
    return ((ret % mod) * (ret % mod)) % mod;
  } else
    return ((n % mod) * (bigmod(n, p - 1) % mod)) % mod;
}

int main() {

  long long n, m, a, b, c, d, e = 2, f, g, h, p, q, r, fr, sc, tr, sz, tz, i, j,
                              k, mx = LLONG_MIN, mn = LLONG_MAX;
  long long x = 0, y = 0, cnt = 0, res = 0, ttl = 0, ans = 0, sum = 0;
  long long flg = 0, flag = 1, na = 0, as = 1;
  vector<long long> u, v, w;
  vector<pair<long long, long long>> vct;
  vector<string> vst;
  set<long long> st, nt, tt;
  map<long long, long long> mp, nq, qr;
  string str, ttr, ntr;

  scanf("%lld", &n);

  if (n == 1)
    printf("0\\n");
  else {
    ara[0] = 1;
    tra[0] = 1;
    nra[0] = 1;

    for (i = 1; i <= n; i++) {
      ara[i] = (ara[i - 1] * i) % mod;

      tra[i] = (tra[i - 1] * 2) % mod;
      nra[i] = (nra[i - 1] * 8) % mod;
    }

    for (i = 2; i <= n; i++) {
      fr = tra[i];

      if (fr >= e) {
        g = fr - e;
      } else {
        g = (mod - e) + fr;
      }

      sc = nra[n - i];

      r = (g * sc) % mod;

      c = xra[i];

      if (c == 0) {

        p = (ara[i] * ara[n - i]) % mod;
        tr = bigmod(p, mod - 2);

        c = (ara[n] * tr) % mod;

        xra[i] = c;
        xra[n - i] = c;
      }

      q = (r * c) % mod;

      ans = (ans + q) % mod;
    }

    printf("%lld\\n", ans);
  }

  return 0;
}


Error: TLE

Fixed submission:

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

long long mod = 1000000007, ara[1000009];

long long bigmod(long long n, long long p) {
  if (p == 0)
    return 1;
  if (p % 2 == 0) {
    long long ret = bigmod(n, p / 2);
    return ((ret % mod) * (ret % mod)) % mod;
  } else
    return ((n % mod) * (bigmod(n, p - 1) % mod)) % mod;
}

int main() {

  long long n, m, a, b, c, d, e = 2, f, g, h, p, q, r, fr, sc, tr, sz, tz, i, j,
                              k, mx = LLONG_MIN, mn = LLONG_MAX;
  long long x = 0, y = 0, cnt = 0, res = 0, ttl = 0, ans = 0, sum = 0;
  long long flg = 0, flag = 1, na = 0, as = 1;
  vector<long long> u, v, w;
  vector<pair<long long, long long>> vct;
  vector<string> vst;
  set<long long> st, nt, tt;
  map<long long, long long> mp, nq, qr;
  string str, ttr, ntr;

  scanf("%lld", &n);

  if (n == 1)
    printf("0\\n");
  else {
    ara[0] = 1;

    for (i = 1; i <= n; i++) {
      ara[i] = (ara[i - 1] * i) % mod;
    }

    for (i = 2; i <= n; i++) {
      fr = bigmod(2, i);

      if (fr >= e) {
        g = fr - e;
      } else {
        g = (mod - e) + fr;
      }

      sc = bigmod(8, n - i);

      r = (g * sc) % mod;

      p = (ara[i] * ara[n - i]) % mod;
      tr = bigmod(p, mod - 2);

      c = (ara[n] * tr) % mod;
      q = (r * c) % mod;

      ans = (ans + q) % mod;
    }

    printf("%lld\\n", ans);
  }

  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

//-- In the name of ALLAH --
// We're nothing and you're everything.
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

#define pai acos(-1)
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define sz(a) (ll) a.size()
#define endl "\\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b))
#define all(vec) vec.begin(), vec.end()
#define ms(a, b) memset(a, b, sizeof(a))
#define TEST_CASE(t) for (int zz = 1; zz <= t; zz++)
#define PRINT_CASE printf("Case %d: ", zz)
#define fii freopen("input.txt", "r", stdin);
#define foo freopen("output.txt", "w", stdout);
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

const ll M = 1e9 + 7;
const ll mxn = 1e5 + 7;

ll mod(ll x) { return ((x % M + M) % M); }
ll add(ll a, ll b) { return mod(mod(a) + mod(b)); }
ll minu(ll a, ll b) { return mod(mod(a) - mod(b)); }
ll mul(ll a, ll b) { return mod(mod(a) * mod(b)); }

ll modPow(ll a, ll b) {
  if (b == 0) {
    return 1LL;
  }
  if (b == 1) {
    return a % M;
  }
  ll res = 1;
  while (b) {
    if (b % 2 == 1) {
      res = mul(res, a);
    }
    a = mul(a, a);
    b = b / 2;
  }
  return res;
}

ll fnc(ll n) {
  if (n <= 1) {
    return 0;
  }
  if (n == 2) {
    return 2;
  }
  ll ret =
      minu(add(modPow(10, n), modPow(8, n)), add(modPow(9, n), modPow(9, n)));
  return ret;
}
int main() {
  ll i, j, a, b, c, d, n, m, t;
  cin >> n;
  cout << fnc(n) << endl;
  return 0;
}


Error: WA

Fixed submission:

//-- In the name of ALLAH --
// We're nothing and you're everything.
// Ya Ali!
#include <bits/stdc++.h>
using namespace std;

#define pai acos(-1)
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mp make_pair
#define pll pair<ll, ll>
#define sz(a) (ll) a.size()
#define endl "\\n"
#define gcd(a, b) __gcd(a, b)
#define lcm(a, b)        ((a)*((b)/gcd(a,b))
#define all(vec) vec.begin(), vec.end()
#define ms(a, b) memset(a, b, sizeof(a))
#define TEST_CASE(t) for (int zz = 1; zz <= t; zz++)
#define PRINT_CASE printf("Case %d: ", zz)
#define fii freopen("input.txt", "r", stdin);
#define foo freopen("output.txt", "w", stdout);
#define FAST                                                                   \\
  ios_base::sync_with_stdio(0);                                                \\
  cin.tie(NULL);                                                               \\
  cout.tie(NULL);

const ll mod = 1e9 + 7;
const ll mxn = 1e5 + 7;

ll fnc(ll n) {
  ll ret10 = 1, ret9 = 1, ret8 = 1;
  for (ll i = 1; i <= n; i++) {
    ret10 = ((ret10 % mod) * (10 % mod)) % mod;
    ret9 = ((ret9 % mod) * (9 % mod)) % mod;
    ret8 = ((ret8 % mod) * (8 % mod)) % mod;
  }
  // cout<<ret10<<"==="<<ret9<<"--"<<ret8<<endl;
  ll ret = (ret10 - (2 * ret9 - ret8) + mod) % mod;
}
int main() {
  ll i, j, a, b, c, d, n, m, t;
  cin >> n;
  cout << fnc(n) << endl;
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MOD = 1e9 + 7;
ll qpow(ll a, ll n) {
  ll res = 1;
  while (n) {
    if (n & 1)
      res = res * a % MOD;
    a = a * a % MOD;
    n >>= 1;
  }
  return res;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  if (n == 1)
    cout << 0;
  else
    cout << (qpow(10, n) - qpow(9, n) * 2 + qpow(8, n) + MOD * 2) % MOD;
  return 0;
}

Error: WA

Fixed submission:

// #include <iostream>
// #include <string>
// #include <vector>
// #include <errno.h>
// #include <string.h>
// #include <stdlib.h>
// #include <unistd.h>
// #include <fstream>
// #include <chrono>
// #include <iomanip>
// #include <cstdarg>
// #include <cstdio>
// #include <cctype>
// #include <cmath>
// #include <queue>
// #include <map>
// #include <set>
// #include <algorithm>
// #include <climits>
// #include <sstream>
// #include <numeric>
// #include <iterator>
// #include <utility>
// #include <stack>
// #include <functional>
// #include <deque>
// #include <complex>
// #include <bitset>
// #include <list>
// #include <array>
// #include <regex>
// #include <random>
// #include <unordered_set>
// #include <unordered_map>
// #include <cstdlib>
// #include <typeinfo>
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve() {
  ll n;
  cin >> n;
  if (n < 3)
    cout << 0;
  else if (n == 3)
    cout << 1;
  else {
    int p = 1e9 + 7;
    vector<ll> a(n + 1);
    a[3] = a[4] = a[5] = 1, a[6] = 2;
    for (int i = 7; i <= n; ++i) {
      a[i] = 1;
      for (int j = 3; j + 3 <= i; ++j) {
        a[i] += a[j];
        a[i] %= p;
      }
    }
    cout << a[n];
  }
}
int main() {
  solve();
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;
const ll mod = 1000000007;
int main() {
  ll n;
  cin >> n;
  ll cnt = 0;
  ll temp10 = 1, temp9 = 1, temp8 = 1;

  while (cnt < n) {
    temp10 *= 10;
    temp10 %= mod;
    temp9 *= 9;
    temp9 %= mod;
    temp8 *= 8;
    temp8 %= mod;
    cnt++;
  }
  ll ans = (temp10 - temp9 - temp9 + temp8) % mod;
  ans = (ans + mod) % mod;
  cout << ans << endl;
  return 0;
}

Error: 0

Fixed submission:

#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <vector>

using namespace std;
typedef long long ll;
const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
  fac[0] = fac[1] = 1;
  finv[0] = finv[1] = 1;
  inv[1] = 1;
  for (int i = 2; i < MAX; i++) {
    fac[i] = fac[i - 1] * i % MOD;
    inv[i] = MOD - inv[MOD % i] * (MOD / i) % MOD;
    finv[i] = finv[i - 1] * inv[i] % MOD;
  }
}

// 二項係数計算
long long COM(int n, int k) {
  if (n < k)
    return 0;
  if (n < 0 || k < 0)
    return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
  int n;
  cin >> n;
  int cnt = 0;
  ll temp = 1;
  COMinit();
  while (cnt < n - 2) {
    temp *= 9;
    temp %= MOD;
    cnt++;
  }
  ll ans = COM(n, 2) * temp * 2;
  ans %= MOD;
  cout << ans << endl;
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error


#include <bits/stdc++.h>
#define ll long long int
#define endl '\\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound

using namespace std;

ll pow1(ll a, ll b) {

  if (b == 1)
    return a;
  ll x = pow1(a, b / 2);
  x = x % mod * x % mod;

  x = x % mod;
  if (b % 2 == 0)
    return x;
  return (x * a % mod) % mod;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  if (n == 1) {

    cout << 0 << endl;

  } else {
    ll ans = pow1(10, n) % mod;
    ans = (ans % mod - pow1(9, n) % mod + mod) % mod;
    ans = (ans % mod - pow1(9, n) % mod + mod) % mod;
    ans = (ans % mod + pow1(8, n) % mod) % mod;
    cout << ans << endl;
  }
}


Error: 0

Fixed submission:


#include <bits/stdc++.h>
#define ll long long int
#define endl '\\n'
#define mod 1000000007
#define pb push_back
#define ff first
#define ss second
#define con continue
#define ub upper_bound
#define lb lower_bound

using namespace std;

ll pow1(ll a, ll b) {

  if (b == 1)
    return a;
  ll x = pow1(a, b / 2);
  x = x % mod * x % mod;

  x = x % mod;
  if (b % 2 == 0)
    return x;
  return (x * a % mod) % mod;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll n;
  cin >> n;
  if (n == 1) {

    cout << 0 << endl;
    return 1;
  }
  ll ans = pow1(10, n) % mod;
  ans = (ans % mod - pow1(9, n) % mod + mod) % mod;
  ans = (ans % mod - pow1(9, n) % mod + mod) % mod;
  ans = (ans % mod + pow1(8, n) % mod) % mod;
  cout << ans << endl;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <iostream>
#include <math.h>
using namespace std;
long long c = 1e9 + 7;
long long fast_pow(long long base, long long power) {
  long long result = 1;
  while (power > 0) {
    if (power & 1)
      result = (result * base) % c;
    base = (base * base) % c;
    power >>= 1;
  }
  return result;
}
int main() {
  long long n;
  cin >> n;
  cout << ((fast_pow(10, n) - 2 * fast_pow(9, n) + fast_pow(8, n)) % c + c) % c;
  return 0;
}

Error: WA

Fixed submission:

#include <iostream>
using namespace std;
int factorial(long long n, long long fact) {
  if (n != 1) {
    n--;
    fact *= n;
    fact = factorial(n, fact);
  }
  return fact;
}
int main() {
  long long n, f, fx, fact, x = 0;
  cin >> n;
  if (n > 10) {
    x = n - 10;
    n = 10;
  }
  f = factorial(n, n);
  fx = factorial(x + 1, x + 1);
  fact = f / fx;
  if (fact == 1)
    cout << 0;
  else
    cout << fact % 1000000007;
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e3 + 4;
const int MOD = 1e9 + 7;
int mpow(int x, int y) {
  if (y <= 0)
    return 1;
  if (y & 1)
    return (x * mpow(x, y - 1) % MOD) % MOD;
  return mpow((x * x) % MOD, y / 2) % MOD;
}

int32_t main() {
  cin.tie(0)->sync_with_stdio(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  cout << (mpow(10, n) - 2 * mpow(9, n) + mpow(8, n) + 2 * MOD) % MOD;
}

// nc1*(n-1)c1*9^(n-2)


Error: WA

Fixed submission:

#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 1e3 + 4;
const int MOD = 1e9 + 7;
int mpow(int x, int y) {
  if (y == 0)
    return 1;
  if (y & 1)
    return (x * mpow(x, y - 1)) % MOD;
  return mpow((x * x) % MOD, y) % MOD;
}

int32_t main() {
  cin.tie(0)->sync_with_stdio(0);
#ifdef LOCAL
  freopen("input.txt", "r", stdin);
#endif
  int n;
  cin >> n;
  cout << ((n * n) % MOD * mpow(9, n - 2)) % MOD;
}

// nc1*(n-1)c1*9^(n-2)
Problem p02554 (C++) — buggy submission, verdict: Time Limit Exceeded

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
#define ll long long
#define IO                                                                     \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie();                                                                   \\
  cout.tie(0)
#define inf 0x3f3f3f3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
ll f[N], invs[N];
ll pows(ll a, ll n) {
  ll ans = 1;
  while (n) {
    if (n & 1) {
      ans = ans * a % mod;
    }
    a = a * a % mod;
    n >>= 1;
  }
  return ans % mod;
}
ll inv(ll a) // 求逆元
{
  return pows(a, mod - 2);
}
ll C(ll n, ll m) // 组合数公式
{
  return f[m] * inv(f[n]) % mod * inv(f[m - n]) % mod;
  // return f[m]*invs[n]%mod*invs[m-n]%mod;
}
int main() {

  ll n;
  f[0] = 1;
  for (ll i = 1; i < N; i++) {
    f[i] = f[i - 1] * i % mod;
    invs[i] = inv(f[i]) % mod;
  }
  cin >> n;
  if (n < 2) {
    cout << 0 << endl;
  } else {
    ll sum = 0;
    for (ll i = 2; i <= n; i++) {
      sum = (sum +
             C(i, n) % mod * (pows(2, i) - 2) % mod * pows(8, n - i) % mod) %
            mod;
    }
    cout << sum << endl;
  }
  return 0;
}


Error: TLE

Fixed submission:

#include <algorithm>
#include <bits/stdc++.h>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
#define ll long long
#define IO                                                                     \\
  ios::sync_with_stdio(false);                                                 \\
  cin.tie();                                                                   \\
  cout.tie(0)
#define inf 0x3f3f3f3f3f3f
#define pi 3.1415926535898
using namespace std;
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
ll f[N], invs[N];
ll pows(ll a, ll n) {
  ll ans = 1;
  while (n) {
    if (n & 1) {
      ans = ans * a % mod;
    }
    a = a * a % mod;
    n >>= 1;
  }
  return ans % mod;
}
ll inv(ll a) // 求逆元
{
  return pows(a, mod - 2);
}
ll C(ll n, ll m) // 组合数公式
{
  return f[m] * inv(f[n]) % mod * inv(f[m - n]) % mod;
  // return f[m]*invs[n]%mod*invs[m-n]%mod;
}
int main() {

  ll n;
  f[0] = 1;
  for (ll i = 1; i < N; i++) {
    f[i] = f[i - 1] * i % mod;
    invs[i] = inv(f[i]) % mod;
  }
  cin >> n;
  if (n < 2) {
    cout << 0 << endl;
  } else {
    ll sum = 0;
    for (ll i = 1; i < n; i++) {
      for (ll j = 1; j <= n - i; j++) {
        sum = (sum +
               C(i, n) % mod * C(j, n - i) % mod * pows(8, n - i - j) % mod) %
              mod;
      }
    }
    cout << sum << endl;
  }
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define co(x) cout << x << '\\n'
#define dbg(x) cerr << #x << " = " << x << '\\n'
#define bitcount(x) (int)__builtin_popcount(x)
#define sz(x) (int)x.size()
#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define pii pair<int, int>
#define lcm(a, b) (a * b) / __gcd(a, b)
using namespace std;

int dp[2][2][1000005], n;

int fun(int zero, int nine, int idx) {
  if (idx <= 0) {
    return (zero and nine);
  }
  if (dp[zero][nine][idx] != -1)
    return dp[zero][nine][idx];
  int sum = 0;
  for (int i = 0; i <= 9; i++) {
    sum += fun(zero or i == 0, nine or i == 9, idx - 1);
    sum %= 1000000007LL;
  }
  return dp[zero][nine][idx] = sum;
}

inline void solve() {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  cout << fun(0, 0, n) << endl;
}

signed main() {
  int n = 1; // cin>>n;
  while (n--)
    solve();
  return 0;
}


Error: 0

Fixed submission:

/*------------------------------------
........Bismillahir Rahmanir Rahim....
..........created by Abdul Aziz.......
------------------------------------*/
#include <algorithm>
#include <cmath>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <stdio.h>
#include <unordered_map>
#include <vector>
#define mod 998244353
#define int long long
#define ld long double
#define pb push_back
#define vi vector<int>
#define co(x) cout << x << '\\n'
#define dbg(x) cerr << #x << " = " << x << '\\n'
#define bitcount(x) (int)__builtin_popcount(x)
#define sz(x) (int)x.size()
#define all(a) a.begin(), a.end()
#define ff first
#define ss second
#define pii pair<int, int>
#define lcm(a, b) (a * b) / __gcd(a, b)
using namespace std;

int dp[2][2][100005], n;

int fun(int zero, int nine, int idx) {
  if (idx <= 0) {
    return (zero and nine);
  }
  if (dp[zero][nine][idx] != -1)
    return dp[zero][nine][idx];
  int sum = 0;
  for (int i = 0; i <= 9; i++) {
    sum += fun(zero or i == 0, nine or i == 9, idx - 1);
    sum %= 1000000007;
  }
  return dp[zero][nine][idx] = sum;
}

inline void solve() {
  cin >> n;
  memset(dp, -1, sizeof(dp));
  cout << fun(0, 0, n) << endl;
}

signed main() {
  int n = 1; // cin>>n;
  while (n--)
    solve();
  return 0;
}
Problem p02554 (C++) — buggy submission, verdict: Runtime Error

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using ll = long long;
using ld = long double;
const int Mod = 1e9 + 7;
using namespace std;

#define Get_Abs(a) ((a) >= 0 ? (a) : -(a))
#define Get_Max(a, b) ((a) > (b) ? (a) : (b))
#define Get_Min(a, b) ((a) < (b) ? (a) : (b))
#define Get_Swap(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define Get_Limit(a, b, c) ((a) = ((a) > (c)) ? (c) : (((a) < (b)) ? (b) : (a)))

ll Power(ll a, ll b) {
  ll Ans = 1;
  while (b) {
    if (b & 1) {
      Ans = (Ans * a) % Mod;
    }
    a = (a * a) % Mod;
    b >>= 1;
  }
  return Ans;
}

int main() {
  ll n, Ans;
  cin >> n;
  if (n == 1) {
    Ans = 0;
  } else if (n == 2) {
    Ans = 2;
  } else {
    Ans = Power(10, n) - Power(9, n) * 2 + Power(8, n);
    while (Ans < 0) {
      Ans += Mod;
    }
    Ans = Ans % Mod;
  }
  cout << Ans;
  return 0;
}


Error: WA

Fixed submission:

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define ll long long
using namespace std;

#define Get_Abs(a) ((a) >= 0 ? (a) : -(a))
#define Get_Max(a, b) ((a) > (b) ? (a) : (b))
#define Get_Min(a, b) ((a) < (b) ? (a) : (b))
#define Get_Swap(a, b) ((a) ^= (b), (b) ^= (a), (a) ^= (b))
#define Get_Limit(a, b, c) ((a) = ((a) > (c)) ? (c) : (((a) < (b)) ? (b) : (a)))

ll Factorial(ll n) {
  ll ans = 1;
  while (n) {
    ans *= n;
    n--;
  }
  return ans;
}

ll Power(ll x, ll y) {
  ll ans = 1;
  while (y--) {
    ans *= x;
  }
  return ans;
}

int main() {
  ll n, Ans;
  ll Temp_1, Temp_2;

  cin >> n;
  if (n == 1) {
    Ans = 0;
  } else if (n == 2) {
    Ans = 2;
  } else {
    Temp_1 = Power(8, n - 2) * Factorial(n);
    Temp_2 = 0;
    for (int i = 2; i <= n - 1; i++) {
      Temp_2 += (n - i + 1) * Power(8, n - 1 - i) * Factorial(n) / Factorial(i);
    }
    Ans = Temp_1 + Temp_2;
  }
  Ans = Ans % 1000000007;
  cout << Ans;
  return 0;
}