problem_id
stringlengths
6
6
user_id
stringlengths
10
10
time_limit
float64
1k
8k
memory_limit
float64
262k
1.05M
problem_description
stringlengths
48
1.55k
codes
stringlengths
35
98.9k
status
stringlengths
28
1.7k
submission_ids
stringlengths
28
1.41k
memories
stringlengths
13
808
cpu_times
stringlengths
11
610
code_sizes
stringlengths
7
505
p02768
u227085629
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\nm = 10**9+7\n\ndef nCr(n_, r_, m_):\n c = min(r_ , n_ - r_)\n bunshi = 1\n bunbo = 1\n for i in range(1,c+1):\n bunshi = bunchi * (n_+1-i) % m_\n bunbo = bunbo * i % m_\n return bunshi * pow(bunbo, m_-2, m_) % m_\n\n\nans = pow(2,n,m)-1\nans -= nCr(n,a,m)\nans %= m\nans -=...
['Runtime Error', 'Accepted']
['s040761094', 's181387960']
[3064.0, 3064.0]
[17.0, 142.0]
[333, 333]
p02768
u230621983
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int, input().split())\n\nmod = 1000000007\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = n\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] *...
['Time Limit Exceeded', 'Accepted']
['s665898645', 's519643817']
[217384.0, 3064.0]
[2120.0, 109.0]
[556, 289]
p02768
u232873434
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import numpy as np\nn, a, b = map(int, input().split())\n\n\ndef cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n - r] % p\n\n\np = 10 ** 9 + 7\nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1]\n\nfor i in range(2, n + 1):\n fact.append((f...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s266347348', 's462792128', 's573963817', 's062195117']
[220644.0, 200512.0, 20732.0, 16812.0]
[2122.0, 2106.0, 287.0, 395.0]
[452, 562, 195, 384]
p02768
u242196904
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod = 5 #int(1e9) + 7\nn, a, b = map(int, input().split())\n\ndef aaa(base, n):\n# base = 2\n ans = 1\n nn = n\n while True:\n # print(base, nn)\n if nn == 0:\n break\n if nn % 2 == 0:\n base = base ** 2\n base = base % mod\n nn /= 2\n ...
['Wrong Answer', 'Accepted']
['s507088631', 's490183426']
[3064.0, 3064.0]
[70.0, 145.0]
[1147, 1386]
p02768
u243312682
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
["def main():\n n, a, b = map(int, input().split())\n mod = 10 ** 9 + 7 \n \n def modpow(x, n, mod):\n res = 1\n while n:\n if n % 2:\n res *= x % mod\n x *= x % mod\n n >>= 1\n return res\n \n def cmb(n, r, mod):\n \n ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s483019731', 's665338488', 's670767989']
[9692.0, 8792.0, 9204.0]
[2205.0, 24.0, 102.0]
[773, 754, 775]
p02768
u243714267
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def powerDX(n, r, mod):\n if r == 0: return 1\n if r%2 == 0:\n return powerDX(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * powerDX(n, r-1, mod) % mod\n \ndef combination(n, r, mod=10**9+7):\n n1, r = n+1, min(r, n-r)\n numer = denom = 1\n for i in range(1, r+1):\n numer = numer * (...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s016678089', 's210997413', 's728784351', 's997610599']
[3064.0, 3064.0, 3064.0, 3064.0]
[20.0, 17.0, 18.0, 130.0]
[526, 522, 528, 568]
p02768
u252828980
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['N,A,B=map(int,input().split())\nMOD=10**9+7\n\ndef comb(n,r):\n\tif n<r:\n\t\treturn 0\n\tl = min(r,n-r)\n\tm=n\n\tu=1\n\tfor _i in range(l):\n\t\tu*=m\n\t\tm-=1\n\treturn u//fact(l)\n \nprint((pow(2,N,MOD)-1-comb(N,A)-comb(N,B))%MOD)\n', 'a,b,c = map(int,input().split())\nMOD = 10**9+7\n\ndef comb(n,r):\n res = ...
['Runtime Error', 'Accepted']
['s724518213', 's712988229']
[3620.0, 3188.0]
[2104.0, 157.0]
[235, 301]
p02768
u257018224
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b =map(int, input().split())\nc=2**n-1\nimport math\nc=c-math.factorial(n-a+1) // math.factorial(a)-math.factorial(n-b+1) // math.factorial(b)\nprint(c%(10**9+7))', 'n,a,b=map(int,input().split())\n\ndef combination(n,x,mod):\n bunbo=1\n bunshi=1\n for i in range(x):\n bunbo*=n-i\n bunshi*...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s047580432', 's409719078', 's857216255']
[199264.0, 199376.0, 3064.0]
[2106.0, 2106.0, 149.0]
[163, 345, 416]
p02768
u257265865
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from operator import mul\nfrom functools import reduce\nn,a,b=map(int,input(),split())\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nx=cmb(n,a)+cmb(n,b)\ny=pow(2,n)-1\nans=(y-x%(10**9+7))\n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s009139655', 's934979984', 's943912306']
[3572.0, 2940.0, 3188.0]
[23.0, 17.0, 1516.0]
[315, 495, 347]
p02768
u258933429
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\n\ndef choose(x, y, m):\n v = 1\n for i in range(0, y):\n\n v = (v * (x - i) * pow(i + 1, m - 2, m)) % m\n\n return v\n\n\nm = 10**9 + 7\nprint((pow(2, n, m) - choose(n, a, m) - choose(n, b, m)) % m)\n', 'n, a, b = map(int, input().split())\nm = 10**9 + 7\n\n\ndef...
['Wrong Answer', 'Accepted']
['s204881047', 's383824695']
[3060.0, 3060.0]
[1511.0, 1533.0]
[241, 234]
p02768
u259755734
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
[' import sys\n\nstdin = sys.stdin\n\nni = lambda: int(ns())\nns = lambda: stdin.readline().rstrip()\nna = lambda: list(map(int, stdin.readline().split()))\n\n# code here\nn, a, b = na()\nmod = 1000000007\n\ndef c(n, r):\n nu = 1\n de = 1\n for i in range(r):\n \n nu = nu * (n - i) % mod\n ...
['Runtime Error', 'Accepted']
['s996147964', 's325065985']
[2940.0, 3064.0]
[17.0, 152.0]
[504, 502]
p02768
u265506056
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['N,A,B=map(int,input().split())\nMOD=10**9+7\n\ndef calculate_combination(n,k):\n x,y=1,1\n for i in range(k):\n x=x*(n-i)%MOD\n y=y*(k-1)%MOD\n return x*pow(y,MOD-2,MOD)%MOD\n\nans=pow(2,N,MOD)-1-calculate_combination(N,A)-calculate_combination(N,B)\nwhile ans<0:\n ans+=MOD\nprint(ans)', 'N,...
['Wrong Answer', 'Accepted']
['s336300978', 's632206639']
[3064.0, 3064.0]
[147.0, 142.0]
[299, 299]
p02768
u272336707
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['N, A, B = map(int, input().split())\nmo = 10 ** 9 + 7\ndef hanaya(n, x):\n if x == 1:\n return n\n else:\n return ((hanaya(n, x-1))*((n-x+1)/x))%mo\n\nans = (pow(2, N) - 1 ) % mo\nprint(int(ans))', 'N, A, B = map(int, input().split())\nmo = 1000000007\nA_val = 1\nfor i in range(A):\n A_val = ((...
['Wrong Answer', 'Accepted']
['s707681633', 's956497448']
[199376.0, 3064.0]
[2106.0, 1568.0]
[206, 288]
p02768
u274635633
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b=map(int,input().split())\nm=10**9+7\n\n\n\n\n\n\ndef gyakugen( a, m ):\n b = m\n x, y = 1, 0\n while b>0:\n q = a // b\n a, b = b, a-q*b\n x, y = y, x-q*y\n return x if x>0 else x+m\n\n\nimport sys\nsys.setrecursionlimit(10**9)\n\ndef perm_remainder(n,r,m):\n if r>=1:\n return (perm_remai...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s391741106', 's606095787', 's785457432', 's894279272', 's365538958']
[181236.0, 3064.0, 199340.0, 199348.0, 181236.0]
[882.0, 2104.0, 2106.0, 2106.0, 883.0]
[1218, 605, 203, 201, 1222]
p02768
u277104886
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\nMOD = 10**9 + 7\nN = pow(2,n,MOD)\n\ndef com(n,r):\n s = 1\n for i in range(n-r+1, n+1):\n s *= i\n s %= MOD\n\n t = 1\n for j in range(1,r+1):\n t *= j\n t %= MOD\n\n\n return s * pow(t,MOD-2, MOD) % MOD\n\nprint((N - com(n, a) - com(n...
['Wrong Answer', 'Accepted']
['s133664643', 's553898959']
[9080.0, 9192.0]
[110.0, 115.0]
[313, 317]
p02768
u277312083
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from scipy.misc import comb\nn, a, b = map(int, input().split())\nans = 1\nif n % 2 == 0:\n nn = n\nelse:\n nn = n + 1\nfor k in range(1, nn // 2):\n ans += 2 * comb(n, k, exact = True)\nif n % 2 == 0:\n ans += comb(n, n // 2, exact = True)\nans -= comb(n, a, exact = True) + comb(n, b, exact = True)\nprin...
['Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s853423673', 's927178908', 's350197968']
[15280.0, 15268.0, 9200.0]
[2108.0, 2109.0, 1250.0]
[326, 226, 372]
p02768
u282574080
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = list(map(int,input().split(" ")))\nmod = 10**9 + 7\n\ndef cmb(n, r):\n if n - r < r: r = n - r\n if r == 0: return 1\n if r == 1: return n\n\n numerator = [n - r + k + 1 for k in range(r)]\n denominator = [k + 1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p - 1...
['Runtime Error', 'Accepted']
['s300641560', 's039708036']
[3064.0, 27700.0]
[17.0, 681.0]
[877, 873]
p02768
u284363684
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# input\nn, a, b = map(int, input().split())\nmod = 0 ** 9 + 7\n\n\n\ndef fur(n, r):\n p, q = 1, 1\n for i in range(r):\n p = p * (n - i) % mod\n q = q * (i + 1) % mod\n return p * pow(q, mod - 2, mod) % mod\n\n\nnca = fur(n, a)\nncb = fur(n, b)\nans = ((pow(2, n, mod) - 1) - nca - ncb) % mod\n...
['Wrong Answer', 'Accepted']
['s485065261', 's605235758']
[3064.0, 3064.0]
[94.0, 153.0]
[434, 443]
p02768
u288430479
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\nmod = 10**9+7\n\ndef comb(N,x):\n numerator = 1\n for i in range(N-x+1,N+1):\n numerator = numerator *i%mod\n denominator = 1\n for j in range(1,x+1):\n denominator = denominator *i%mod\n d = pow(denominator,mod-2,mod)\n return (numerator*d)%mod\nal = pow(2,n,mod)-1\nac =...
['Wrong Answer', 'Accepted']
['s325270576', 's395816613']
[3064.0, 3064.0]
[118.0, 117.0]
[350, 350]
p02768
u305366205
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\n\ndef pow_k(x, n):\n \n if n == 0:\n return 1\n\n K = 1\n while n > 1:\n if n % 2 != 0:\n K *= x\n x *= x\n n //= 2\n\n return K * x\n\n\ntotal = pow_k(2, n) - 1\n\nnow = 1\ndiv = 1\nans = 0\nfor i in range(max(a, b) + 1):\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s377641319', 's704386750', 's810118980']
[236288.0, 3476.0, 3188.0]
[2107.0, 2104.0, 435.0]
[452, 231, 1938]
p02768
u306950978
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod = 1000000007\n\ndef mul(a, b):\n return ((a % mod) * (b % mod)) % mod\n\ndef power(s, t):\n if t == 0 : return 1\n elif t == 1 : return x % mod\n elif t % 2 == 0 : return power(s, t/2)**2 % mod\n else : return power(s, t/2)**2 * x % mod\n\ndef div(a, b):\n return mul(a, powe...
['Runtime Error', 'Accepted']
['s333874910', 's808570815']
[3936.0, 3064.0]
[78.0, 150.0]
[632, 372]
p02768
u314089899
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['#156d\nn,a,b = map(int, input().split())\n\n##############################################\n#https://tane-no-blog.com/976/\nmod = pow(10, 9) + 7\n \ndef comb(N, x):\n \n numerator = 1\n for i in range(N-x+1, N+1):\n numerator = numerator * i % mod\n \n \n denominator = 1\n for j in range(1...
['Runtime Error', 'Accepted']
['s169368818', 's114024768']
[3064.0, 3064.0]
[17.0, 116.0]
[704, 698]
p02768
u318740143
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\ninf = 10**9 +7\nans = pow(2,n,inf)-1\ndef conbi(n,k):\n if n-k < k:\n k = n-k\n x = 1\n y = 1\n for i in range(k):\n x *= n-i\n x = x%inf\n y *= i+1\n y = y%inf\n ans1 = x* pow(y,inf-2,inf)%inf\n return ans1\nprint(conbi(n,a))\nsol = ans - conbi(n,a)- conbi(n,b...
['Runtime Error', 'Accepted']
['s016285673', 's009209854']
[3064.0, 3064.0]
[2103.0, 153.0]
[320, 305]
p02768
u333700164
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b=map(int,input().split())\nmod=10**9+7\ndef comb(n,k,mod):\n if k>n-k:\n k=n-k\n c=1\n for i in range(n-k+1,n+1):\n c*=i\n c%=mod\n d=1 \n for i in range(1,k+1):\n d*=i\n d%=mod\n return (c*pow(d,mod-2,mod))%mod\n\nans=pow(2,n,mod)-comb(n,a,mod)-comb(n,b,mod)\nprint(ans%mod)\n', 'n,a,b=map(...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s050154364', 's734981622', 's982802194']
[9160.0, 9020.0, 9100.0]
[110.0, 25.0, 112.0]
[287, 280, 289]
p02768
u342563578
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\ndef kai(g):\n p = 1 \n for i in range(1,g+1):\n p = p*i\n return p\ndef comb(n,k):\n return kai(n)/(kai(k)*kai(n-k))\nprint(2**n-1-comb(n,a)-comb(n,b))\n', 'n,a,b = map(int,input().split())\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min...
['Wrong Answer', 'Time Limit Exceeded', 'Accepted']
['s560202298', 's807235593', 's645427998']
[199380.0, 224704.0, 3064.0]
[2106.0, 2118.0, 126.0]
[197, 602, 388]
p02768
u346308892
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['\ndef acinput():\n return list(map(int, input().split(" ")))\n\n\ndef II():\n return int(input())\n\ndirections=np.array([[1,0],[0,1],[-1,0],[0,-1]])\ndirections = list(map(np.array, directions))\n\nmod = 10**9+7\n\n\ndef factorial(n):\n fact = 1\n for integer in range(1, n + 1):\n fact *= integer\...
['Runtime Error', 'Accepted']
['s892298953', 's079607434']
[3192.0, 3572.0]
[18.0, 1516.0]
[1709, 1682]
p02768
u361381049
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\nans = 2 ** n -1\nval = 1\nfor i in range(a):\n val *= (n-i) / (i+1)\nans -= val\nval = 1\nfor i in range(b):\n val *= (n-i) / (i+1)\nans -= val\nprint(int(ans % int(1e9) + 7))', 'n, a, b = map(int, input().split())\nm = int(1e9) + 7\nans = (pow(2, n, m) -1) % m\nval = 1\nval...
['Runtime Error', 'Accepted']
['s579118463', 's110914630']
[199392.0, 3064.0]
[2108.0, 195.0]
[208, 443]
p02768
u370721525
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\nans = 0\n\nif n > 0:\n temp = 1\n for i in range(n):\n if i!=a and i!=b:\n temp = temp * (n-i) / (i+1)\n ans += temp\n \nans = ans % (10**9+7)\nprint(ans)', 'import math\nn, a, b = map(int, input().split())\nmod = 10**9 + 7\n\nans = pow(2, n, mod) - 1\n\nx = 1\...
['Wrong Answer', 'Accepted']
['s448948993', 's222866986']
[9168.0, 9208.0]
[2206.0, 178.0]
[200, 322]
p02768
u371763408
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int,input().split())\nmod = 10**9+7\ntotal = pow(2, n, mod) - 1\nprint(total)\ndef c(n, r):\n p, q = 1, 1\n for i in range(r):\n p *= (n-i)%mod\n q *= (i+1)%mod\n return p * pow(q, mod-2, mod)%mod\n\nprint((total - c(n, a) - c(n, b))%mod)', 'n, a, b = map(int,input().split())\nmod...
['Wrong Answer', 'Accepted']
['s952338062', 's759723088']
[3604.0, 3064.0]
[2104.0, 150.0]
[264, 253]
p02768
u374082254
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\nmmod = 10**9 + 7\n\n\ndef comb_mod(n, r, mod=mmod):\n nume = 1\n deno = 1\n\n r = min(r, r - 1)\n\n for i in range(1, r + 1):\n nume = (nume * (n + 1 - i)) % mod\n deno = (deno * i) % mod\n\n return (nume * pow(deno, mod - 2, mod)) % mod\n\n\nif n ==...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s264058823', 's722775902', 's432680592']
[3064.0, 3064.0, 3064.0]
[141.0, 144.0, 141.0]
[412, 414, 418]
p02768
u382407432
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from functools import reduce\ndef cmb(n,r):\n numerator = reduce(lambda x, y: x * y % mod, [n - r + k + 1 for k in range(r)])\n denominator = reduce(lambda x, y: x * y % mod, [k + 1 for k in range(r)])\n return numerator * pow(denominator, mod - 2, mod) % mod\n\nans=0\nn,a,b = map(int,(input().split()))\n\n#...
['Runtime Error', 'Runtime Error', 'Accepted']
['s518553977', 's715094022', 's828313881']
[3572.0, 11556.0, 11556.0]
[24.0, 50.0, 233.0]
[398, 398, 378]
p02768
u385244248
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import sys\nimport math\nimport fractions\nimport itertools\nfrom collections import deque\nimport copy\nimport bisect\n\nMOD = 10 ** 9 + 7\nINF = 10 ** 18 + 7\ninput = lambda: sys.stdin.readline().strip()\n\n\ndef inv_mod(a, N):\n \n\n def extgcd(a, b):\n \n d = fractions.gcd(a, b)\n if b ...
['Time Limit Exceeded', 'Accepted']
['s854012115', 's536636495']
[11732.0, 13116.0]
[2104.0, 359.0]
[1475, 1697]
p02768
u409542115
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod = (10 ** 9 + 7)\n\ndef comb(n, r):\n p, q = 1, 1\n\n for i in range(r):\n p = p *(n-i)%mod\n q = q *(i+1)%mod\n\n return (p / q) % mod\n\nn, a, b = list(map(int, input().split()))\n\ns = pow(2, n, mod) - 1\n\nprint((s - comb(n, a) - comb(n, b)) % mod)', '\nmod = (10 ** 9 + 7)\n\ndef comb(n,...
['Wrong Answer', 'Accepted']
['s489583394', 's024320312']
[3188.0, 3064.0]
[153.0, 149.0]
[263, 284]
p02768
u417365712
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def cmb(n, r, mod):\n c=1\n for i in range(1, r+1):\n c = (c * (n-i+1) * pow(i, mod-2, mod)) % mod\n return c\n\nn, a, b = map(int, inputs[0]().split())\nMOD = 10**9 + 7\nprint((pow(2, n, MOD) - cmb(n, a, MOD) - cmb(n, b, MOD) - 1) % MOD)', "class Factorial():\n def __init__(self, mod=10**9 + 7):\n...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s357672678', 's587861530', 's819501585']
[3060.0, 24596.0, 9292.0]
[17.0, 1242.0, 1122.0]
[246, 2515, 2513]
p02768
u426649993
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def modpow(a, n, p):\n if n == 0:\n return 1\n elif n == 1:\n return a % p\n if n % 2 == 1:\n return (a * modpow(a, n-1, p)) % p\n tmp = modpow(a, n//2, p)\n return (tmp * tmp) % p\n\n\ndef modfactrial(a, p):\n ret = 1\n for i in (a, 1, -1):\n ret = ret * i % p\n re...
['Wrong Answer', 'Accepted']
['s278518816', 's077627241']
[3064.0, 3064.0]
[81.0, 127.0]
[1073, 1078]
p02768
u428316812
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = list(map(int,input().split()))\nmod = 10**9 + 7\nans = (pow(2,n,mod) - 1\nnumerator = 1\ndenominator = 1\n\nfor i in range(1,n+1):\n numerator = (numerator*(n-i+1))%mod\n denominator = (denominator*i)%mod\n if i == a or i == b:\n ans = ans - (numerator*pow(denominator,mod-2,mod))%mod\n ...
['Runtime Error', 'Accepted']
['s634448912', 's785487165']
[2940.0, 3064.0]
[17.0, 119.0]
[351, 350]
p02768
u437215432
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# ABC156D\n\nimport numpy as np\ndef f(n, x):\n mean = np.mean(x)\n s1 = sum((x-np.floor(mean))**2)\n s2 = sum((x-np.ceil(mean))**2)\n print(int(min(s1, s2)))\n\nn = int(input())\nx = list(map(int, input().split()))\nf(n, x)\n', 'from functools import reduce\ndef comb(n, r, mod=10 ** 9 + 7):\n numerat...
['Runtime Error', 'Accepted']
['s330368005', 's105059686']
[27048.0, 11556.0]
[107.0, 226.0]
[227, 408]
p02768
u440161695
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod=10**9+7\nl,a,b=map(int,input().split())\ndef C(n,k,m):\n for i in range(1,k):\n n*=(n-i)%m\n k*=(k-i)%m\n return n*pow(k,m-2,m)\n\nans=pow(2,l,mod)\nca=C(l,a,mod)\nprint(ca)\ncb=C(l,b,mod)\nprint(cb)\nprint((ans-ca-cb)%mod)', 'mod=10**9+7\nl,a,b=map(int,input().split())\ndef C(n,k,m):\n g=k\n f=n\n for...
['Wrong Answer', 'Accepted']
['s259671981', 's258999534']
[3316.0, 3064.0]
[2104.0, 133.0]
[222, 221]
p02768
u442877951
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod = 10**9 + 7\ndef cmb(n,r,mod):\n\ta=1\n\tb=1\n\tr = min(r,n-r)\n\tfor i in range(r):\n\t\ta = a*(n-i)%mod\n\t\tb = b*(i+1)%mod\n\treturn a*pow(b,mod-2,mod)%mod\n\nn,a,b = map(int,input().split())\ncount = 0\nall = pow(2,n,mod) - 1\nnCa = cmb(n,a,mod)\nnCb = cmb(n,b,mod)\nans = all - (nCa + nCb) + mod\nprint(ans)'...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s617419569', 's817122944', 's389382531']
[3064.0, 216772.0, 3064.0]
[142.0, 2121.0, 147.0]
[292, 591, 286]
p02768
u452512115
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def ncr(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\nN, a, b = map(int, input().split())\np = 10 ** 9 + 7\n"N = 10 ** 6 \nfact = [1, 1]\nfactinv = [1, 1]\ninv = [0, 1]\n \nfor i in range(2, N + 1):\n fact.append((fact[-1] * i...
['Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s858931350', 's903936629', 's368691934']
[219660.0, 3064.0, 3064.0]
[2119.0, 17.0, 109.0]
[510, 300, 303]
p02768
u459798349
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['\nn,a,b=map(int,input().split())\nmod=10**9+7\n\n\nP = 10**9 + 7\nN = 200001\ninv_t = [0]+[1]\nfor i in range(2,N):\n inv_t += [inv_t[P % i] * (P - int(P / i)) % P]\n\ndef power_func(a,n,p):\n bi=str(format(n,"b"))\n res=1\n for i in range(len(bi)):\n res=(res*res) %p\n if bi[i]=="1":\n res=(res*a) %p\...
['Wrong Answer', 'Accepted']
['s294194520', 's235183045']
[11052.0, 11052.0]
[283.0, 308.0]
[557, 559]
p02768
u461454424
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['#input\nn, a, b = map(int, input().split())\n\n#output\nmod = 10**9 + 7\n\nn_ = 10**9 + 1\nfun = [1]*(n_+1)\nfor i in range(1,n_+1):\n fun[i] = fun[i-1]*i%mod\nrev = [1]*(n_+1)\nrev[n_] = pow(fun[n_],mod-2,mod)\nfor i in range(n_-1,0,-1):\n rev[i] = rev[i+1]*(i+1)%mod\ndef cmb(n,r):\n if n <= 0 or r < 0 or r...
['Runtime Error', 'Runtime Error', 'Accepted']
['s291343873', 's419621991', 's437512250']
[3064.0, 3064.0, 3064.0]
[17.0, 17.0, 156.0]
[422, 437, 384]
p02768
u476124554
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\n\n\nwa = pow(2, n, 10 ** 9 + 7) - 1\n\n\n#val1 = comb(n, a, exact=True)\n#val2 = comb(n, b, exact = True)\n\nx = 1\ny = 1\nfor i in range(a):\n x = (x * (n-i)) % (10 ** 9 + 7)\n y = (y * (i+1)) % (10 ** 9 + 7)\nval1 = (x * pow(y, 10 ** 9 + 7 - 2, 10 ** 9 + 7)) % (10 ** 9 + 7)\n...
['Runtime Error', 'Accepted']
['s769495449', 's742805631']
[3064.0, 3064.0]
[17.0, 170.0]
[633, 641]
p02768
u485979475
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from operator import mul\nfrom functools import reduce\n\nn,a,b=map(int,input().split())\n\nso=10**9+7\n\nlarge=(pow(2,n,so))\n\ndef kumiawase(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1)) % so\n under = reduce(mul, range(1,r + 1))\n \n return over * pow(unde...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s221230266', 's360245905', 's687406910', 's819011270']
[4248.0, 2940.0, 8236.0, 6032.0]
[2107.0, 17.0, 2104.0, 1510.0]
[417, 330, 378, 397]
p02768
u490489966
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['#D\nn, a, b = map(int, input().split())\nmod = pow(10, 9) + 7\n\n\ndef comb(n, x):\n numerator = 1\n for i in range(n, n - x, -1):\n numerator = numerator * i % mod\n\n denominator = 1\n for j in range(x, 1, -1):\n denominator = denominator * j % mod\n\n d = denominator ** mod - 2 % mod\n...
['Time Limit Exceeded', 'Accepted']
['s538955255', 's045096824']
[165772.0, 3064.0]
[2108.0, 119.0]
[599, 401]
p02768
u497952650
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def combination(n,r,mod=10**9+7):\n n1 = n+1\n r = min(r,n-r)\n numer = denom = 1\n for i in range(1,r+1):\n numer = numer * (n1-i) % mod\n denom = denom * i % mod\n return numer * pow(denom,mod-2,mod) % mod\n \ndef power_func(a,n,p):\n bi=str(format(n,"b"))\n res=1\n for i in ra...
['Wrong Answer', 'Accepted']
['s009142038', 's811478436']
[3064.0, 3064.0]
[132.0, 130.0]
[572, 382]
p02768
u506858457
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from scipy.misc import comb\nN,a,b=map(int,input().split())\nMOD=10**9+7\ncnt=0\nfor i in range(1,N+1):\n cnt+=comb(N, i, exact=True)\nA=comb(N, a, exact=True)\nB=comb(N, b, exact=True)\ncnt=cnt-A-B\nans=cnt%MOD\nprint(ans)', 'def MI(): return map(int, input().split())\nMOD=10**9+7\ndef nCr(n,k):\n tmp=1\n for i i...
['Time Limit Exceeded', 'Accepted']
['s779004912', 's724608456']
[15276.0, 9204.0]
[2112.0, 1218.0]
[214, 269]
p02768
u507613674
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from collections import defaultdict\nfrom collections import deque\nfrom string import ascii_uppercase\nimport sys, bisect, math, heapq\n\nstdin = sys.stdin\nread_int = lambda : list(map(int,stdin.readline().split()))\nread_str = lambda : stdin.readline().rstrip()\n\nn, a, b = read_int()\nM = pow(10, 9) + 7\n\ncomk =...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s448269899', 's705503676', 's976723914', 's438661245']
[9976.0, 10864.0, 9368.0, 181236.0]
[132.0, 245.0, 107.0, 888.0]
[565, 418, 402, 459]
p02768
u519078363
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def modinv(a, mod=10**9+7):\n return pow(a, mod-2, mod)\n\ndef comb(n, r, mod=10**9+7):\n r = min(r, n-r)\n res = 1\n for i in range(r):\n res = res * (n - i) * modinv(i+1, mod) % mod\n return res\n\nn, a, b = list(map(int, input().split()))\n# print(int((2 ** n % (10**9+7)) - 1 - comb(n, a) - c...
['Wrong Answer', 'Accepted']
['s432264476', 's536403792']
[3064.0, 3064.0]
[1550.0, 1551.0]
[409, 340]
p02768
u532966492
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def main():\n import numpy as np\n n, a, b = map(int, input().split())\n mod = 10**9+7\n\n def cumprod(vector, mod=10**9+7):\n a, n = np.array(vector, dtype=np.int64), len(vector)\n nsq = int((n-1)**0.5)+1\n a.resize(nsq, nsq)\n for i in range(1, nsq):\n a[:, i] *= a...
['Wrong Answer', 'Accepted']
['s731317514', 's079312630']
[26088.0, 3064.0]
[268.0, 1506.0]
[715, 377]
p02768
u545666277
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# -*- coding: utf-8 -*-\n \nimport math\nimport itertools\nimport sys\nimport copy\n#import numpy as np\n \n\n#A, B, C, D = map(int, input().split())\n#L = list(map(int, input().split()))\n#S = list(str(input()))\n#N = int(input())\n#S = str(input())\n \nMOD = pow(10, 9) + 7\nn, a, b = map(int, input().split())\n\n#...
['Wrong Answer', 'Accepted']
['s685155920', 's640531526']
[7540.0, 19444.0]
[62.0, 185.0]
[1023, 1197]
p02768
u547608423
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import math\nn,a,b=map(int,input().split())\n\ncount=0\n\ndef C(n,a):\n x=1\n y=1\n for i in range(a):\n x*=n-i\n y*=i+1\n return x/y\n\ncount+=pow(2,n-1)\ncount-=1\ncount-=C(n,a)\ncount-=C(n,b)\n\nprint(count%(10**9+7))', 'import math\nn,a,b=map(int,input().split())\n\ncount=0\n\ndef C(n,a)...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s177784283', 's903185846', 's462946599']
[200900.0, 199348.0, 3064.0]
[2107.0, 2106.0, 160.0]
[228, 252, 325]
p02768
u548545174
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nMDO = 10 ** 9 + 7\n\ntotal = 2 ** n - 1\nans = total - combinations_count(n, a) - combinations_count(n, b)\nprint(ans % MOD)\n\n', 'from functools import ...
['Runtime Error', 'Accepted']
['s977995512', 's138206164']
[199348.0, 3572.0]
[2107.0, 157.0]
[279, 412]
p02768
u549278479
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def factorial_mod(a, M):\n ans = 1\n for i in range(a,1,-1):\n ans = (ans * i) % M\n return ans\ndef test(n, a, M):\n ans = 1\n for i in range(a):\n ans = (ans * (n-i)) % M\n return ans\ndef combination_mod(n,a,M):\n tmp = factorial_mod(a,M)\n tmp = pow(tmp, M-2, M)\n ans = te...
['Runtime Error', 'Accepted']
['s171972335', 's266002151']
[3064.0, 3064.0]
[17.0, 125.0]
[527, 603]
p02768
u555199741
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
["MOD = 1000000007\n\nn, a, b = map(int, input().split())\n\n# https://tex2e.github.io/blog/crypto/modular-mul-inverse\ndef xgcd(a, b):\n\tx0, y0, x1, y1 = 1, 0, 0, 1\n\twhile b != 0:\n\t\tq, a, b = a // b, b, a % b\n\t\tx0, x1 = x1, x0 - q * x1\n\t\ty0, y1 = y1, y0 - q * y1\n\treturn a, x0, y0\n\n# https://tex2e.githu...
['Runtime Error', 'Accepted']
['s969729801', 's111051552']
[3064.0, 3064.0]
[17.0, 1590.0]
[748, 747]
p02768
u555291433
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['#!/usr/bin/env python\n\nn, a, b = (int(val) for val in input().split())\n\n\nans = 1\nnoa = 1\nnob = 1\nmod = 1000000007\nkaijo = 1\nfor i in range(n):\n ans *= 2\n ans %= mod\n if i < a:\n noa *= (n - i)\n noa %= mod\n if i == a - 1:\n noa /= kaijo\n if i < b:\n kaijo *= i...
['Wrong Answer', 'Accepted']
['s355927444', 's533238555']
[3064.0, 3188.0]
[2104.0, 157.0]
[506, 592]
p02768
u556751939
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\nnca = len(list(itertools.combinations(range(n), a)))\nncb = len(list(itertools.combinations(range(n), b)))\n# answer = 2**n - 1 - nca - ncb\n# print(answer % (10**9 + 7))\nprint((2**n - 1 - nca - ncb) % (10**9 + 7))\n', 'mod = int(1e9 + 7)\ndef cmb(n, r):\n if n - r < r: r = n ...
['Runtime Error', 'Accepted']
['s373741623', 's568559913']
[2940.0, 27700.0]
[17.0, 1024.0]
[248, 908]
p02768
u572012241
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\nans = 1\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % ...
['Runtime Error', 'Accepted']
['s679897028', 's919101742']
[4340.0, 3064.0]
[29.0, 154.0]
[617, 492]
p02768
u580697892
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# coding: utf-8\ndef modcomb(n, r, mod):\n "nCr = X/Yとおく"\n r = min(r, n - r)\n X, Y = 1, 1\n # a, b, c = 1, 1, 1\n for i in range(1, n + 1):\n X = X * (n + 1 - i) % mod\n Y = Y * i % mod\n a = a * i % mod\n for i in range(1, r + 1):\n b = b * i % mod\n c = c * (n ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s316367783', 's888301125', 's184087212']
[3064.0, 3064.0, 3064.0]
[20.0, 2104.0, 140.0]
[589, 590, 442]
p02768
u591143370
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
["import math\nfrom operator import mul\nfrom functools import reduce\nn, a, b = map(int, input().split())\ns=0\nmod = pow(10, 9) + 7\ndef combinations_count(n, r):\n #return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n ...
['Runtime Error', 'Accepted']
['s602361559', 's926359920']
[3060.0, 3064.0]
[17.0, 116.0]
[501, 434]
p02768
u592035627
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['M,A,B = [int(x) for x in input().split()]\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 200000\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % ...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s154900758', 's166537616', 's617555695']
[27092.0, 227132.0, 3064.0]
[275.0, 2118.0, 1528.0]
[866, 643, 574]
p02768
u595952233
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
["n, a, b = map(int, input().split())\nmod = 10**9+7\nans = pow(2, n, mod)-1\n\nmodp = mod \nmax_r = 10 ** 7 \nfactinv = [1, 1] + [0]*max_r # factinv[n] = ((n!)^(-1) mod modp)\ninv = [0, 1] + [0]*max_r \n\nfact = {}\n\ndef cmb(n, r, p):\n assert n < p, 'n is less than modp'\n ...
['Time Limit Exceeded', 'Accepted']
['s898352932', 's218861369']
[338572.0, 9196.0]
[2217.0, 104.0]
[909, 452]
p02768
u607075479
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import sys\nimport math\nfrom collections import deque\n\nsys.setrecursionlimit(1000000)\nMOD = 10 ** 9 + 7\ninput = lambda: sys.stdin.readline().strip()\nNI = lambda: int(input())\nNMI = lambda: map(int, input().split())\nNLI = lambda: list(NMI())\nSI = lambda: input()\n\n\ndef combinations_mod(n, r, mod=1000000007)...
['Runtime Error', 'Accepted']
['s868942799', 's674318562']
[3444.0, 3316.0]
[22.0, 1523.0]
[725, 721]
p02768
u608007704
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b=map(int,input().split())\n\ndef two_n(x):\n #calc2**n-1\n ans=0\n base=2\n for i in range(18):\n if n&1<<i:\n ans+=base\n ans%=10**9+7\n base*=2\n base%=10**9+7\nprint(two_n(1))\nprint(two_n(2))\nprint(two_n(3))', 'n,a,b=map(int,input().split())\n\ndef genCombinationFunction(max_k,mod...
['Wrong Answer', 'Accepted']
['s835609465', 's966321913']
[9176.0, 16948.0]
[31.0, 174.0]
[230, 586]
p02768
u619197965
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b=[int(i) for i in input().split()]\ndef power(a,n,mod):\n res=1\n while n>0:\n if n&1:\n res=res*a%mod\n a=a*a%mod\n n>>=1\n return res\n\nans=power(2,n-1,10**9+7)-1\nnum1=1\nnum2=1\nfor i in range(a):\n num1*=(n-i)\n num2*=(i+1)\nans-=num1//num2\nans%=10**9+7\nnum1...
['Wrong Answer', 'Accepted']
['s954066475', 's171772541']
[3580.0, 3064.0]
[2104.0, 1526.0]
[397, 283]
p02768
u619850971
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import sys\nreadline = sys.stdin.readline\nread = sys.stdin.read\nn,a,b = [int(i) for i in read().split()]\nMOD = 10**9+7\nans = pow(2,n,MOD)-1\n\ndef choose(n,r):\n res = 1\n fac = 1\n for i in range(r):\n res *= n-i\n res %= MOD\n fac *= i+1\n fac %= MOD\n return res*pow(fac,...
['Runtime Error', 'Accepted']
['s458201103', 's754525788']
[3064.0, 3064.0]
[18.0, 157.0]
[381, 439]
p02768
u627325970
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def pow_mod(a, n, m): # (a^n) % m\n res = 1\n while n > 0:\n if n % 2 == 1:\n res = (res * a) % m\n a = (a * a) % m\n n = n // 2\n return res\n\ndef combi_mod(p, q, m):\n numerator, denominator = 1, 1\n for i in range(1, q+1):\n numerator *= (p - i + 1)\n n...
['Runtime Error', 'Accepted']
['s356865085', 's777709574']
[3064.0, 3064.0]
[17.0, 151.0]
[606, 626]
p02768
u642012866
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\n\np = 10**9+7\n\ndef f(x, n, p):\n print(x, n, p)\n if n == 1:\n return x % p\n if n % 2 == 1:\n return (x * f(x, n-1, p)) % p\n y = f(x, n//2, p)\n return (y**2) % p\n\ndef ff(n, m):\n x = 1\n for i in range(n-m+1, n+1):\n x *= i\n ...
['Wrong Answer', 'Accepted']
['s667742465', 's586541389']
[3064.0, 3064.0]
[138.0, 143.0]
[472, 453]
p02768
u644224332
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import math\n\nMOD = 10 ** 9 + 7\n\n\ndef cmb(n, r):\n total = 1\n for i in range(r):\n total *= (n - i) % MOD\n return total * pow(math.factorial(r), MOD - 2, MOD) % MOD\n\n\ndef calc(n, r):\n ret = 1\n for i in range(r):\n ret = ret * (n - i) % MOD\n return ret * pow(factorial(r), MO...
['Runtime Error', 'Time Limit Exceeded', 'Accepted']
['s479613562', 's607557160', 's893455882']
[3064.0, 220988.0, 5460.0]
[51.0, 2118.0, 1502.0]
[524, 759, 534]
p02768
u646818123
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from math import factorial\n\ndef com(n, r):\n return factorial(n) // facotrial(n - r) // factorial(r)\n\nn, a, b = [int(s) for s in input().split()]\n\nprint((2**n - com(n, a) - com(n, b) - 1) % (10**9 + 7))', 'import functools\n\ndef get_mul_inverse(x: int, p: int) -> int:\n return iterative_square(x, p - 2, p)...
['Runtime Error', 'Accepted']
['s967277789', 's376930125']
[199356.0, 3572.0]
[2107.0, 157.0]
[202, 908]
p02768
u652656291
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\nmod = 10**9+7\nALL = pow(2,n,m)-1\nx = y = 1\nfor i in range(b):\n x = x * (i+1)%m\n y = y * (n-i)%m\n if i + 1 == a:\n a = b\n ALL -= y * pow(x,m-2,m)\nprint(ALL%m)\n', 'import math\n\nn,a,b = map(int,input().split())\nmod = 10**9+7\ntotal = pow(2,n,mod) - 1\n...
['Runtime Error', 'Runtime Error', 'Accepted']
['s697574731', 's985146896', 's790456919']
[3060.0, 3064.0, 3064.0]
[18.0, 17.0, 1603.0]
[213, 408, 377]
p02768
u657786757
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import sys\nimport math\nfrom collections import deque\nfrom collections import defaultdict\n\ndef main():\n n,a,b = list(map(int,sys.stdin.readline().split()))\n mod = 10**9 + 7\n ans = 1\n C = 1\n for i in range(n-1):\n C = C * (n - i) // (i + 1)\n #print("C=",C)\n if not i == a ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s160081720', 's231872334', 's980718835']
[3436.0, 3436.0, 3316.0]
[2104.0, 2104.0, 136.0]
[438, 460, 486]
p02768
u667084803
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from functools import reduce\n \ndef perm(n, k, p):\n ret = 1\n for i in range(n, n-k-1, -1):\n ret = (ret * i)%p\n return ret\n\ndef comb(n, k, p):\n \n a = perm(n, k, p)\n b = perm(k, k, p)\n return (a*pow(b, p-2, p))%p\n \nn, a, b = map(int, input().split())\n\nMOD = 10**9 + 7\n\n\nprint((pow(2,n,MOD) ...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s359902299', 's430151829', 's594900984', 's716379007', 's877855864', 's934572765']
[3572.0, 3700.0, 3700.0, 3064.0, 3572.0, 3684.0]
[114.0, 2104.0, 158.0, 17.0, 2104.0, 114.0]
[396, 400, 346, 600, 396, 394]
p02768
u677121387
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\nmod = 10**9+7\na = min(a,n-a)\nb = min(b,n-b)\nm = max(a,b)\nX = [0]*(m+1)\nY = [0]*(m+1)\nX[0] = 1\nX[1] = n\nY[0] = Y[1] = 1\n\nfor i in range(1,m):\n X[i] = X[i-1]*(n-i)%mod\n Y[i] = Y[i-1]*(i+1)%mod\n\na -= 1\nb -= 1\nans = (((pow(2,n,mod)-1)%mod-X[a]*pow(Y[a],mod-2,mod)%mo...
['Wrong Answer', 'Accepted']
['s643023903', 's846379786']
[18804.0, 3064.0]
[166.0, 144.0]
[352, 298]
p02768
u678167152
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['inp = [int(i) for i in input().split()]\nn = inp[0]\na = inp[1]\nb = inp[2]\n\n# C = {}\n\n# print(n,r)\n# if r==0 or r ==n:\n# return 1\n# if r==1:\n# return n\n# if (n,r) in C:\n# return C[(n,r)]\n# C[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n# return C[(n,r)]\n\n\n# if n - r < r: r = n - r\n#...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s506097533', 's581715419', 's674681869', 's737852698', 's801295660', 's909900858', 's316536800']
[4328.0, 3064.0, 220420.0, 227732.0, 221764.0, 4216.0, 9188.0]
[29.0, 2104.0, 2119.0, 2119.0, 2123.0, 77.0, 606.0]
[1407, 622, 1808, 603, 1796, 325, 369]
p02768
u680851063
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int,input().split())\nprint(n,a,b)\n\nimport math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nl = [int(i) for i in range(1,n+1)]\nprint(l)\n\nx = 0\nfor j in range(n):\n x += combinations_count(n, l[j])\n\ny = combinations_count(n, ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s370264357', 's726251128', 's271767950']
[728984.0, 730648.0, 9076.0]
[2148.0, 2149.0, 101.0]
[357, 357, 916]
p02768
u686713618
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\ndef power_func(a,n,p):\n bi=str(format(n,"b"))\n res=1\n for i in range(len(bi)):\n res=(res*res) %p\n if bi[i]=="1":\n res=(res*a) %p\n return res\nN, a, b = map(int, input().s...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s005590209', 's442311752', 's996521054']
[225876.0, 27700.0, 27700.0]
[2118.0, 694.0, 650.0]
[645, 913, 956]
p02768
u697386253
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int, input().split())\ns = 0\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mo...
['Runtime Error', 'Accepted']
['s465758040', 's438106710']
[4340.0, 3060.0]
[29.0, 109.0]
[586, 333]
p02768
u697559326
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
["def pow(x, n, mod):\n ans = 1\n while(n > 0):\n if(bin(n & 1) == bin(1)):\n ans = ans*x % mod\n x = x*x % mod\n n = n >> 1\n return ans\n\ndef kaijou_k(n, k, mod):\n a = 1\n for i in range(k, n+1):\n a *= i\n a %= mod\n return a %mod\n\ndef main():\n n, a, b = map(int, input...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s342604404', 's695265574', 's940466101', 's728806908']
[3188.0, 3064.0, 3784.0, 3192.0]
[148.0, 149.0, 2108.0, 145.0]
[706, 955, 695, 695]
p02768
u698919163
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = list(map(int,input().split()))\n\ndef cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7 \nN = 10**9\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod ...
['Time Limit Exceeded', 'Accepted']
['s039934148', 's014018072']
[227472.0, 3064.0]
[2119.0, 131.0]
[593, 420]
p02768
u699008198
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map( int, input().split() )\n\nmod = 10 ** 9 + 7\n\ndef comb( n, r, mod ):\n c = 1\n m = 1\n r = min( n - r, r )\n for i in range( r ):\n c = c * ( n - i ) % mod\n m = m * ( i + 1 ) % mod\n return c * pow( m, mod - 2, mod ) % mod\n\nN = pow( 2, n, mod )\nA = comb( n, a )\nB = comb( n, b )\nprint(...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s669345630', 's765628200', 's940443153', 's053130270']
[3064.0, 3064.0, 3188.0, 3064.0]
[19.0, 147.0, 152.0, 152.0]
[323, 318, 318, 324]
p02768
u703214333
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,m=map(int,input().split())\nmod=10**9+7\nif abs(n-m)>1:\n print(0)\n exit()\na,b=[1,1]\nfor i in range(1,min(n,m)+1):\n a=(a*i)%mod\nif n!=m:\n b*=max(n,m)*a\n print((a*b)%mod)\nelse:\n b=a\n print((2*a*b)%mod)', 'mod=10**9+7\nimport math\n\ndef co(n,r,mod):\n x=1\n y=1\n for i in rang...
['Runtime Error', 'Accepted']
['s995787468', 's528628403']
[3064.0, 3064.0]
[17.0, 140.0]
[220, 298]
p02768
u704284486
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def mpow(a,n,mod):\n if n == 0:\n return 1\n elif n == 1:\n return a\n elif n%2==0:\n return (pow(a,n/2,mod))**2%mod\n else:\n return a*pow(a,n-1,mod)%mod\ndef mfac(l,r,mod):\n ans = l\n for i in reversed(range(r,l)):\n ans *= i\n ans %= mod\n return ans\ndef mcomb(n,k,mod):\n A = mfac(n,n-k...
['Runtime Error', 'Accepted']
['s924597888', 's300935717']
[3188.0, 3064.0]
[19.0, 145.0]
[549, 555]
p02768
u706330549
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from functools import reduce\nimport sys\n\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\n\nn, a, b = map(int, read().split())\nMOD = 10 ** 9 + 7\n\n\ndef combo_mod(n, a):\n t = reduce(lambda x, y: x * y % MOD, range(n, n - a, -1))\n b = reduce(lambda x, y: x * y % MOD, range(1, a + 1))\n ...
['Runtime Error', 'Accepted']
['s174525729', 's875705057']
[3828.0, 3700.0]
[28.0, 159.0]
[402, 437]
p02768
u707808519
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# coding: utf-8\nMOD = 10**9+7\n\n\ndef modpow(a, n):\n res = 1\n while n > 0:\n if n & 1:\n res = res * a % MOD\n a = a * a % MOD\n n >>= 1\n return res\n\n# nCr mod.p (n <= 10**6)\nMAX = 1000010\nfac = [0] * MAX \nfinv = [0] * MAX\ninv = [0] * MAX\ndef COMinit():\n fac[0]...
['Wrong Answer', 'Accepted']
['s349253992', 's407574664']
[121844.0, 121716.0]
[1204.0, 1284.0]
[829, 824]
p02768
u712284046
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import math\nn, a, b = map(int, input().split())\nx = 1\nmy_list = [0] * n\n\nfor i in range(n):\n x = x * (n - i) // (i + 1)\n my_list[i] = x\n\nmy_list[a-1] = 0\nmy_list[b-1] = 0\n\nprint(my_list)\nprint(sum(my_list) %(10**9 + 7) )\n', 'n, a, b = map(int, input().split())\np = 1000000007\n\ndef remainder_of_c...
['Runtime Error', 'Accepted']
['s187479888', 's906086097']
[1505780.0, 3064.0]
[2137.0, 108.0]
[227, 378]
p02768
u729008627
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\np = 10**9 + 7\ndef ModComb(n, r, p):\n N = n%p\n R = r%p\n if N<R:\n return 0\n if N < 2*R:\n R = N-R\n if R == 0:\n return 1\n else:\n return (n*pow(r, p-2, p))%p*ModComb(n-1, r-1, p)\n\nans = 1\nfor i in range(N):\n ans *= 2\n ans ...
['Runtime Error', 'Accepted']
['s584561346', 's224947445']
[3064.0, 3064.0]
[18.0, 142.0]
[383, 287]
p02768
u730107446
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def modpow(a,n):\n if n==0:\n return 1\n elif n==1:\n return a%mod\n elif n%2==0:\n return (modpow(a,n/2)**2)%mod\n else:\n return (a*modpow(a,n-1))%mod\n\ndef modfact(l,r):\n fact=1\n for i in range(l-r+1):\n fact=fact*(r+i)%mod\n return fact\n\ndef comb(n,x):\...
['Runtime Error', 'Accepted']
['s639760829', 's194978019']
[3112.0, 3188.0]
[20.0, 152.0]
[535, 520]
p02768
u731368968
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['MOD = 10 ** 9 + 7\n\n\nclass ModInt:\n def __init__(self, x):\n self.x = x % MOD\n\n def __str__(self):\n return str(self.x)\n\n __repr__ = __str__\n\n def __add__(self, other):\n return (\n ModInt(self.x + other.x) if isinstance(other, ModInt) else\n ModInt(self...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s088651855', 's508629318', 's146791846']
[44112.0, 44112.0, 44120.0]
[1342.0, 1336.0, 1559.0]
[2018, 2016, 2060]
p02768
u744920373
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['import sys\nsys.setrecursionlimit(10**8)\ndef ii(): return int(sys.stdin.readline())\ndef mi(): return map(int, sys.stdin.readline().split())\ndef li(): return list(map(int, sys.stdin.readline().split()))\ndef li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]\ndef dp2(ini, i, j): return ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s424174867', 's930971680', 's394251775']
[3064.0, 531096.0, 11052.0]
[18.0, 2132.0, 206.0]
[1204, 1265, 1312]
p02768
u765865533
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod=10 ** 9 + 7\n\nn, a, b = map(int, input().split())\n\ndef power(x,n):\n if n==0:\n return 1\n elif n%2==0:\n half=power2(x,n//2)\n return half**2 %mod\n else:\n half=power2(x,(n-1)//2)\n return half**2 * x %mod\n\ndef binomial(n,k):\n x=1\n y=1\n for i in rang...
['Runtime Error', 'Accepted']
['s511483039', 's921356135']
[3064.0, 3064.0]
[22.0, 150.0]
[449, 447]
p02768
u767664985
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\np = 10 ** 9 + 7\nN = 10 ** 9 \nfact = [1, 1] # fact[n] = (n! mod p)\nfactinv = [1, 1] # factinv[n] = ((n!)^(-1) mod p)\ninv = [0, 1] \n\nfor i in range(2, N + 1):\n fact...
['Time Limit Exceeded', 'Accepted']
['s141886067', 's743071203']
[230392.0, 3572.0]
[2119.0, 157.0]
[585, 393]
p02768
u780962115
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b=map(int,input().split())\n\nmod=10**9+7\n\nJ=pow(2,n)%mod\ndef find_power(n,mod):\n \n powlist=[0]*(n+1)\n powlist[0]=1\n powlist[1]=1\n for i in range(2,n+1):\n powlist[i]=powlist[i-1]*i%(mod)\n return powlist\n\ndef find_inv_power(n):\n \n powlist=find_power(n,10**9+7)\n chec...
['Wrong Answer', 'Accepted']
['s598860842', 's169810774']
[199460.0, 18996.0]
[2107.0, 264.0]
[1184, 1158]
p02768
u782748646
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['from math import factorial\n\ndef framod(n, mod, a=1):\n for i in range(1,n+1):\n a=a * i % mod\n return a\n\ndef power(n, r, mod):\n if r == 0: return 1\n if r%2 == 0:\n return power(n*n % mod, r//2, mod) % mod\n if r%2 == 1:\n return n * power(n, r-1, mod) % mod\n\ndef comb(n, k,...
['Time Limit Exceeded', 'Accepted']
['s502386489', 's707689776']
[10536.0, 4592.0]
[2104.0, 113.0]
[639, 585]
p02768
u786793781
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\nfrom functools import reduce\nmod = 10**9+7\n\n\ndef nCk(n, k):\n # c = reduce(lambda x, y: x*y % mod, range(n, n-k, -1))\n # m = reduce(lambda x, y: x*y % mod, range(1, k+1))\n c = reduce(lambda x, y: x*y % mod, range(n, n-k+1, -1))\n m = reduce(lambda x...
['Runtime Error', 'Accepted']
['s451006335', 's006354965']
[3572.0, 3572.0]
[159.0, 159.0]
[484, 400]
p02768
u797572808
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n,a,b = map(int,input().split())\n\nfac = [0 for _ in range(n+1)]\ninv = [0 for _ in range(n+1)]\nfinv = [0 for _ in range(n+1)]\n\nfac[0] =fac[1]= 1\ninv[0] =inv[1]= 1\nfinv[0] = finv[1] = 1\n\np = 10**9 + 7\n#p = 31\n#inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;\nfor i in range(2,n+1):\n fac[i] = (fac[i-1]*i)%p\...
['Runtime Error', 'Accepted']
['s734480804', 's154491132']
[516504.0, 5440.0]
[2123.0, 1505.0]
[577, 318]
p02768
u809816772
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['n, a, b = map(int, input().split())\nlaw = 10 ** 9 + 7\n\ndef fermat(n, r, law):\n x = 1\n y = 1\n for i in range(r):\n x = x * (n - i) % law\n y = y * (i + 1) % law\n\n ans = x * pow(y, law - 2, law)\n return ans\n\nprint((pow(2,n,law)- fermat(n,a,law)-fermat(n,b,law))%law)', 'n, a, b = ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s309819843', 's648931575', 's762407383']
[3064.0, 3064.0, 3064.0]
[144.0, 143.0, 144.0]
[291, 291, 299]
p02768
u813098295
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['# return x^{-1} % mod\n# it take O(log{mod})\ndef mod_inverse(x, mod):\n return pow(x, mod-2, mod)\n\n# return nCk % mod\n# it take O(k)\ndef mod_comb(n, k, mod):\n numer, denom = 1, 1\n for i in range(k):\n \n numer = numer * ((n-i) % mod) % mod\n denom = denom * ((i+1) % mod) % mod\n\n...
['Runtime Error', 'Accepted']
['s184528938', 's092233739']
[3064.0, 3064.0]
[19.0, 155.0]
[547, 503]
p02768
u825541307
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['mod = 10**9 + 7\nN = 10**9\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\n\nfor i in range(2, N + 1):\n\tg1.append((g1[-1] * i) % mod)\n\tinverse.append((-inverse[mod % i] * (mod // i)) % mod)\n\tg2.append((g2[-1] * inverse[-1]) % mod)\n\ndef cmb(n, r, mod):\n\tif r < 0 or r > n:\n\t\treturn 0\n\tr = min(r, n-r)\n\tret...
['Time Limit Exceeded', 'Accepted']
['s038190735', 's883628953']
[228700.0, 27700.0]
[2120.0, 660.0]
[481, 595]
p02768
u836311327
2,000
1,048,576
Akari has n kinds of flowers, one of each kind. She is going to choose one or more of these flowers to make a bouquet. However, she hates two numbers a and b, so the number of flowers in the bouquet cannot be a or b. How many different bouquets are there that Akari can make? Find the count modulo (10^9 + 7). Here,...
['def per(n, r, mod=10**9+7): \n per = 1\n for i in range(r):\n per = per*(n-i) % mod\n return per\n\n\ndef com(n, r, mod=10**9+7): \n bunshi = per(n, r, mod)\n bunbo = 1\n for i in range(1, r+1):\n bunbo = bunbo*i % mod\n return bunshi*pow(bunbo, -1, mod)\n\n\nn, a, b = map(int, in...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s204575216', 's495087886', 's664640349']
[9060.0, 9212.0, 9084.0]
[108.0, 115.0, 115.0]
[403, 410, 426]