problem_id
stringclasses
100 values
submission_id
stringlengths
10
10
status
stringclasses
2 values
code
stringlengths
6
806
p02554
s508690299
Accepted
N = int(input()) ans = (10 ** N - 2 * (9 ** N) + 8 ** N) % (10 ** 9 + 7) print(ans)
p02554
s864394809
Accepted
n=int(input()) print((10**n-9**n*2+8**n)%(10**9+7))
p02554
s005721683
Accepted
n=int(input()) mod=10**9+7 ans=pow(10,n,mod) ans-=pow(9,n,mod)*2 ans+=pow(8,n,mod) ans%=mod print(ans)
p02554
s048792245
Accepted
N = int(input()) mod = 1000000007 ans = (10**N - 2*(9**N) + 8**N) % mod print(ans)
p02554
s550165982
Accepted
N = int(input()) x = 10 ** 9 + 7 print(((10 ** N) % x - (2 * (9 ** N)) % x + (8 ** N) % x) % x)
p02554
s337074661
Accepted
import math import re #import sympy #a,b,c,d=map(int,input().split()) war=10**9+7 a=int(input()) if a<2: print(0) exit() print((10**a-9**a-9**a+8**a)%war)
p02554
s915480264
Accepted
n=int(input()) num=10**n-2*9**n+8**n numa=num%(10**9+7) print(numa)
p02554
s004791410
Accepted
N = int(input()) mod = 10**9 + 7 print((pow(10, N, mod) - 2*pow(9, N, mod) + pow(8, N, mod))%mod)
p02554
s143262500
Accepted
n = int(input()) print((10**n - 9**n*2 + 8**n) % (10 ** 9 + 7))
p02554
s432751356
Accepted
N = int(input()) m = 10**9 + 7 def pos(x, n, m): if n == 0: return 1 res = pos(x*x%m, n//2, m) if n%2 == 1: res = res*x%m return res s = pos(10, N, m) t = pos(9, N, m) u = pos(8, N, m) ans = s + u - t - t ans = ans % m print(ans)
p02554
s693209761
Accepted
N = int(input()) num, num2,num3 = 1, 1, 1 for _ in range(N): num = num * 10 % 1000000007 num2 = num2 * 9 % 1000000007 num3 = num3 * 8 % 1000000007 print((num - num2 * 2 + num3) % 1000000007)
p02554
s690993338
Accepted
N = int(input()) print((10**N - 2*9**N + 8**N)%1000000007)
p02554
s570274828
Accepted
n = int(input()) mod = 10 ** 9 + 7 print((pow(10, n, mod) - pow(9, n, mod) - pow(9, n, mod) + pow(8, n, mod)) % mod)
p02554
s810527803
Accepted
N=int(input()) if N==1: print(0) exit() MOD=10**9+7 ALL=pow(10,N,MOD) No0=pow(9,N,MOD) No9=pow(9,N,MOD) No09=pow(8,N,MOD) ans=ALL-No9-No0+No09+MOD print(ans%MOD)
p02554
s270413285
Accepted
N = int(input()) d = 10**9 + 7 print((10**N - 2 * (9**N) + 8**N) % d)
p02554
s972644653
Accepted
n = int(input()) mod = 10**9+7 dp = [[0]*4 for i in range(n+1)] dp[0][0] = 1 for i in range(n): dp[i+1][3] = (dp[i][3]*10 + dp[i][1] + dp[i][2]) % mod dp[i+1][2] = (dp[i][2]*9 + dp[i][0]) % mod dp[i+1][1] = (dp[i][1]*9 + dp[i][0]) % mod dp[i+1][0] = (dp[i][0]*8) % mod print(dp[n][3])
p02554
s931537508
Accepted
N=int(input()) mod=pow(10,9)+7 def pow_method(r,N): ans=1 for i in range(N): ans=ans*r%mod return ans calc=pow_method(9,N)+pow_method(9,N)-pow_method(8,N) ans=pow_method(10,N)-calc ans=ans%mod ans=(ans+mod)%mod print(ans)
p02554
s359723210
Accepted
n = int(input()) MOD = 1000000007 def mod(n): return n % MOD def modpow(a, n): #mod(a**n)を高速で求める res = 1 digit = len(str(bin(n))) - 2 for i in range(digit): if (n >> i) & 1: res *= mod(a) res = mod(res) a = mod(a**2) return mod(res) ans = modpow(10, n) ans -= 2*modpow(9, n) ans += modpow(8, n) print(mod(ans))
p02554
s205145092
Accepted
N = int(input()) ans = (10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7) print(int(ans))
p02554
s510566895
Accepted
n = int(input()) p = 10**9+7 ##0も9もない temp = pow(8, n, p) #0がない tempp = pow(9,n,p) #全体 temppp = pow(10,n,p) res = (temppp-tempp*2 + temp) % p print(res)
p02554
s065364406
Accepted
import sys, math from functools import lru_cache sys.setrecursionlimit(10**9) MOD = 10**9+7 def input(): return sys.stdin.readline()[:-1] def mi(): return map(int, input().split()) def ii(): return int(input()) def i2(n): tmp = [list(mi()) for i in range(n)] return [list(i) for i in zip(*tmp)] def main(): N = ii() ans = pow(10, N, MOD) ans -= pow(9, N, MOD) ans -= pow(9, N, MOD) ans += pow(8, N, MOD) print(ans%MOD) if __name__ == '__main__': main()
p02554
s505657049
Accepted
n=int(input()) c=10**9+7 def pow_c(x,n,c): if n == 0: return 1 K = 1 while n > 1: if n % 2 != 0: K= (K%c)*(x%c)%c x = ((x%c)**2)%c n //= 2 return (K%c) * (x%c) %c k10=pow_c(10,n,c) k9=pow_c(9,n,c) k8=pow_c(8,n,c) ans=(k10-2*k9+k8)%c print(ans)
p02554
s261409493
Accepted
n = int(input()) print((10 ** n - 2 * 9 ** n + 8 ** n) % (10 ** 9 + 7))
p02554
s999775394
Accepted
p=10**9+7 n=int(input()) print((pow(10,n,p)-2*pow(9,n,p)+pow(8,n,p))%p)
p02554
s722403062
Accepted
inf = pow(10,9)+ 7 n=int(input()) if n==1: print(0) elif n==2: print(2) else: f=pow(10,n,inf) - 2*pow(9,n,inf) + pow(8,n,inf) print(f%inf)
p02554
s234536109
Accepted
n=int(input()) mod=pow(10,9)+7 ans=pow(10,n,mod)-2*pow(9,n,mod)+pow(8,n,mod) print(ans%mod)
p02554
s466574394
Accepted
N = int(input()) MOD = 10**9 + 7 ans = pow(10, N, MOD) - 2*pow(9, N, MOD) + pow(8, N, MOD) ans %= MOD print(ans)
p02554
s025607160
Accepted
N = int(input()) ans = 10**N -( 9**N + 9**N - 8**N ) print( ans%( 10**9 + 7) )
p02554
s462250217
Accepted
# -*- coding: utf-8 -*- # C import sys from collections import defaultdict, deque from heapq import heappush, heappop import math import bisect input = sys.stdin.readline # 再起回数上限変更 # sys.setrecursionlimit(1000000) mod = 10**9 + 7 n = int(input()) ans = pow(10,n,mod) ans -= pow(9,n,mod) ans -= pow(9,n,mod) ans += pow(8,n,mod) print(ans % mod)
p02554
s645013404
Accepted
n = int(input()) mod = 10**9 + 7 if n <= 2: print((n-1)*2) else: print((10**n - 9**n - 9**n + 8**n)%mod)
p02554
s217672508
Accepted
n = int(input()) ten = 1 eight = 1 nine = 1 for i in range(n): ten *= 10 ten = ten%(10**9 + 7) eight *= 8 eight = eight%(10**9 + 7) nine *= 9 nine = nine%(10**9 + 7) print((ten+eight-(2*nine))%(10**9 + 7))
p02554
s555207949
Accepted
N = int(input()) A = 1 B = 2 C = 1 mod = 10**9+7 for i in range(N): A *= 10 A %= mod B *= 9 B %= mod C *= 8 C %= mod ans = (A-B+C)%mod print(ans)
p02554
s951076511
Accepted
n = int(input()) mod = 10**9+7 ans = pow(10,n,mod)-pow(9,n,mod)*2+pow(8,n,mod) print(ans%mod)
p02554
s664833577
Accepted
n = int(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)
p02554
s869559144
Accepted
n=int(input()) a=10**n-2*9**n+8**n print(a%(10**9+7))
p02554
s720347900
Accepted
##C - Ubiquity ##0と9が一つずつない状況 N = int(input()) print((10**N - 2*9**N + 8**N) % (10**9+7))
p02554
s048530068
Accepted
N = int(input()) mod = 10 ** 9 + 7 if N == 1: print(0) exit() def factorial(p, n): result = 1 for i in range(1, n + 1): result = result * p % mod return result ans = factorial(10, N) - 2 * factorial(9, N) + factorial(8, N) ans = ans % mod while True: if ans > 0: break ans += mod print(ans)
p02554
s305470718
Accepted
num = int(input()) mod = 10 ** 9 + 7 ans = 0 if num >= 2: temp9 = (9 ** num) % mod temp8 = (8 ** num) % mod val = (temp9 * 2 - temp8) % mod ans = (10 ** num) % mod + mod - val print(ans % mod)
p02554
s347230525
Accepted
mod = 10**9 + 7 N = int(input()) print((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod)
p02554
s238825841
Accepted
import sys N=int(sys.stdin.readline().strip()) mod=10**9+7 print (pow(10,N,mod)-(pow(9,N,mod)*2-pow(8,N,mod)))%mod
p02554
s278288493
Accepted
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))
p02554
s154602647
Accepted
n = int(input()) a = 10**9+7 def mod(i,j): ans = 1 for _ in range(j): ans = (ans*i)%a return(ans) print(((mod(10,n)-mod(9,n)*2+mod(8,n))%a))
p02554
s989108485
Accepted
N = int(input()) ans = (10 ** N - 2 * 9 ** N + 8 ** N) % (10 ** 9 + 7) print(ans)
p02554
s456332483
Accepted
n = int(input()) mod = 10**9+7 print((10**n-2*(9**n)+(8**n))%mod)
p02554
s002390742
Accepted
n=int(input()) mod=10**9+7 ans=10**n ans-=2*(9**n) ans+=8**n ans%=mod print(ans)
p02554
s323650202
Accepted
MOD = 10**9+7 n = int(input()) print((pow(10, max(n, 0), MOD) - pow(9, max(n, 0), MOD) - pow(9, max(n, 0), MOD) + pow(8, max(n, 0), MOD)) % MOD)
p02554
s785248120
Accepted
n = int(input()) # not 0, but 9 == not 9, but 0 #2 * (9 ** n - 8 ** n) # not 0,9 #8 ** n # ans = all - (not 0, but 9 + not 9, but 0) - not 0,9 print((10**n - 2 * (9 ** n - 8 ** n) - 8 ** n) % (10**9 + 7))
p02554
s507671530
Accepted
import sys # \n def input(): return sys.stdin.readline().rstrip() def main(): N = int(input()) mod = 10 ** 9 + 7 ans = pow(10,N,mod) ans -= 2 * pow(9,N,mod) ans %=mod ans += pow(8,N,mod) print(ans%mod) if __name__ == "__main__": main()
p02554
s538234141
Accepted
# -*- coding: utf-8 -*- import math N = int(input()) ans = (10**N) - 9**N - 9**N + 8**N ans = ans % ((10**9)+7) print(ans)
p02554
s767947735
Accepted
n = int(input()) mod = 10 ** 9 + 7 print((pow(10, n, mod) - pow(9, n, mod) * 2 + pow(8, n, mod)) % mod)
p02554
s985679845
Accepted
import sys N = int(input()) if N == 1: print(0) sys.exit() p= (-2*9**N+8**N+10**N) % (10**9+7) print(p)
p02554
s488167465
Accepted
N = int(input()) mod = 10**9 + 7 ans = pow(10, N, mod) ans -= 2 * pow(9, N, mod) ans += pow(8, N, mod) ans %= mod print(ans)
p02554
s007354242
Accepted
N = int(input()) mod = 10**9 + 7 if N < 2: print(0) exit() all = pow(10, N, mod) sabun = pow(9, N, mod) * 2 - pow(8, N, mod) ans = ((all % mod) - sabun) % mod print(ans)
p02554
s218022514
Accepted
# author: Taichicchi # created: 13.09.2020 21:21:37 import sys N = int(input()) MOD = (10 ** 9) + 7 ans = (10 ** N - ((9 ** N) * 2 - (8 ** N))) % MOD print(ans)
p02554
s190252882
Accepted
N=int(input()) mod=10**9+7 print((pow(10,N,mod)-pow(9,N,mod)*2+pow(8,N,mod))%mod)
p02554
s950823595
Accepted
N = int(input()) a = 0 b = 1 c = 1 d = 8 mod = 10**9 + 7 for _ in range(N-1): a = (a * 10 + b + c) % mod b = (b * 9 + d) % mod c = (c * 9 + d) % mod d = (d * 8) % mod print(a)
p02554
s536381302
Accepted
n=int(input()) a=(9**n)%(10**9+7) b=(8**n)%(10**9+7) c=(10**n)%(10**9+7) print((c-2*a+b)%(10**9+7))
p02554
s998137641
Accepted
N = int(input()) x = 10**N - 2*(9**N) + 8**N print(x % (10**9+7))
p02554
s824464632
Accepted
n=int(input()) #0を一回も使わない no_0 = 9**n #9を一回も使わない no_9 = 9**n #0と9を一回も使わない no_09 = 8**n #全体-上記集合 yes_09 = 10**n - (no_0+no_9-no_09) print(yes_09%(10**9+7))
p02554
s804451918
Accepted
N = int(input()) ans = (10**N - 2*9**N + 8**N) % (10**9 +7) print(ans)
p02554
s279436456
Accepted
#!/usr/bin/env python3 #(a^b) % (1e9 + 7)を求める def powmod(a, b): result = 1; for i in range(b): result *= a result %= 1e9 + 7 return result n = int(input()) if n == 1: print(0) elif n == 2: print(2) else: # print(10 ** n - 2 * (9 ** n) + 8 ** n) r = powmod(10, n) - 2 * powmod(9, n) + powmod(8, n) r = int(r % (1e9 + 7)) print(r)
p02554
s741396420
Accepted
N = int(input()) print((10**N-2*9**N+8**N)%1000000007)
p02554
s637195438
Accepted
N = int(input()) mod = 10**9 + 7 u = 1 a = 1 b = 1 for i in range(N): u = u * 10 a = a * 9 b = b * 8 u = u%mod a = a%mod b = b%mod print((u-2*a+b)%mod)
p02554
s425124896
Accepted
N = int(input()) MOD_BY = 10**9 + 7 a = pow(10,N,MOD_BY) b = pow(9,N,MOD_BY) c = pow(8,N,MOD_BY) ans = a - 2*b + c print(ans%MOD_BY)
p02554
s888799216
Accepted
n=int(input()) mod=10**9+7 ans=pow(10,n,mod)-(2*pow(9,n,mod)-pow(8,n,mod)) print(ans%mod)
p02554
s568815274
Accepted
n=int(input()) mod=(1e+9)+7 x=1 if n>=2: ans=1 else: ans=0 for i in range(n): x*=10 ans*=8 ans%=mod x%=mod nin=1 for i in range(n): nin*=9 nin%=mod x+=ans x%=mod x-=(nin*2)%mod if x<0: x+=mod if n==1: print(0) else: print(int(x%mod))
p02554
s928913753
Accepted
n=int(input()) ans=10**n-2*9**n+8**n print(ans%(10**9+7))
p02554
s468192170
Accepted
n = int(input()) print((10 ** n - (9 ** n + 9 ** n - 8 ** n)) % (10 ** 9 + 7))
p02554
s284343126
Accepted
#import #=input() n=int(input()) #=map(int,input().split()) #=list(map(int,input().split())) #=[list(map(int,input().split())) for _ in range()] print((10 ** n - 2 * (9 ** n) + 8 ** n) % (10 ** 9 + 7))
p02554
s041539893
Accepted
N = int(input()) mod = 10 ** 9 + 7 e = pow(8, N, mod) f = pow(9, N, mod) g = pow(10, N, mod) # 全体 - (0を含まない + 9を含まない) + 0と9どちらも含まない ans = (g - 2 * f + e) % mod print(ans)
p02554
s700512984
Accepted
N=int(input()) print((pow(10,N)-2*pow(9,N)+pow(8,N))%(pow(10,9)+7))
p02554
s416808115
Accepted
import sys import math input = sys.stdin.readline n = int(input()) print((10**n - 2*(9**n)+8**n)%((10**9)+7))
p02554
s180951526
Accepted
n=int(input()) a= pow(10,n,10**9+7) b = pow(8,n,10**9+7) c = pow(9,n,10**9+7) print((a-2*c+b)%(10**9+7))
p02554
s930891173
Accepted
import sys readline = sys.stdin.readline sys.setrecursionlimit(10**8) mod = 10**9+7 #mod = 998244353 INF = 10**18 eps = 10**-7 n = int(readline()) ans = (pow(10, n, mod) - 2*pow(9, n, mod) + pow(8, n, mod))%mod print(ans)
p02554
s423983240
Accepted
# -*- coding: utf-8 -*- import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines MOD = 10**9+7 N = int(readline()) if N == 1: print(0) sys.exit() a = pow(10,N,MOD) b = pow(9,N,MOD) c = pow(8,N,MOD) ans = ((a-b)*2%MOD - (a-c)%MOD) % MOD print(ans)
p02554
s014569386
Accepted
import sys from heapq import heappush, heappop, heapify import math from math import gcd import itertools as it from collections import deque input = sys.stdin.readline def inp(): return int(input()) def inpl(): return list(map(int, input().split())) def _dbg(o): print(o, file=sys.stderr) # --------------------------------------- N = inp() mod = 10**9 + 7 _dbg(mod) a = 1 b = 1 c = 1 for _ in range(N): a = (a * 10) % mod b = (b * 9) % mod c = (c * 8) % mod print((a - 2 * b + c) % mod)
p02554
s472181054
Accepted
N = int(input()) TEN = 1 NINE = 1 EIGHT = 1 a = 10 b = 9 c = 8 mod = 10 ** 9 + 7 for i in range(64): if N % 2: TEN *= a TEN %= mod NINE *= b NINE %= mod EIGHT *= c EIGHT %= mod N //= 2 a *= a a %= mod b *= b b %= mod c *= c c %= mod print((TEN - 2 * NINE + EIGHT + mod * 2)%mod)
p02554
s754105415
Accepted
n = int(input()) ALL = (10 ** n) % (10**9 +7) wo_0 = (9 ** n) % (10**9 +7) wo_9 = (9 ** n) % (10**9 +7) wo_0_9 = (8 ** n) % (10**9 +7) ans = (ALL - (wo_0 + wo_9 - wo_0_9)) % (10**9 +7) print(ans)
p02554
s667476593
Accepted
n = int(input()) mod = 10**9+7 ans = 10**n - 9**n*2 + 8**n print(ans % mod)
p02554
s008219918
Accepted
n = int(input()) den = int(1e9 + 7) print((10**n - 2 * 9**n + 8**n) % den)
p02554
s313619222
Accepted
n = int(input()) ans = (10**n - 2*9**n + 8**n)%(10**9 + 7) print(ans)
p02554
s354088489
Accepted
n = int(input()) mod = 10**9 + 7 print((pow(10, n, mod) - 2*pow(9, n, mod) + pow(8, n, mod)) % mod)
p02554
s141639930
Accepted
M = 10 ** 9 + 7 n = int(input()) if n <= 1: print(0) exit() nones = 8 zero = 1 nine = 1 other = 0 for x in range(1, n): other = other * 10 + zero + nine zero = zero * 9 + nones nine = nine * 9 + nones nones *= 8 other %= M zero %= M nine %= M nones %= M print(other)
p02554
s098971230
Accepted
N = int(input()) # {A:数列に0だけ存在しない集合, B:数列に9だけ存在しない集合} # 全体集合 - (A + B) + A and B ans = (10 ** N - 9 ** N * 2 + 8 ** N) % (10 ** 9 + 7) print(ans)
p02554
s773911091
Accepted
n=int(input()) x=(10**9)+7 a=pow(10,n,x)+pow(8,n,x)-2*pow(9,n,x) print(a%x)
p02554
s953619205
Accepted
#import sys #input = sys.stdin.readline Q = 10**9+7 def main(): N = int( input()) ans = pow(10, N, Q) - pow(9, N, Q)*2 + pow(8, N, Q) print( ans%Q) if __name__ == '__main__': main()
p02554
s531692130
Accepted
from sys import stdin N = int(stdin.readline()) print(((10**N)-2*(9**N)+(8**N))%(10**9 + 7))
p02554
s756221349
Accepted
n = int(input()) if n == 1: print(0) exit(0) mod = 10 ** 9 + 7 ans = pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod) ans %= mod print(ans)
p02554
s495011785
Accepted
n = int(input()) print((10**n -2*9**n +8**n) % 1000000007)
p02554
s761902638
Accepted
N = int(input()) MOD = 1_000_000_007 A = pow(10, N, MOD) - pow(9, N, MOD) AorB = pow(10, N, MOD) - pow(8, N, MOD) print( (A * 2 - AorB) % MOD if N > 1 else 0)
p02554
s039086167
Accepted
n = int(input()) m=int(1e9+7) print((pow(10,n,m)+pow(8,n,m)-2*pow(9,n,m))%m)
p02554
s524745154
Accepted
# 整数の入力 N = int(input()) print((10 ** N - 2* 9 ** N + 8 ** N) % (10 ** 9 + 7))
p02554
s734839946
Accepted
N = int(input()) ans = 10 ** N - (9 ** N + 9 ** N - 8 ** N) ans = ans % (10 ** 9 + 7) print(ans)
p02554
s137256063
Accepted
N = int(input()) ans = (10**N % (10**9+7)) - (2 * 9**N % (10**9+7)) + (8**N % (10**9+7)) if ans < 0: ans += 10**9 + 7 print(ans)
p02554
s249529514
Accepted
N = int(input()) f = 10**9 + 7 e = n = t = 1 for i in range(N): e = (e * 8) % f n = (n * 9) % f t = (t * 10) % f ans = (t - 2*n + e) % f print(ans)
p02554
s158994194
Accepted
N = int(input()) if N == 1: print(0) elif N == 2: print(2) else: a = 10 ** N % (10 **9 + 7) m = (9 ** N) * 2 % (10 **9 + 7) - (8 ** N) % (10 **9 + 7) ans = (a - m ) % (10 **9 + 7) print(ans)
p02554
s952872485
Accepted
n = int(input()) mod = 10**9 + 7 a = (10**n + 8**n - 2*9**n) print(a%mod)
p02554
s244924148
Accepted
n = int(input()) w = 1000000007 if(n == 1): print(0) exit() if(n == 2): print(2) exit() ans1 = 1 for i in range(n): ans1 = ans1*10%w ans2 = 2 for i in range(n): ans2 = ans2*9%w ans3 = 1 for i in range(n): ans3 = ans3*8%w ans = ans1-ans2+ans3 ans %= w ans += w ans %= w print(ans)
p02554
s196048080
Accepted
N = int(input()) M = 1000000007 t, t1, t2 = 1, 1, 1 for _ in range(N): t, t1, t2 = t*10, t1*9, t2*8 t, t1, t2 = t%M, t1%M, t2%M print((t - t1*2 + t2) % M)
p02554
s811271694
Accepted
n = int(input()) mod = 10**9+7 print((10**n-9**n-9**n+8**n)%mod if n >= 2 else 0)