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
p02766
u800058906
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import sys\nimport math\nn,k=map(int,input().split())\n\np=int(math.log2(n))\n\nfor i in range(p):\n if n//(k**i)<1:\n print(i)\n sys.exit()', 'import sys\nimport math\nn,k=map(int,input().split())\n\np=int(math.log2(n))\n\nfor i in range(p+2):\n if n//(k**i)<1:\n print(i)\n sys.exit()']
['Wrong Answer', 'Accepted']
['s797951441', 's670740302']
[9240.0, 9168.0]
[27.0, 26.0]
[148, 150]
p02766
u809816772
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N, K = map(int, input().split())\n\nans = 0\n\nwhile N > 0:\n N /= K\n ans += 1\n\nprint(ans)', 'N, K = map(int,input().split())\n\nans = 0\n\nwhile N > 0:\n N //= K\n ans += 1\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s708120354', 's271413588']
[2940.0, 2940.0]
[17.0, 17.0]
[91, 91]
p02766
u816171517
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k=map(int,input().split())\ni=1\n\nj=int(k**i)\n\nimport sys\n\nwhile True:\n\n if n <=(j-1):\n\n print(i)\n\n sys.exit()\n\n else:\n i+=1\n pass\n', 'n,k=map(int,input().split())\ni=0\n\n\nwhile n>=k**i:\n\n i+=1\n\nelse:\n print(i)\n']
['Time Limit Exceeded', 'Accepted']
['s012627523', 's481660070']
[2940.0, 2940.0]
[2104.0, 19.0]
[213, 80]
p02766
u816550520
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N, K = [int(i) for i in input().split()]\n\ncnt = 1\nwhile True:\n N = N - K ** cnt\n if (cnt == 1):\n if (N < 0):\n break\n cnt = cnt + 1\n else:\n if (N <= 0):\n break\n cnt = cnt + 1\n\nprint(cnt)', 'N, K = [int(i) for i in input().split()]\n\ncnt = 0\nwhile True:\n N = N - ((K-1) * (K ** cnt))\n cnt = cnt + 1\n if (N <= 0):\n break\n\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s740459362', 's495678221']
[2940.0, 2940.0]
[17.0, 17.0]
[244, 155]
p02766
u819593641
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K = map(int,input().split())\nprint(int(math.log(N,K)+1))', 'import math\nN,K = map(int,input().split())\nprint(int(math.log(N,K)+1))\n']
['Runtime Error', 'Accepted']
['s184091370', 's963337371']
[2940.0, 2940.0]
[17.0, 17.0]
[58, 71]
p02766
u820284192
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K = map(int, input(),split())\n\ncounter = 1\ntmp = 1\nwhile true:\n tmp *= K\n if tmp > N\n break\n counter += 1\nprint(counter)', 'N,K = map(int, input().split())\n \ncounter = 1\ntmp = 1\nwhile True:\n tmp *= K\n if tmp > N:\n break\n counter += 1\nprint(counter)']
['Runtime Error', 'Accepted']
['s677064247', 's739686019']
[2940.0, 2940.0]
[17.0, 19.0]
[138, 140]
p02766
u830162518
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K=map(int,input().split())\na=0\nwhile N//K>=K:\n N=N//K\n a=a+1\nprint(a+1)\n\n\n', 'n,k=map(int,input().split())\na=0\nwhile n//k**a>0:\n a=a+1\nprint(a)']
['Wrong Answer', 'Accepted']
['s442312729', 's526004764']
[2940.0, 2940.0]
[17.0, 17.0]
[78, 66]
p02766
u830770242
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K=map(int,input().split())\na = 1\nwhile K <= N:\n N = N // K\n a +=a\n \nprint(a)', 'N,K=map(int,input().split())\na = 1\nwhile K <= N:\n N = N // K\n a =a+1\n print(a)\n \nprint(a)', 'N,K=map(int,input().split())\n \nwhile K <= N:\n N = N // K\n a +=a\n \nprint(a)', 'N,K=map(int,input().split())\n\nwhile R <= N:\n N = N // R\n a +=a\n\nprint(a)\n \n \n \n', 'N,K=map(int,input().split())\na = 0\nwhile R <= N:\n N = N // R\n a +=a\n \nprint(a)', 'N,K=map(int,input().split())\na = 1\nwhile K <= N:\n N = N // K\n a =a+1\n \nprint(a)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s118611747', 's200953326', 's249914021', 's316655892', 's501168287', 's683251732']
[3064.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[18.0, 20.0, 18.0, 17.0, 18.0, 17.0]
[80, 92, 76, 84, 80, 82]
p02766
u835283937
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['def main():\n N, M = map(int, input().split())\n A = [int(a) for a in input().split()]\n total = sum(A)\n cnt = 0\n for i in range(N):\n if A[i] < total*1.0/(4.0*M):\n pass\n else:\n cnt += 1\n if cnt >= M:\n print("Yes")\n else:\n print("No")\nmain()', 'def main():\n N, K = map(int, input().split())\n if K == 10:\n print(len(str(N)))\n else:\n mod = list()\n count = 0\n for i in range(10**9):\n a, b = divmod(N, K)\n N = a\n count += 1\n if N == 0:\n break\n print(count)\nmain()']
['Runtime Error', 'Accepted']
['s008477206', 's520760085']
[3060.0, 2940.0]
[18.0, 17.0]
[308, 318]
p02766
u841599623
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K = map(int, input().split())\nc = 1\nK_ = 1\ni=True\nwhile i==True:\n K_ = K_ * K\n if N < K_:\n print(c)\n i=False\n counter += 1', 'N,K = map(int, input().split())\ncounter = 0\nK_ = 1\ni=True\nwhile i==True:\n K_ = K_ * K\n if K > K_:\n print(counter)\n i=False\n counter += 1', 'N,K = map(int, input().split())\ncounter = 0\nK_ = 1\nwhile i=True:\n K_ = K_ * K\n if K > K_:\n print(counter)\n i=False\n counter += 1\n ', 'N,K = map(int, input().split())\nc = 1\nK_ = 1\ni=True\nwhile i==True:\n K_ *= K\n if N < K_:\n print(c)\n i=False\n counter += 1\n', 'N,K = map(int, input().split())\nc = 1\nK_ = 1\ni=True\nwhile i==True:\n K_ = K_ *K\n if N < K_:\n print(c)\n i=False\n c += 1']
['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Runtime Error', 'Accepted']
['s011392235', 's286324428', 's838519786', 's931444275', 's482046438']
[2940.0, 3240.0, 2940.0, 2940.0, 2940.0]
[17.0, 2104.0, 17.0, 17.0, 18.0]
[133, 145, 140, 130, 126]
p02766
u842028864
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['a,b = map(int,input().split())\ncount,rank = 1,b\nwhile a < rank:\n count += 1\n rank *= b\nprint(count)', 'a,b = map(int,input().split())\ncount,rank = 1,3\nwhile a < rank:\n count += 1\n rank *= 3\nprint(count)', 'a,b = map(int,input().split())\ncount,rank = 1,b\nwhile a >= rank:\n count += 1\n rank *= b\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s076890447', 's520806489', 's379035409']
[3060.0, 3060.0, 2940.0]
[2104.0, 2104.0, 18.0]
[101, 101, 102]
p02766
u843318346
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import math\nn,k = map(int,input().split())\nans = math.ceil(math.log(k,n))\nprint(ans)', 'import math\nn,k = map(int,input().split())\nif n == 1:\n ans = 1\nelse:\n ans = math.ceil(math.log(k,n))\nprint(ans)', 'import math\nn,k = map(int,input().split())\nif n == 1:\n ans = 1\nelse:\n ans = math.ceil(math.log(n,k))\nprint(ans)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s144211700', 's243207790', 's755435545']
[2940.0, 3060.0, 2940.0]
[17.0, 17.0, 17.0]
[84, 113, 114]
p02766
u854992222
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n, k = map(int, input().split())\ncount = 0\ni = 0\nwhile n >= k ** i:\n n = n - k ** i\n count += 1\n i += 1\nprint(count)', 'n, k = map(int, input().split())\ni = 0\nwhile n >= k ** i:\n i += 1\nprint(i)']
['Wrong Answer', 'Accepted']
['s197719892', 's361347000']
[2940.0, 2940.0]
[17.0, 17.0]
[125, 77]
p02766
u856564576
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
[' = map(int, input().split())\n\nans = 1\nwhile(True):\n n = n//k\n if(n == 0):\n break\n ans += 1\n\nprint(ans)\n', 'n, k = map(int, input().split())\n\nans = 1\nwhile(True):\n n = n//k\n if(n == 0):\n break\n ans += 1\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s953241204', 's075311881']
[8756.0, 8976.0]
[29.0, 27.0]
[119, 122]
p02766
u857330600
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k=map(int,input().split())\ni=0\nwhile k**i<n:\n i+=1\nprint i', 'n,k=map(int,input().split())\ni=0\nwhile k**i<=n:\n i+=1\nprint(i)']
['Runtime Error', 'Accepted']
['s882746340', 's060668824']
[2940.0, 2940.0]
[17.0, 18.0]
[61, 63]
p02766
u862920361
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K=(int(x) for x in input().split())\nb=1\na=1\nwhile a=<N:\n b=b+1\n a=K**b\nelse:\n print(b)', 'N,K=(int(x) for x in input().split())\nb=1\na=1\nIf N=1:\n print(1)\nelse:\n while a<=N:\n b=b+1\n a=K**b\n else:\n print(b)\n\n', 'N,K=(int(x) for x in input().split())\nk=0\na=K\nwhile a<=N:\n k=+1\n a=K*10**k\nprint(k)', 'N,K=(int(x) for x in input().split())\nk=0\nwhile a<=x:\n a=K*10**k\n k=+1\nprint(k)', 'N,K=(int(x) for x in input().split())\nk=0\na=K\nwhile a<=N:\n k=+1\n a=K**k\nbreak\nprint(k+1)', 'N,K=(int(x) for x in input().split())\nb=1\na=1\nif N==1:\n print(1)\nelse:\n while a<=N:\n b=b+1\n a=K**b\n else:\n print(b)\n']
['Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s005996647', 's258810751', 's422687592', 's583265126', 's598612715', 's944629287']
[2940.0, 2940.0, 2940.0, 2940.0, 2940.0, 2940.0]
[17.0, 17.0, 2104.0, 18.0, 17.0, 17.0]
[98, 154, 89, 85, 94, 154]
p02766
u874644572
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n, k = map(int, input().split())\nans = 0\nwhile n: \n ans += 1\n n /= k\nprint(ans)', 'n, k = map(int, input().split())\nans = 0\nwhile n: \n ans += 1\n n //= k\nprint(ans)']
['Wrong Answer', 'Accepted']
['s492048631', 's824564956']
[2940.0, 2940.0]
[17.0, 17.0]
[107, 108]
p02766
u878291720
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K = map(int, input().split())\ncnt = 0\nwhile True:\n cnt += 1\n N = N/K\n if N == 0:\n break\nprint(cnt)', 'N,K = map(int, input().split())\ncnt = 0\nwhile N >= 1:\n cnt += 1\n N = int(N/K)\nprint(cnt)']
['Wrong Answer', 'Accepted']
['s138170202', 's883530231']
[2940.0, 2940.0]
[20.0, 17.0]
[106, 90]
p02766
u884679979
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k=map(int,input().split())\ndigit=1\nnum=k\nwhile n>=k:\n num *= k\n digit += 1\n\nprint(digit)\n ', 'import math\n\nn,k=map(int,input().split())\n\nif math.log(n,k) == int(math.log(n,k)):\n res=math.log(n,k) + 1\nelse:\n res=int(math.log(n,k)) + 2\n\nprint(res)', 'import math\nn,k=map(int,input().split())\nprint(int(math.log(n,k)) + 1)\n']
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s257902498', 's523861823', 's484753441']
[3236.0, 3060.0, 2940.0]
[2104.0, 18.0, 17.0]
[95, 153, 71]
p02766
u888337853
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import math\nimport copy\nfrom copy import deepcopy\nimport sys\nimport fractions\nimport numpy as np\nfrom functools import reduce\nimport statistics\nimport heapq\n\n\n# input = sys.stdin.readline\n\n\n# ===FUNCTION===\n\ndef getInputInt():\n inputNum = int(input())\n return inputNum\n\n\ndef getInputListInt():\n outputData = []\n inputData = input().split()\n outputData = [int(n) for n in inputData]\n\n return outputData\n\n\ndef getSomeInputInt(n):\n outputDataList = []\n for i in range(n):\n inputData = int(input())\n outputDataList.append(inputData)\n\n return outputDataList\n\n\ndef getSomeInputListInt(n):\n inputDataList = []\n outputDataList = []\n for i in range(n):\n inputData = input().split()\n inputDataList = [int(n) for n in inputData]\n outputDataList.append(inputDataList)\n\n return outputDataList\n\n\n# ===CODE===\n\ndata = getInputListInt()\nn = data[0]\nk = data[1]\n\ncounter = 0\nnum = 1\n\nflg = True\nwhile flg:\n counter += 1\n if n > num:\n num *= k\n else:\n flg = False\n\nprint(counter)', 'import math\nimport copy\nfrom copy import deepcopy\nimport sys\nimport fractions\nimport numpy as np\nfrom functools import reduce\nimport statistics\nimport heapq\n\n\n# input = sys.stdin.readline\n\n\n# ===FUNCTION===\n\ndef getInputInt():\n inputNum = int(input())\n return inputNum\n\n\ndef getInputListInt():\n outputData = []\n inputData = input().split()\n outputData = [int(n) for n in inputData]\n\n return outputData\n\n\ndef getSomeInputInt(n):\n outputDataList = []\n for i in range(n):\n inputData = int(input())\n outputDataList.append(inputData)\n\n return outputDataList\n\n\ndef getSomeInputListInt(n):\n inputDataList = []\n outputDataList = []\n for i in range(n):\n inputData = input().split()\n inputDataList = [int(n) for n in inputData]\n outputDataList.append(inputDataList)\n\n return outputDataList\n\n\n# ===CODE===\n\ndata = getInputListInt()\nn = data[0]\nk = data[1]\n\ncounter = 1\nnum = k\n\nflg = True\nwhile flg:\n if n > num-1:\n num *= k\n counter += 1\n else:\n flg = False\n\nprint(counter)']
['Wrong Answer', 'Accepted']
['s982762903', 's755944466']
[13648.0, 13872.0]
[156.0, 160.0]
[1088, 1094]
p02766
u888721916
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import sys\nN,K = map(int,input().split())\nif N < K:\n print(0)\n sys.exit()\ncount = 1\nwhile N>=K:\n K=K*K\n count += 1\n\nprint(count)', 'N,K = map(int,input().split())\ncount = 1\nwhile N>=K:\n K=K*K\n count += 1\n\nprint(count)', 'import sys\nN,K = map(int,input().split())\nK0 = K\nif N < K:\n print(1)\n sys.exit()\ncount = 1\nwhile N>=K:\n K=K*K0\n count += 1\n\nprint(count)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s911129485', 's960046528', 's212825713']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[140, 91, 148]
p02766
u891125728
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import numpy as np\n\ni = list(map(int, input().split()))\nN = i[0]\nK = i[1]\n\nN_ = np.base_repr(N, K)\n\nprint(N_)\nprint(len(str(N_)))', 'import numpy as np\n\ni = list(map(int, input().split()))\nN = i[0]\nK = i[1]\n\nN_ = np.base_repr(N, K)\n\nprint(len(str(N_)))']
['Wrong Answer', 'Accepted']
['s278365949', 's392776815']
[12488.0, 12488.0]
[149.0, 149.0]
[129, 119]
p02766
u895408600
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K=map(int,input().split())\ndef B(X, n):\n if (int(X/n)):\n return Base_10_to_n(int(X/n), n)+str(X%n)\n return str(X%n)\nprint(len(B(N,K)))', 'N,K=map(int,input().split())\ndef B(X, n):\n if (int(X/n)):\n return B(int(X/n), n)+str(X%n)\n return str(X%n)\nprint(len(B(N,K)))']
['Runtime Error', 'Accepted']
['s724570815', 's833123537']
[2940.0, 3060.0]
[17.0, 17.0]
[149, 138]
p02766
u903699277
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N, K = [int(_) for _ in input().split()]\nfor a in range(0, 10**9):\n N = int(N / K)\n if N <= 0:\n print(a)\n break', 'N, K = [int(_) for _ in input().split()]\nfor a in range(10**9):\n if K**(a) <= N < K**(a*1):\n print(a+1)\n break', 'N, K = [int(_) for _ in input().split()]\nfor a in range(0, 10**9):\n if K**(a) <= N < K**(a*1):\n print(a+1)\n break', 'N, K = [int(_) for _ in input().split()]\nfor a in range(10**9):\n if K**(a) <= N < K**(i*1):\n print(a+1)\n break', 'N, K = [int(_) for _ in input().split()]\nfor a in range(1, 10**9):\n N = int(N / K)\n if N <= 0:\n print(a)\n break']
['Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s223131806', 's237642183', 's281419403', 's691649366', 's662002127']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0]
[17.0, 2104.0, 2104.0, 18.0, 17.0]
[131, 127, 130, 127, 131]
p02766
u912672208
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k=map(int,input().split())\ncount=0\nwhile (n/k)>=1:\n n/=k\n count+=1\n\nprint(count)', 'n,k=map(int,input().split())\ncount=0\nwhile (n/k)>=1:\n n/=k\n count+=1\n\nprint(count+1)']
['Wrong Answer', 'Accepted']
['s432541473', 's531508528']
[2940.0, 2940.0]
[18.0, 17.0]
[84, 86]
p02766
u914797917
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
["N,K=map(int, input().split())\nimport math\nM=int(math.log(N,K)+1)\nprint(M)\nA=''\nfor i in range(1,M-1,-1):\n print(i)\n A+=str(N//(K**i))\n N-=N%(K**i)\nprint(A)", 'N,K=map(int, input().split())\n\nif N<K:\n print(1)\n\nelse:\n for i in range(1,N):\n A=K**i\n if N<A*K:\n print(i+1)\n break']
['Wrong Answer', 'Accepted']
['s505266545', 's038590014']
[3064.0, 2940.0]
[17.0, 17.0]
[158, 133]
p02766
u915879510
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n, k = list(map(int,input().split(" ")))\n\nd=1\nwhile(n>k):\n d+=1\n n= n//k\n \nprint(d)', 'n, k = list(map(int,input().split(" ")))\n\nd=0\nwhile(n):\n d+=1\n n= n//k\n \nprint(d)']
['Wrong Answer', 'Accepted']
['s319767599', 's352767046']
[2940.0, 2940.0]
[17.0, 17.0]
[86, 84]
p02766
u922449550
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import math\n\n\nN, K = map(int, input().split())\n\nans = math.floar(1 + math.log(N)/math.log(K))\nprint(ans)', 'import math\n\n\nN, K = map(int, input().split())\n\nans = math.floor(1 + math.log(N)/math.log(K))\nprint(ans)']
['Runtime Error', 'Accepted']
['s974415303', 's600799685']
[2940.0, 2940.0]
[17.0, 17.0]
[104, 104]
p02766
u923270446
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
["def conv(x, n):\n nchar = '0123456789ABCDEF'\n digit = 0\n \n result = ''\n \n while x > 0:\n result = nchar[x % n] + result\n x = x / n\n \n return result\nn, k = map(int, input().split())\nprint(conv(n, k))", "def conv(x, n):\n nchar = '0123456789ABCDEF'\n digit = 0\n\n result = ''\n\n while x > 0:\n result = nchar[x % n] + result\n x = x / n\n\n return result\nn, k = map(int, input().split())\nprint(n, k)", 'from math import log\nn, k = map(int, input().split())\nprint(int(log(n, k)) + 1)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s236826071', 's715073687', 's298080874']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 17.0]
[225, 216, 79]
p02766
u924828749
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k = [int(x) for x in input().split()]\nres = 0\nwhile n > 0:\n n // k\n c += 1\nprint(res)', 'n,k = [int(x) for x in input().split()]\nres = 0\nwhile n > 0:\n n //= k\n res += 1\nprint(res)']
['Runtime Error', 'Accepted']
['s850780660', 's247181501']
[9044.0, 9076.0]
[25.0, 29.0]
[89, 92]
p02766
u928758473
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import os\n\ndef main():\n result_num = []\n a=[int(x) for x in input().split()]\n num,result = a[0],a[1]\n count = 0\n\n while(True):\n result_num.append(num%result)\n num = num//result\n count += 1\n if result > num:\n result_num.append(num)\n break\n\n print(count)\n\nif __name__ == "__main__":\n main()', 'import os\n\ndef main():\n\n N,K = (int(x) for x in input().split())\n count = 0\n\n while(N > 0):\n N = N // K\n print(N)\n count += 1\n\n print(count)\n\nif __name__ == "__main__":\n main()', 'import os\n\ndef main():\n\n N,K = (int(x) for x in input().split())\n count = 0\n\n while(N > 0):\n \n N = N // K\n count += 1\n\n print(count)\n\nif __name__ == "__main__":\n main()']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s160327981', 's185599773', 's681058913']
[3316.0, 2940.0, 2940.0]
[25.0, 17.0, 17.0]
[359, 212, 204]
p02766
u935151656
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
["N,K=map(int, input().split())\n\n\ndef Base_10_to_n(X, n):\n X_dumy = X\n out = ''\n while X_dumy>0:\n out = str(X_dumy%n)+out\n X_dumy = int(X_dumy/n)\n return out\n\nprint(Base_10_to_n(N,K))\n", "N,K=map(int, input().split())\n\n\ndef Base_10_to_n(X, n):\n X_dumy = X\n out = ''\n while X_dumy>0:\n out = str(X_dumy%n)+out\n X_dumy = int(X_dumy/n)\n return out\n\nprint(len(Base_10_to_n(N,K)))\n"]
['Wrong Answer', 'Accepted']
['s001255494', 's449818763']
[2940.0, 2940.0]
[17.0, 17.0]
[208, 213]
p02766
u941438707
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k=map(int,input().split());print(sum(n>k**i for i in range(100))+k>=n)', 'n,k=map(int,input().split());print(sum(n>=k**i for i in range(100)))']
['Wrong Answer', 'Accepted']
['s896259519', 's844979503']
[2940.0, 2940.0]
[17.0, 17.0]
[72, 68]
p02766
u947327691
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n, k = map(int,input().split())\n\nsum = 0\ncnt = 0\n\nwhile True:\n sum += int(k**cnt)\n cnt += 1\n print(sum)\n if sum >= n:\n break\nprint(cnt)', 'n, k = map(int,input().split())\n\nsum = 0\ncnt = 0\n\nwhile True:\n sum += int(k**cnt)\n if sum <= n:\n cnt += 1\n else:\n break\nprint(cnt)', 'n, k = map(int, input().split())\nnum = 0\nwhile n != 0:\n n = n // k\n num += 1\n \nprint(num)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s141470565', 's781094353', 's471982216']
[2940.0, 2940.0, 2940.0]
[17.0, 17.0, 18.0]
[154, 153, 91]
p02766
u953274507
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['\nimport math\n\n\nx = int(input())\n\n\nscore = int((x // 500 * 1000) + (x % 500 // 5 * 5))\n\n\nprint(score)', '\nimport math\n\n\nn,k = map(int, input().split())\n\n\ndef convert(x,y):\n if int(x/y):\n return convert(int(x/y),y) + str(x%y)\n return str(x%y)\n\n\ntext = len(convert(n,k))\n\n\nprint(text)\n']
['Runtime Error', 'Accepted']
['s667751695', 's782624695']
[2940.0, 2940.0]
[17.0, 17.0]
[173, 318]
p02766
u962309487
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n, k = map(int, input().split())\ni = 1\nwhile k ** i < n:\n i += 1\nprint(i+1)', 'n, k = map(int, input().split())\ni = 1\nwhile k ** i <= n:\n i += 1\nprint(i)']
['Wrong Answer', 'Accepted']
['s605118667', 's743124565']
[2940.0, 2940.0]
[17.0, 17.0]
[78, 77]
p02766
u963944915
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['ans=o\nn,k=map(int,input().split())\nwhile n!=0:\n n=n//k\n ans+=1\nprint(ans)', 'n,k=map(int,input().split())\nans=0\nwhile n!=0:\n n=n//k\n ans+=1\nprint(ans)']
['Runtime Error', 'Accepted']
['s644913196', 's645318632']
[2940.0, 2940.0]
[17.0, 17.0]
[75, 75]
p02766
u964521959
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N, K = map(int, input().split())\n\nans = 0\n\nwhile(n_k > 1):\n n_k = N/K\n ans += 1\n \n \nprint(ans)', 'N, K = map(int, input().split())\n\nans = 0\n\nwhile(N >= 1):\n N= N/K\n ans += 1\n \n \nprint(ans)']
['Runtime Error', 'Accepted']
['s817040667', 's227748060']
[2940.0, 2940.0]
[17.0, 17.0]
[98, 98]
p02766
u974100230
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N, K = map(int, input().split())\nans = 0\nwhile True:\n ans = ans + 1\n N = N / K\n if N < K:\n print(ans + 1)\n return', 'N, K = map(int, input().split())\nans = 0\nwhile True:\n if N < K:\n print(ans + 1)\n break\n ans = ans + 1\n N = N / K']
['Runtime Error', 'Accepted']
['s904455647', 's891191225']
[2940.0, 2940.0]
[17.0, 17.0]
[136, 135]
p02766
u974792613
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['n,k = map(int, input().split())\n\ndigits = 0\nwhile n:\n digits += 1\n n//=10\n \nprint(digits)', 'n, k = map(int, input().split())\n\ndigits = 0\nwhile n:\n digits += 1\n n //= k\n\nprint(digits)\n']
['Wrong Answer', 'Accepted']
['s250891117', 's064172223']
[2940.0, 2940.0]
[17.0, 17.0]
[92, 97]
p02766
u978933721
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import numpy as np\nN, K = map(int, input().split())\n\nres = 0\nM = N\nwhile M > 1:\n M /= 3\n res += 1\nprint(res)', 'import numpy as np\nN, K = map(int, input().split())\n\ndiv = np.log(N) / np.log(3)\nprint(np.ceil(div).astype(int))', 'import numpy as np\nN, K = map(int, input().split())\n\nres = 0\nM = N\nwhile M >= 1:\n M /= K\n res += 1\nprint(res)\n']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s378408266', 's464236054', 's370529211']
[12420.0, 12388.0, 12392.0]
[152.0, 160.0, 148.0]
[114, 112, 116]
p02766
u981028199
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['input_arr = input().split(" ")\nn = int(input_arr[0])\nk = int(input_arr[1])\n\nans = ""\n\nnum = n\nwhile(num > 0):\n ans += str(num % k)\n num //= k\n print(ans)\n\nprint(len(ans))', 'input_arr = input().split(" ")\nn = int(input_arr[0])\nk = int(input_arr[1])\n\nans = ""\n\nnum = n\nwhile(num > 0):\n ans += str(num % k)\n num //= k\n\nprint(len(ans))']
['Wrong Answer', 'Accepted']
['s962181074', 's616009672']
[3060.0, 3060.0]
[17.0, 17.0]
[179, 164]
p02766
u983109611
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['import math\n\nN = int(input())\nX = math.log(N + 1, 2)\nY = math.ceil(X)\n\nprint(Y)', 'import math\n\nN, R = map(int, input().split())\nX = math.log(N + 0.000001, R)\nY = math.ceil(X)\n\nprint(Y)']
['Runtime Error', 'Accepted']
['s863416953', 's530704390']
[2940.0, 2940.0]
[17.0, 17.0]
[79, 102]
p02766
u985041094
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['def B():\n n,r = list(map(int, input().split()))\n i = 1\n while True:\n if n < k**i:\n print(i)\n return\n i += 1\nB()', 'def B():\n n,k = list(map(int, input().split()))\n i = 1\n while True:\n if n < k**i:\n print(i)\n return\n i += 1\nB()']
['Runtime Error', 'Accepted']
['s697887467', 's192844714']
[2940.0, 2940.0]
[17.0, 17.0]
[156, 156]
p02766
u992910889
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K=map(int,input().split())\nans=0\nwhile N>0:\n N//M\n ans+=1\nprint(ans)', 'N,K=map(int,input().split())\ncnt=0\nwhile True:\n N=N//K\n cnt+=1\n if N==0:\n break\n\nprint(cnt)']
['Runtime Error', 'Accepted']
['s606818688', 's561572898']
[2940.0, 3064.0]
[17.0, 18.0]
[76, 107]
p02766
u993435350
2,000
1,048,576
Given is an integer N. Find the number of digits that N has in base K.
['N,K = map(int,input().split())\n\nans = ""\n\nwhile True:\n r = str(N % K)\n ans += r\n N = N // K\n if N < K:\n ans += str(N % K)\n ans = ans[::-1]\n if ans[0] == "0":\n ans = ans[1:]\n break\n \nprint(len(ans))', 'N,K = map(int,input().split())\n\nans = ""\n\nwhile True:\n r = str(N % K)\n ans += r\n N = N // K\n if N < K:\n ans += str(N % K)\n break\n\nans = ans[::-1]\nif ans[0] == "0":\n ans = ans[1:] \n\nprint(len(ans))']
['Wrong Answer', 'Accepted']
['s462550716', 's739094417']
[3060.0, 3060.0]
[17.0, 17.0]
[221, 208]
p02768
u001839988
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['s = input()\nn, a, b = s.split()\nn, a, b = int(n), int(a), int(b)\n\n\na0 = 1\na1 = 1 \nfor i in range(1, a+1):\n a0 = a0 * (n - i + 1) % 1000000007\n a1 = a1 * i % 1000000007\n\nb0 = 1\nb1 = 1 \nfor i in range(1, b+1):\n b0 = b0 * (n - i + 1) % 1000000007\n b1 = b1 * i % 1000000007\n\nA = (pow(2, n) - 1 - a0 * pow(a1, 1000000005) - b0 * pow(b1, 1000000005)) % 1000000007\n\ndef pow(x, n):\n ans = 1\n while n:\n if n % 2:\n ans = ans * x % 1000000007\n x *= x % 1000000007\n n >>= 1\n return ans % 1000000007\n\nprint(A)', 'def pow(x, n):\n ans = 1\n while n:\n if n % 2:\n ans = ans * x % 1000000007\n x *= x % 1000000007\n n >>= 1\n return ans % 1000000007\n\ns = input()\nn, a, b = s.split()\nn, a, b = int(n), int(a), int(b)\n\n\na0 = 1\na1 = 1 \nfor i in range(1, a+1):\n a0 = a0 * (n - i + 1) % 1000000007\n a1 = a1 * i % 1000000007\n\nb0 = 1\nb1 = 1 \nfor i in range(1, b+1):\n b0 = b0 * (n - i + 1) % 1000000007\n b1 = b1 * i % 1000000007\n\nA = (pow(2, n) - 1 - a0 * pow(a1, 1000000005) - b0 * pow(b1, 1000000005)) % 1000000007\n\nprint(A)\n']
['Time Limit Exceeded', 'Accepted']
['s987133414', 's695235247']
[199360.0, 3064.0]
[2106.0, 178.0]
[542, 543]
p02768
u003644389
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['mod = 10**9+7\n\ndef comb(n, r):\n x = 1\n y = 1\n if n-r<r:\n r = n-r\n for i in range(r):\n x *= n-i\n y *= (i*1)\n x %= mod\n y %= mod\n return x * pow(y, mod-2, mod) % mod\n\nn, a, b = map(int, input().split())\n\nprint((pow(2, n, mod)-comb(n, a)-comb(n, b)-1)%mod)', 'mod = 10**9+7\n\ndef comb(n, r):\n x = 1\n y = 1\n if n-r<r:\n r = n-r\n for i in range(r):\n x *= n-i\n y *= (i+1)\n x %= mod\n y %= mod\n return x * pow(y, mod-2, mod) % mod\n\nn, a, b = map(int, input().split())\n\nprint((pow(2, n, mod)-comb(n, a)-comb(n, b)-1)%mod)']
['Wrong Answer', 'Accepted']
['s498511161', 's746251671']
[3064.0, 3064.0]
[126.0, 157.0]
[303, 303]
p02768
u006883624
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['# from math import sqrt\n# from heapq import heappush, heappop\n# from collections import deque\nfrom functools import reduce\n# a, b = [int(v) for v in input().split()]\n\n\ndef main():\n\n mod = 1000000007\n\n def modpow(n, k, mod):\n if k == 0:\n return 1\n val = modpow(n, k // 2, mod)\n val = (val * val) % mod\n if k % 2 != 0:\n val *= n\n return val\n\n def modcmb(n, r, mod):\n if (r < 0 or r > n):\n return 0\n r = min(r, n - r)\n over = reduce(lambda v1, v2: v1 * v2 % mod, range(n, n-r, -1))\n under = reduce(lambda v1, v2: v1 * v2 % mod, range(1, r+1))\n return over * modpow(under, mod - 2, mod) % mod\n\n n, a, b = map(int, input().split())\n\n count = modpow(2, n, mod)\n count -= modcmb(n, a, mod)\n count -= modcmb(n, b, mod)\n\n while count < 0:\n count += mod\n\n print(count % mod)\n\n\nmain()\n', '#from math import sqrt\n#from heapq import heappush, heappop\n#from collections import deque\nfrom functools import reduce\n\n#a, b = [int(v) for v in input().split()]\n\n\ndef main():\n\n n, a, b = map(int, input().split())\n mod = 1000000007\n\n def pow(n, r):\n if r == 0:\n return 1\n val = pow(n, r // 2)\n val = val * val % mod\n if r % 2 == 1:\n val = val * n % mod\n return val\n\n def comb(n, r):\n over = 1\n under = 1\n for i in range(r):\n over = over * (n - i) % mod\n under = under * (i + 1) % mod\n\n return over * pow(under, mod - 2) % mod\n\n ans = pow(2, n) - 1 - comb(n, a) - comb(n, b) % mod\n while ans < 0:\n ans += mod\n print(ans)\n\n\nmain()\n']
['Runtime Error', 'Accepted']
['s720659695', 's613611665']
[3572.0, 3572.0]
[154.0, 150.0]
[911, 765]
p02768
u008357982
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\nmod = 10**9 + 7\nans = 0\nMAX = 500000000\nfac = [1, 1] + [0] * MAX\nfinv = [1, 1] + [0] * MAX\ninv = [0, 1] + [0] * MAX\nfor i in range(2, MAX):\n fac[i] = fac[i - 1] * i % mod\n inv[i] = -inv[mod % i] * (mod // i) % mod\n finv[i] = finv[i - 1] * inv[i] % mod\n\n\ndef neko(n, r):\n if n < r:\n return 0\n if n < 0 or r < 0:\n return 0\n return fac[n] * (finv[r] * finv[n - r] % mod) % mod\n\n\nif n % 2:\n for i in range((n + 1) // 2):\n ans += neko(n, i) * 2 % mod\n ans -= neko(n, a)\n ans -= neko(n, b)\n print(max(ans - 1, 0))\nelse:\n for i in range(n // 2):\n ans += neko(n, i) * 2 % mod\n ans += neko(n, n // 2)\n ans -= neko(n, a)\n ans -= neko(n, b)\n print(max(ans - 1, 0))\n', 'n, a, b = map(int, input().split())\nmod = 10**9 + 7\nans = 0\nMAX = 500000000\nfac = [1, 1] + [0] * MAX\nfinv = [1, 1] + [0] * MAX\ninv = [0, 1] + [0] * MAX\nfor i in range(2, MAX):\n fac[i] = fac[i - 1] * i % mod\n inv[i] = -inv[mod % i] * (mod // i) % mod\n finv[i] = finv[i - 1] * inv[i] % mod\n\n\ndef neko(n, r):\n if n < r:\n return 0\n if n < 0 or r < 0:\n return 0\n return fac[n] * (finv[r] * finv[n - r] % mod) % mod\n\n\nif n % 2:\n for i in range((n + 1) // 2):\n ans += neko(n, i) * 2 % mod\n ans -= neko(n, a)\n ans -= neko(n, b)\n print(max(ans - 1, 0))\nelse:\n for i in range(n // 2):\n ans += neko(n, i) * 2 % mod\n ans += neko(n, n // 2)\n ans -= neko(n, a)\n ans -= neko(n, b)\n print(max(ans - 1, 0))\n', 'n, a, b = map(int, input().split())\nmod = 10**9 + 7\n\n\ndef neko(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\nprint((pow(2, n, mod) - 1 - neko(n, a) - neko(n, b)) % mod)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s349818163', 's827318561', 's615088957']
[3064.0, 3064.0, 3060.0]
[18.0, 18.0, 151.0]
[763, 763, 273]
p02768
u011062360
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = 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**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) % mod )\n inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )\n g2.append( (g2[-1] * inverse[-1]) % mod )\nl = []\nfor r in range(1, n+1):\n if r != a and r != b:\n l.append(cmb(n,r,mod))\n\nprint(sum(l))', 'def cmb(n, r, p):\n r = min(r, n - r)\n upper = 1\n for i in range(n, n - r, -1):\n upper = (upper * i) % p\n\n lower = 1\n for i in range(1, r + 1):\n lower = (lower * i) % p\n\n \n return (upper * pow(lower, p - 2, p)) % p\n\nmod = pow(10, 9) + 7\nn, a, b = map(int, input().split())\nans = (pow(2, n, mod) - 1 - cmb(n, a, mod) - cmb(n, b, mod))%mod\nprint(ans)']
['Runtime Error', 'Accepted']
['s301020797', 's735419138']
[4336.0, 9008.0]
[29.0, 107.0]
[596, 451]
p02768
u017415492
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b = map(int, input().split())\nmod = 10**9+7\n\nakai=1\nnakai=n\nbkai=1\nnbkai=n\nfor i in range(2,a+1):\n akai=(akai%mod)*(i%mod)\n nakai=(nakai%mod)*((n-i+1)%mod)\nfor i in range(2,b+1):\n bkai=(bkai%mod)*(i%mod)\n nbkai=(nbkai%mod)*((n-i+1)%mod)\nakai=akai%mod\nbkai=bkai%mod\nnakai=nakai%mod\nnbkai=nbkai%mod\nnakai=nakai*pow(akai,mod-2,mod)\nnbkai=nbkai*pow(bkai,mod-2,mod)\nprint((pow(2,n,mod)-nakai-nbkai)%mod)', 'n,a,b = map(int, input().split())\nmod = 10**9+7\n\nakai=1\nnakai=n\nbkai=1\nnbkai=n\nfor i in range(2,a+1):\n akai=(akai%mod)*(i%mod)\n nakai=(nakai%mod)*((n-i+1)%mod)\nfor i in range(2,b+1):\n bkai=(bkai%mod)*(i%mod)\n nbkai=(nbkai%mod)*((n-i+1)%mod)\nakai=akai%mod\nbkai=bkai%mod\nnakai=nakai%mod\nnbkai=nbkai%mod\nnakai=nakai*pow(akai,mod-2,mod)\nnbkai=nbkai*pow(bkai,mod-2,mod)\nprint((pow(2,n,mod)-nakai-nbkai-1)%mod)']
['Wrong Answer', 'Accepted']
['s030019612', 's909317800']
[3064.0, 3064.0]
[193.0, 199.0]
[406, 408]
p02768
u021019433
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['from math import factorial\n\nM = 10**9 + 7\nn, a, b = map(int, input().split())\nr = pow(2, n, M) - 1\nc = 1\nfor i in range(b):\n c = c * (n - i) % M\n if i + 1 == a:\n a = b\n r -= c * pow(factorial(a), M - 2, M)\nprint(r % M)', 'M = 10**9 + 7\nn, a, b = map(int, input().split())\nr = pow(2, n, M) - 1\nf = c = 1\nfor i in range(b):\n f = f * (i + 1) % M\n c = c * (n - i) % M\n if i + 1 == a:\n a = b\n r -= c * pow(f, M - 2, M)\nprint(r % M)']
['Wrong Answer', 'Accepted']
['s180759201', 's343633569']
[5452.0, 3060.0]
[1492.0, 113.0]
[226, 213]
p02768
u021548497
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\nmod = 10**9+7\n\ndef nCr(n, r):\n r = min(r, n - r)\n if r == 0: return 1;\n if r == 1: return n;\n numerator = [n - r + i + 1 for i in range(r)]\n denominator = [i + 1 for i in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1: \n result *= numerator[k]\n result %= mod\n return int(result)\n\nans = (pow(2, n, mod)-1-(mod-nCr(n, a))-(mod-nCr(n, b)))%mod\nprint(ans)', 'n, a, b = map(int, input().split())\nmod = 10**9+7\n\ndef nCr(n, r):\n r = min(r, n - r)\n if r == 0: return 1;\n if r == 1: return n;\n numerator = [n - r + i + 1 for i in range(r)]\n denominator = [i + 1 for i in range(r)]\n for p in range(2, r + 1):\n pivot = denominator[p - 1]\n if pivot > 1:\n offset = (n - r) % p\n for k in range(p - 1, r, p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n result = 1\n for k in range(r):\n if numerator[k] > 1: \n result *= numerator[k]\n result %= mod\n return int(result)\n\nans = (pow(2, n, mod)-1-(mod-nCr(n, a))-(mod_nCr(n, b)))%mod\nprint(ans)', 'n, a, b = map(int, input().split())\nmod = 10**9+7\ndef comb(n, r, mod):\n if r == 0 or r == n:\n return 1\n r = min([r, n-r])\n x, y = 1, 1\n for i in range(1, r+1):\n x *= n+1-i\n x %= mod\n y *= i\n y %= mod\n return x*pow(y, mod-2, mod)%mod\n\nans = (pow(2, n, mod)+3*mod-1-comb(n, a, mod)-comb(n, b, mod))%mod\nprint(ans)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s437942489', 's476618734', 's361609027']
[27700.0, 27700.0, 3064.0]
[682.0, 326.0, 151.0]
[705, 705, 361]
p02768
u024782094
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['def mpow(a,n,m):\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,m))**2%m\n else:\n return a*pow(a,n-1,m)%m\n\nn,a,b=map(int,input().split())\nmod=1000000007\nprint((pow(2,n,mod)-1-mpow(n, a, mod)-mpow(n, b, mod))%mod)', 'import sys \nsys.setrecursionlimit(10**10)\n\ndef mod_combination(n, k, mod):\n def mod_permutation(n, k, mod):\n if n<=k:\n return 1\n else:\n return (n * mod_permutation(n-1,k,mod))%mod\n\n def mod_inv_permutation(k, mod):\n k, mod = int(k), int(mod)\n if k<=1:\n return 1\n else:\n return (pow(k,mod-2,mod) * mod_inv_permutation(k-1, mod))%mod\n\n return (mod_permutation(n,n-k,mod) * mod_inv_permutation(k, mod))%mod\n\nn,a,b=map(int,input().split())\nmod=1000000007\nprint(pow(2,n,mod)-1-mod_combination(n, a, mod)-mod_combination(n, b, mod))', 'def power(x, a):\n if a == 0:\n return 1\n elif a == 1:\n return x\n elif a % 2 == 0:\n return power(x, a//2) **2 % mod\n else:\n return power(x, a//2) **2 * x % mod\n\ndef modinv(x):\n return power(x, mod-2)\n\ndef binomial_coefficients(n, k):\n numera = 1 \n denomi = 1 \n\n for i in range(k):\n numera *= n-i\n numera %= mod\n denomi *= i+1\n denomi %= mod\n return numera * modinv(denomi) % mod\n\nn,a,b=map(int,input().split())\nmod=1000000007\nprint((pow(2,n,mod)-1-binomial_coefficients(n, a)-binomial_coefficients(n, b))%mod)']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s167255141', 's826688998', 's655175915']
[3064.0, 3064.0, 3064.0]
[18.0, 18.0, 158.0]
[260, 614, 592]
p02768
u025501820
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split(" "))\nfrom math import factorial\nc = n\nans = c\nfor i in range(1, n + 1):\n c *= (n - i) / (i + 1)\n if i + 1 != a and i + 1 != b:\n ans += c % (10 ** 9 + 7)\nif a == 1:\n ans -= n\nelif b == 1:\n ans -= n\nprint(ans)', 'n, a, b = map(int, input().split(" "))\nfrom math import factorial\nc = n\nans = c\n\nfor i in range(1, int(n // 2 - 1)):\n c *= (n - i) / (i + 1)\n if i + 1 != a and i + 1 != b:\n ans += c % (10 ** 9 + 7)\nans *= 2\nans += 1\nif n % 2 == 0:\n ans += factorial(n) / factorial(n - n / 2) / factorial(n / 2)\nans -= factorial(n) / factorial(n - a) / factorial(a)\nans -= factorial(n) / factorial(n - b) / factorial(b)\nprint(ans)', 'from math import factorial\nn, a, b = map(int, input().split(" "))\nmod = pow(10, 9) + 7\nans = pow(2, n, mod)\nans = (ans - 1) % mod\n\ndef reduce(ans, r):\n c = n % mod\n for i in range(1, r):\n c *= ((n - i) % mod) * pow(i + 1, mod - 2, mod)\n c %= mod\n ans -= c\n if ans < 0:\n ans += mod\n return ans % mod\n \nans = reduce(ans, a)\nans = reduce(ans, b)\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s473061811', 's768809266', 's319476592']
[3064.0, 3064.0, 3064.0]
[2104.0, 2104.0, 1541.0]
[260, 428, 392]
p02768
u026155812
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['from functools import reduce\nn, a, b = map(int, input().split())\nmod = 10**9 + 7\n\ndef f(A):\n bunsi = reduce(lambda x, y: x*y%mod, range(N, N-A, -1))\n bunbo = reduce(lambda x, y: x*y%mod, range(1, A+1))\n return bunsi * pow(bunbo, mod-2, mod) % mod\n \nans = pow(2, n, mod) - f(a) -f(b) - 1\nans %= mod\nprint(ans)', 'n, a, b = map(int, input().split())\nmod = 10**9 + 7\nans = 0\n\n\nf = 1\nfor i in range(1, n+1):\n f *= i\n f %= mod\n\ninv = pow(f, mod-2, mod)\nfor i in range(1, n+1):\n if i != a or i != b:\n ans += inv*i%mod\nprint(ans)', 'from functools import reduce\nn, a, b = map(int, input().split())\nmod = 10**9 + 7\n\ndef comb(N, A, MOD):\n num = reduce(lambda x, y: x * y % MOD, range(N, N - A, -1))\n den = reduce(lambda x, y: x * y % MOD, range(1, A + 1))\n return num * pow(den, MOD - 2, MOD) % MOD\n\nprint((pow(2, n, mod) - 1 - comb(n, a, mod) - comb(n, b, mod))%mod)']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s827365706', 's999322461', 's905544056']
[3572.0, 3064.0, 9588.0]
[22.0, 2104.0, 144.0]
[318, 258, 341]
p02768
u027547861
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import math\n\nn, a, b = list(map(int, input().split()))\nMAX = 510000\nMOD = 1000000007\n\nfac = [0 for i in range(MAX)]\nfinv = [0 for i in range(MAX)]\ninv = [0 for i in range(MAX)]\ncom = [0 for i in range(MAX)]\n\nprint(fac[1])\n\ndef cominit() :\n fac[0] = fac[1] = 1\n finv[0] = finv[1] = 1\n inv[1] = 1\n com[1] = n\n for i in range(2, MAX) :\n fac[i] = fac[i-1] * i % MOD\n inv[i] = MOD - inv[MOD%i] * int(MOD / i) % MOD\n finv[i] = finv[i-1] * inv[i] % MOD\n com[i] = com[i-1] * (n-(i-1)) * inv[i] % MOD\n \n return fac, finv, inv, com\n \n"""\ndef combination(n, r, inv) :\n ans = 1\n if(n < r) : \n return 0\n if((n < 0) or (r < 0)) :\n return 0\n for i in range(0, r) :\n return (fac[n] * (finv[r] * finv[n-r] % MOD) % MOD) \n """\n\ndef two_n_mod(n) :\n ans = 1\n while(n > 32) :\n ans = ans * 2**32 % MOD\n n -= 32\n return ans * 2**n % MOD\n\ntemp = cominit()\n##print(two_n_mod(1000000000))\nprint((two_n_mod(n) - 1 - com[a] - com[b]) % MOD)\n\n', 'n, a, b = list(map(int, input().split()))\nMAX = 510000\nMOD = 1000000007\n\n\nfac = [0 for i in range(MAX)]\nfinv = [0 for i in range(MAX)]\ninv = [0 for i in range(MAX)]\ncom = [0 for i in range(MAX)]\npower = [2 for i in range(32)]\n\nfor i in range(1, 32) :\n power[i] = power[i-1] * power[i-1] % MOD\n\ndef cominit() :\n fac[0] = fac[1] = 1\n finv[0] = finv[1] = 1\n inv[1] = 1\n com[1] = n\n for i in range(2, MAX) :\n fac[i] = fac[i-1] * i % MOD\n inv[i] = MOD - inv[MOD%i] * int(MOD / i) % MOD\n finv[i] = finv[i-1] * inv[i] % MOD\n com[i] = com[i-1] * (n-(i-1)) * inv[i] % MOD\n \n return fac, finv, inv, com\n\n\ndef two_n_mod(n) :\n ans = 1\n temp_i = 0\n temp = [0 for i in range(32)]\n \n for i in range(32) :\n temp[i] += n%2\n n = int(n/2)\n ans = (2**n) % MOD\n for i in range(32) :\n ans = ans * (power[i] ** temp[i]) % MOD\n return ans\n\ntemp = cominit()\n##print(two_n_mod(1000000000))\n##print(2**n % MOD)\nprint((two_n_mod(n) - 1 - com[a] - com[b]) % MOD)\n\n']
['Wrong Answer', 'Accepted']
['s120796602', 's833190055']
[85864.0, 83888.0]
[2109.0, 1054.0]
[957, 976]
p02768
u029000441
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['a=pow(2,10**7,10**9+7)\nprint(a)', 'import math\nnumbers =input().rstrip().split(" ")\nN =int(numbers[0])\na =int(numbers[1])\nb =int(numbers[2])\nYa=math.factorial(a)\nYb=math.factorial(b)\nXa=1\nXb=1\nfor i in range(a):\n Xa=Xa*(N-i)\nfor i in range(b):\n Xb=Xb*(N-i)\n\nd=1000000007\n#answer is 2**N-nca-ncb-1 mod d\nA=pow(2,N)\nB=Xa*pow(Ya,d-2)\nC=Xb*pow(Yb,d-2)\nanswer=(A+B+C-1)%d\nprint(answer)', 'a=pow(2,10**7)\nprint(a)\n', 'def cmod(n, r, p):\n x,y = 1, 1\n for i in range(r):\n x = x * (n - i) % p\n y = y * (r - i) % p\n return (x * pow(y, p - 2, p)) % p\n\n\nn, a, b = map(int, (input().split()))\np = 10 ** 9 + 7\nprint((pow(2, n, p) - 1 - cmod(n, a, p) - cmod(n, b, p)) % p)\n']
['Wrong Answer', 'Time Limit Exceeded', 'Time Limit Exceeded', 'Accepted']
['s117380777', 's266221539', 's710937761', 's677885362']
[2940.0, 165828.0, 7160.0, 3060.0]
[17.0, 2108.0, 2104.0, 133.0]
[31, 351, 24, 270]
p02768
u033524082
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b=map(int,input().split())\nans=2**n-1\nn1=1\nn2=1\nfor i in range(a):\n n1*=n-i\n n1//=i+1\nfor j in range(b):\n n2*=n-i\n n2//=i+1\nprint(ans-n1-n2)', 'n,a,b=map(int,input().split())\nans=2**n\nn1=1\nn2=1\nfor i in range(a):\n n1*=n-i\n n1//=i+1\nfor j in range(b):\n n2*=n-i\n n2//=i+1\nprint(ans-n1-n2)', 'n,a,b=map(int,input().split())\nans=2**n-1\nn1=1\nn2=1\nfor i in range(a):\n n1*=n-i\n n1/=i+1\nfor j in range(b):\n n2*=n-i\n n2/=i+1\nprint(int(ans-n1-n2))', 'n,a,b=map(int,input().split())\nmod=10**9+7\n\ndef comb(n,r):\n P=1\n R=1\n for i in range(r):\n P=P*(n-i)%mod\n R=R*(r-i)%mod\n return P*pow(R,mod-2,mod)%mod\n\ncombN=pow(2,n,mod)-1\nprint((combN-comb(n,a)-comb(n,b))%mod)']
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s124691530', 's673604196', 's688024977', 's063186467']
[199272.0, 199388.0, 199268.0, 3064.0]
[2107.0, 2108.0, 2106.0, 142.0]
[156, 154, 159, 236]
p02768
u038408819
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\ndef cmb(n, r, p):\n ans = 1\n for i in range(1, r + 1):\n ans *= \n ans /= i\n ans %= mod\n return int(ans)\n p = 10 ** 9 + 7\nN = 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) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\nimport math\nmod = 10 ** 9 + 7\nres = pow(2, n, mod) - 1 - mod_comb(n, a, mod) - mod_comb(n, b, mod)\nprint(res % mod)', 'n, a, b = map(int, input().split())\ndef mod_comb(n, r, mod):\n ans = 1\n for i in range(1, r + 1):\n ans *= n - (i - 1)\n ans %= mod\n ans *= inv[i]\n ans %= mod\n return int(ans)\n p = 10 ** 9 + 7\nN = 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) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\nimport math\nmod = 10 ** 9 + 7\nres = pow(2, n, mod) - 1 - mod_comb(n, a, mod) - mod_comb(n, b, mod)\nprint(res % mod)\n', 'n, a, b = map(int, input().split())\ndef mod_comb(n, r, mod):\n ans = 1\n for i in range(1, r + 1):\n ans *= n - (i - 1)\n ans %= mod\n ans *= inv[i]\n ans %= mod\n return int(ans)\np = 10 ** 9 + 7\nN = 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) % p)\n inv.append((-inv[p % i] * (p // i)) % p)\n factinv.append((factinv[-1] * inv[-1]) % p)\nimport math\nmod = 10 ** 9 + 7\nres = pow(2, n, mod) - 1 - mod_comb(n, a, mod) - mod_comb(n, b, mod)\nprint(res % mod)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s438138403', 's990920498', 's935062483']
[2940.0, 2940.0, 122064.0]
[17.0, 17.0, 1568.0]
[549, 592, 591]
p02768
u039189422
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['mod=10**9+7\n\nn,a,b=map(int,input().split())\nres=pow(2,n,mod)\nres=(res-1)%mod\n\nup=1\ndown=1\nfor i in range(1,b+1):\n\tup*=(n-i+1)\n\tup%mod\n\tdown*=i\n\tif i==a:\n\t\tupa=up\n\t\tdowna=down\n\nnca=upa%mod\nnca*=pow(downa,mod-2,mod)\nnca%=mod\nncb=(up%mod)\nncb=*pow(down,mod-2,mod)\nncb%=mod\nprint((res-nca-ncb)%mod)', 'mod=10**9+7\n\nn,a,b=map(int,input().split())\nres=pow(2,n,mod)\nres=(res-1)%mod\n\nncb=1\nfor i in range(1,b+1):\n\tncb*=(n-i+1)*pow(i,mod-2,mod)\n\tncb%=mod\n\tif i==a:\n\t\tnca=ncb\n\t\t\nprint((res-nca-ncb)%mod)']
['Runtime Error', 'Accepted']
['s933182734', 's544151859']
[3064.0, 3064.0]
[18.0, 815.0]
[294, 195]
p02768
u052221988
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\nmod = 10**9 + 7\n\ndef comb(n, r, mod) :\n ans1 = 1\n ans2 = 1\n for i in range(r) :\n ans1 *= n-i\n ans2 *= i+1\n return ans1 * pow(ans2, mod-2, mod)\n\nprint(pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1)', 'n, a, b = map(int, input().split())\nmod = 10**9 + 7\n\ndef comb(n, r, mod) :\n ans1 = 1\n ans2 = 1\n for i in range(r) :\n ans1 = (ans1 * (n-i)) % mod\n ans2 = (ans2 * (i+1)) % mod\n return ans1 * pow(ans2, mod-2, mod)\n\nans = pow(2, n, mod) - comb(n, a, mod) - comb(n, b, mod) - 1\nprint(ans%mod)']
['Wrong Answer', 'Accepted']
['s526339438', 's276677531']
[3688.0, 3064.0]
[2104.0, 143.0]
[267, 313]
p02768
u054514819
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['from scipy.misc import comb\nn, a, b = map(int, input().split())\nsum = 0\nfor i in range(1, n+1):\n if i in (a, b):\n continue\n else:\n sum += comb(n, i)\nprint(int(sum))', 'def comb(n, k, mod):\n r = min(k, n-k)\n p = q = 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\nn, a, b = map(int, input().split())\nmod = (10**9+7)\nans = (pow(2, n, mod)-comb(n, a, mod)-comb(n, b, mod)-1)%mod\nprint(ans)']
['Wrong Answer', 'Accepted']
['s890185566', 's121640754']
[15568.0, 3064.0]
[2112.0, 143.0]
[172, 272]
p02768
u070201429
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
["#TLE\n\nn, a, b = map(int, input().split())\n\n\nna = list(bin(n))\nnb = na[3:]\n\nans = 2\n\nfor b in nb:\n if b == '0':\n ans **= 2\n else:\n ans = (ans ** 2) * 2\n\nif n == 0:\n ans = 1\n\n\ndef comb(n, r):\n m = 1\n for i in range(n-r+1, n+1):\n m *= i\n for i in range(1, r+1):\n m //= i\n return m\nans -= comb(n, a) + comb(n, b) + 1\n\nprint(int(ans % (1000000007)))", '#TLE\n\n#comb_mod(n, r, mod) = nCr % mod\ndef comb_mod(n, r, mod):\n ans = 1\n if r <= n/2:\n for i in range(n-r+1, n+1):\n ans *= i\n ans %= mod\n for i in range(1, r+1):\n ans *= pow(i, mod-2, mod)\n ans %= mod\n else:\n for i in range(r+1, n+1):\n ans *= i\n ans %= mod\n for i in range(1, n-r+1):\n ans *= pow(i, mod-2, mod)\n ans %= mod\n return ans\n\nn, a, b = map(int, input().split())\nans = pow(2, n, 10**9+7) - comb_mod(n, a, 10**9+7) - comb_mod(n, b, 10**9+7) - 1\nif ans < 0:\n ans += 10**9 + 7\nif ans < 0:\n ans += 10**9 + 7\n\nprint(int(ans))']
['Runtime Error', 'Accepted']
['s731240956', 's651106374']
[238688.0, 3064.0]
[2107.0, 1516.0]
[441, 664]
p02768
u072717685
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
["def main():\n n, a, b = map(int, input().split())\n p = 10 ** 9 + 7\n r = pow(2, n, p) - 1\n if (n - a) < a:\n a = n - a\n if (n - b) < b:\n b = n - b\n fac_na = 1\n for i1 in range(n, n - a, -1):\n fac_na = (fac_na * i1) % p\n fac_nb = 1\n for i1 in range(n, n - b, -1):\n fac_nb = (fac_nb * i1) % p\n fac_a = 1\n for i1 in range(a+1):\n fac_a = (fac_a * i1) % p\n fac_b = 1\n for i1 in range(b+1):\n fac_b = (fac_b * i1) % p\n\n an = fac_na * pow(fac_a ,p-2, p)\n bn = fac_nb * pow(fac_b, p-2, p)\n r -= an\n if r < 0:\n r += p\n r -= bn\n if r < 0:\n r += p\n print(int(r))\n\n\nif __name__ == '__main__':\n main()\n", 'def main():\n from math import factorial\n n, a, b = map(int, input().split())\n p = 1000000007\n\n \n n_all = pow(2, n, p) -1\n\n \n a_comb = 0 \n a_comb_x = 1 計算の分子。n*(n-1)*…*(n-r+1)のmod p\n a_comb_y = 1 計算の分母。r!のmod pにおける逆元\n for i in range(n, n-a ,-1):\n a_comb_x *= i\n a_comb_x %= p\n a_comb_y = factorial(a)\n a_comb_y = pow(a_comb_y, p-2,p)\n a_comb = (a_comb_x * a_comb_y) % p\n\n b_comb = 0 \n b_comb_x = 1 \n b_comb_y = 1 \n for i in range(n, n-b ,-1):\n b_comb_x *= i\n b_comb_x %= p\n b_comb_y = factorial(b)\n b_comb_y = pow(b_comb_y, p-2,p)\n b_comb = (b_comb_x * b_comb_y) % p\n\n \n r = n_all - a_comb - b_comb\n if r < 0:\n r += p\n print(r)\n\nmain()', "def main():\n n, a, b = map(int, input().split())\n p = 10 ** 9 + 7\n r = pow(2, n, p) - 1\n if (n - a) < a:\n a = n - a\n if (n - b) < b:\n b = n - b\n fac_na = 1\n for i1 in range(n, n - a, -1):\n fac_na = (fac_na * i1) % p\n fac_nb = 1\n for i1 in range(n, n - b, -1):\n fac_nb = (fac_nb * i1) % p\n fac_a = 1\n for i1 in range(1, a+1):\n fac_a = (fac_a * i1) % p\n fac_b = 1\n for i1 in range(1, b+1):\n fac_b = (fac_b * i1) % p\n\n an = fac_na * pow(fac_a, p-2, p)\n bn = fac_nb * pow(fac_b, p-2, p)\n an = an % p\n bn = bn % p\n r -= an\n if r < 0:\n r += p\n r -= bn\n if r < 0:\n r += p\n if r < 0:\n r += p\n print(int(r))\n\n\nif __name__ == '__main__':\n main()"]
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s152138869', 's171164194', 's060725280']
[9248.0, 5464.0, 9132.0]
[87.0, 1505.0, 116.0]
[704, 1059, 770]
p02768
u078932560
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = list(map(int, input().split()))\n\np = 10**9 + 7\n\ndef pow_mod(n, m, p):\n if m == 0:\n return 1\n elif m % 2 == 0:\n nm2p = pow_mod(n, m//2, p)\n return (nm2p * nm2p) % p\n elif m % 2 == 1:\n return (pow_mod(n, m-1, p) * (n % p)) % p\n\ntot = 2 ** n - 1\n\ndef compute_ncr_mod(n, r, p):\n n_factorial = 1\n for i in range(n, n-r, -1):\n n_factorial *= i\n r_factorial = 1\n for i in range(r, 0, -1):\n r_factorial *= i\n ncr_modp = ((n_factorial % p) * pow_mod(r_factorial, p-2, p)) % p\n return ncr_modp\n\nprint(tot - compute_ncr_mod(n, a, p) - compute_ncr_mod(n, a, b))', 'import math\n\nn, a, b = list(map(int, input().split()))\n\np = 10**9 + 7\n\ndef pow_mod(n, m, p):\n if m == 0:\n return 1\n elif m % 2 == 0:\n nm2p = pow_mod(n, m//2, p)\n return (nm2p * nm2p) % p\n elif m % 2 == 1:\n return (pow_mod(n, m-1, p) * (n % p)) % p\n\ndef compute_ncr_mod(n, r, p):\n r = min(n-r, r)\n n_factorial = 1\n r_factorial = 1\n for i in range(1, r+1):\n n_factorial *= n-i+1\n n_factorial %= p\n r_factorial *= i\n r_factorial %= p\n ncr_modp = (n_factorial * pow_mod(r_factorial, p-2, p)) % p\n return ncr_modp\n\nprint((pow_mod(2, n, p) - 1 - compute_ncr_mod(n, a, p) - compute_ncr_mod(n, b, p)) % p)']
['Wrong Answer', 'Accepted']
['s787851177', 's078367692']
[199320.0, 3064.0]
[2106.0, 152.0]
[586, 630]
p02768
u085717502
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['#!/usr/bin/env python\n# coding: utf-8\n\n# In[23]:\n\n\nn,a,b = map(int, input().split())\n\n\n# In[24]:\n\n\ndef nCk(n, k, mod):\n a = 1\n for i in range(n, n-k, -1):\n a *= i\n a %= mod\n b = 1\n for i in range(1, k+1):\n b *= i\n b %= mod\n a *= pow(b, mod-2, mod)\n return a\n\n\n# In[25]:\n\n\nans = pow(2, n, mod)-1\nans -= nCk(n, a, mod) + nCk(n, b, mod)\nprint(ans%mod)\n\n\n# In[ ]:\n\n\n\n\n', '#!/usr/bin/env python\n# coding: utf-8\n\n# In[14]:\n\n\nimport math\n\n\n# In[21]:\n\n\ndef nCk(n, k, mod):\n a = 1\n for i in range(n, n-k, -1):\n a *= i\n a %= mod\n b = 1\n for i in range(1, k+1):\n b *= i\n b %= mod\n a *= pow(b, mod-2, mod)\n return a\n\n\n# In[22]:\n\n\nans = pow(2, n, mod)-1\nans -= nCk(n, a, mod) + nCk(n, b, mod)\nprint(ans%mod)\n\n\n# In[ ]:\n\n\n\n\n', '#!/usr/bin/env python\n# coding: utf-8\n\n# In[1]:\n\n\nn,a,b = map(int, input().split())\n\n\n# In[2]:\n\n\ndef nCk(n, k, mod):\n a = 1\n for i in range(n, n-k, -1):\n a *= i\n a %= mod\n b = 1\n for i in range(1, k+1):\n b *= i\n b %= mod\n a *= pow(b, mod-2, mod)\n return a\n\n\n# In[3]:\n\n\nmod = 10**9+7\nans = pow(2, n, mod)-1\nans -= nCk(n, a, mod) + nCk(n, b, mod)\nprint(ans%mod)\n\n\n# In[ ]:\n\n\n\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s675210342', 's699178453', 's398301005']
[9104.0, 9072.0, 9144.0]
[23.0, 24.0, 112.0]
[410, 388, 421]
p02768
u089142196
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b= map(int,input().split())\np=10**9+7\n\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 comb(n, k, mod):\n a=framod(n, mod)\n b=framod(k, mod)\n c=framod(n-k, mod)\n return (a * pow(b, mod-2, mod) * pow(c, mod-2, mod)) % mod\n \nA= comb(n,a,p)\nB= comb(n,b,p)\n\nif n>=4:\n print(2**(n-1)-(A+B))\nelif n==2:\n print(0)\nelse:\n if a+b==5:\n print(0)\n else:\n print(2**(n-1)-(A+B))', 'def framod(x,y,p=10**9+7):\n for i in range(x+1,y+1):\n x = (x*i)%p\n return x\n \n#########################################\n\nn,a,b=map(int,input().split())\np=10**9+7\n\nans=0\nfor i in [a,b]:\n upper = framod(n-i+1,n,p)\n lower = framod(1,i,p)\n ret = (upper*pow(lower,p-2,p))%p\n ans = (ans+ret)%p\nprint((pow(2,n,p)-ans-1)%p)']
['Wrong Answer', 'Accepted']
['s389380661', 's427670018']
[3064.0, 3064.0]
[2104.0, 111.0]
[439, 327]
p02768
u091852005
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input())\nm = 10 ** 9 + 7\n\ndef combn(n, r, m):\n X = Y = 1\n if n-r < r:\n r = n-r\n for i in range(1, r+1):\n Y = Y*i % m\n X = X*(n-i+1) % m\n Y = pow(Y, m-2, m)\n return X*Y\n \nprint((pow(2, n, m) - 1 - combn(n, a, m) - combn(n ,b, m)) % m)', 'n, a, b = map(int, input().split())\nm = 10 ** 9 + 7\n\ndef combn(n, r, m):\n X = Y = 1\n if n-r < r:\n r = n-r\n for i in range(1, r+1):\n Y = Y*i % m\n X = X*(n-i+1) % m\n Y = pow(Y, m-2, m)\n return X*Y\n \nprint((pow(2, n, m) - 1 - combn(n, a, m) - combn(n ,b, m)) % m)\n']
['Runtime Error', 'Accepted']
['s899573929', 's116175860']
[3064.0, 3060.0]
[17.0, 143.0]
[289, 298]
p02768
u104282757
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['LARGE = 10 ** 9 + 7\n\n\ndef solve(n, a, b):\n\n pow_ab = [1] * (b + 1)\n for i in range(b):\n pow_ab[i + 1] = pow_ab[i] * (i + 1)\n pow_ab_inv = [1] * (b + 1)\n pow_ab_inv[-1] = pow(pow_ab[-1], LARGE - 2, LARGE)\n for i in range(b - 1, 0, -1):\n pow_ab_inv[i] = pow_ab_inv[i + 1] * (i + 1) % LARGE\n\n res_all = pow(2, n, LARGE) - 1\n res_ab = 1\n for i in range(a):\n res_ab *= (n - i)\n res_all -= res_ab * pow_ab_inv[a]\n for i in range(a, b):\n res_ab *= (n - i)\n res_all -= res_ab * pow_ab_inv[b]\n return res_all % LARGE\n\n\ndef main():\n n, a, b = map(int, input().split())\n res = solve(n, a, b)\n print(res)\n\n\ndef test():\n assert solve(4, 1, 3) == 7\n assert solve(1000000000, 141421, 173205) == 34076506\n\n\nif __name__ == "__main__":\n test()\n main()\n', 'LARGE = 10 ** 9 + 7\n\n\ndef solve(n, a, b):\n\n pow_ab = [1] * (b + 1)\n for i in range(b):\n pow_ab[i + 1] = pow_ab[i] * (i + 1) % LARGE\n pow_ab_inv = [1] * (b + 1)\n pow_ab_inv[-1] = pow(pow_ab[-1], LARGE - 2, LARGE)\n for i in range(b - 1, 0, -1):\n pow_ab_inv[i] = pow_ab_inv[i + 1] * (i + 1) % LARGE\n\n res_all = pow(2, n, LARGE) - 1\n res_ab = 1\n for i in range(a):\n res_ab *= (n - i)\n res_ab %= LARGE\n res_all -= res_ab * pow_ab_inv[a]\n for i in range(a, b):\n res_ab *= (n - i)\n res_ab %= LARGE\n res_all -= res_ab * pow_ab_inv[b]\n return res_all % LARGE\n\n\ndef main():\n n, a, b = map(int, input().split())\n res = solve(n, a, b)\n print(res)\n\n\ndef test():\n assert solve(4, 1, 3) == 7\n assert solve(1000000000, 141421, 173205) == 34076506\n\n\nif __name__ == "__main__":\n test()\n main()\n']
['Time Limit Exceeded', 'Accepted']
['s849460844', 's982835589']
[0.0, 18856.0]
[2278.0, 272.0]
[819, 875]
p02768
u106311097
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
["#!python3.4\n# -*- coding: utf-8 -*-\n# abc156/abc156_d\nimport sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [i2s() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\nMAX = 2 * 10**5 + 10\nMOD = 10**9 + 7\n\nfac = [1, 1] + [0] * MAX\nfor i in range(2, MAX):\n fac[i] = fac[i - 1] * i % MOD\n\ndef getP(n, a, b):\n _n = n\n for i in range(1, a):\n _n = (_n * (n - i)) % MOD\n P_a = _n\n for i in range(a, b):\n _n = (_n * (n - i)) % MOD\n P_b = _n\n return (P_a, P_b)\n\ndef main():\n n, a, b = i2nn()\n all_C = (pow(2, n, MOD) - 1) % MOD\n P_a, P_b = getP(n, a, b)\n C_a = (P_a * pow(fac[a], MOD-2, MOD)) % MOD\n C_b = (P_b * pow(fac[b], MOD-2, MOD)) % MOD\n print(all_C, P_a, P_b)\n print((MOD + all_C - C_a - C_b) % MOD)\n return\n\nmain()\n", "#!python3.4\n# -*- coding: utf-8 -*-\n# abc156/abc156_d\nimport sys\n\ns2nn = lambda s: [int(c) for c in s.split(' ')]\nss2nn = lambda ss: [int(s) for s in list(ss)]\nss2nnn = lambda ss: [s2nn(s) for s in list(ss)]\ni2s = lambda: sys.stdin.readline().rstrip()\ni2n = lambda: int(i2s())\ni2nn = lambda: s2nn(i2s())\nii2ss = lambda n: [i2s() for _ in range(n)]\nii2nn = lambda n: ss2nn(ii2ss(n))\nii2nnn = lambda n: ss2nnn(ii2ss(n))\n\nMAX = 2 * 10**5 + 10\nMOD = 10**9 + 7\n\nfac = [1, 1] + [0] * MAX\nfor i in range(2, MAX):\n fac[i] = fac[i - 1] * i % MOD\n\ndef getP(n, a, b):\n _n = n\n for i in range(1, a):\n _n = (_n * (n - i)) % MOD\n P_a = _n\n for i in range(a, b):\n _n = (_n * (n - i)) % MOD\n P_b = _n\n return (P_a, P_b)\n\ndef main():\n n, a, b = i2nn()\n all_C = (pow(2, n, MOD) - 1) % MOD\n P_a, P_b = getP(n, a, b)\n C_a = (P_a * pow(fac[a], MOD-2, MOD)) % MOD\n C_b = (P_b * pow(fac[b], MOD-2, MOD)) % MOD\n print((MOD + all_C - C_a - C_b) % MOD)\n return\n\nmain()\n"]
['Wrong Answer', 'Accepted']
['s920346806', 's575976615']
[10968.0, 10968.0]
[116.0, 115.0]
[1026, 999]
p02768
u106342872
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b = map(int, input().split())\n\nM = 10**9 + 7\n\nimport math\n\ndef my_pow(x, n):\n if n == 0:\n return 1\n if n % 2 == 0:\n return my_pow(x ** 2, n // 2) % M\n else:\n return x * my_pow(x ** 2, (n - 1) // 2) % M\n\nfrom scipy.misc import comb\n\nall_pattern = my_pow(2, n)\ndislike = comb(n, a, exact=True) + comb(n, b, exact=True)\ndislike = dislike % M\n\nprint( (all_pattern - dislike - 1) )\n', 'n, a, b = map(int, input().split())\n\nM = 10 ** 9 + 7\n\nall = pow(2, n, M) - 1\nall %= M\n\ndef C(n,x):\n num = 1\n den = 1\n for i in range(x):\n num *= (n-i)\n num %= M\n den *= (i+1)\n den %= M\n\n inv = pow(den, M-2, M)\n\n return num * inv % M\n\nans = all - C(n,a) - C(n,b)\nans %= M\nprint(ans)']
['Time Limit Exceeded', 'Accepted']
['s114088259', 's828634706']
[222964.0, 9184.0]
[2112.0, 125.0]
[411, 324]
p02768
u106778233
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b =map(int,input().split())\nsum=0\nfor i in range(n) :\n if i == a :\n continue\n elif i == b :\n continue\n else :\n sum+=pow(n)/(pow(i)*pow(n-i))\n\nprint(sum%1000000007)', 'def com(n, r, mod):\n num = 1\n denom = 1\n for i in range(r):\n denom = (denom * (i+1)) % mod\n num = (num * (n-i)) % mod\n return num*pow(denom, 1, mod)\n\nn, a, b = map(int,input().split())\n\nmod = 10**9 + 7\n\nsum = pow(2, n, mod) - 1\nsum -= com(n, a, mod)\nsum -= com(n, b, mod)\n\nprint(int(sum % mod))\n', 'def com(n, r, mod):\n num = 1\n denom = 1\n for i in range(r):\n denom = (denom * (i+1)) % mod\n num = (num * (n-i)) % mod\n return num*pow(denom, mod-3, mod)\n\nn, a, b = map(int,input().split())\n\nmod = 10**9 + 7\n\nsum = pow(2, n, mod) - 1\nsum -= com(n, a, mod)\nsum -= com(n, b, mod)\n\nprint(int(sum % mod))\n', 'n,a,b =map(int,input().split())\nsum=0\nimport math\n\nfor i in range(n) :\n if i == a :\n continue\n elif i == b :\n continue\n else :\n sum+=math.factorial(n)/(math.factorial(i)*math.factorial(n-i))\n\nprint(sum%1000000007)', 'def com(n, r, mod):\n num = 1\n denom = 1\n for i in range(r):\n denom = (denom * (i+1)) % mod\n num = (num * (n-i)) % mod\n return num*pow(denom, mod-1, mod)\n\nn, a, b = map(int,input().split())\n\nmod = 10**9 + 7\n\nsum = pow(2, n, mod) - 1\nsum -= com(n, a, mod)\nsum -= com(n, b, mod)\n\nprint(int(sum % mod))\n', 'def com(n, r, mod):\n num = 1\n denom = 1\n for i in range(r):\n denom = (denom * (i+1)) % mod\n num = (num * (n-i)) % mod\n return num*pow(denom, mod-2, mod)\n\nn, a, b = map(int,input().split())\n\nmod = 10**9 + 7\n\nsum = pow(2, n, mod) - 1\nsum -= com(n, a, mod)\nsum -= com(n, b, mod)\n\nprint(int(sum % mod))\n']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s286754856', 's319979700', 's469116132', 's701411100', 's970619906', 's812151791']
[2940.0, 3064.0, 3064.0, 7772.0, 3064.0, 3064.0]
[18.0, 143.0, 144.0, 2104.0, 143.0, 144.0]
[197, 321, 325, 243, 325, 325]
p02768
u111497285
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\n\nn = 10 ** 9\nk = 2 * 10 ** 5\nmod = 10**9 + 7\n\n\ndef power(x, a):\n if a == 0:\n return 1\n elif a == 1:\n return x\n elif a % 2 == 0:\n return power(x, a//2) **2 % mod\n else:\n return power(x, a//2) **2 * x % mod\n\n\n# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6\ndef modinv(x):\n return power(x, mod-2)\n\ndef binomial_coefficients(n, k):\n numera = 1 \n denomi = 1 \n\n for i in range(k):\n numera *= n-i\n numera %= mod\n denomi *= i+1\n denomi %= mod\n return numera * modinv(denomi) % mod\n\n\nprint((((power(2, n) - binomial_coefficients(n, a)) % mod) - binomial_coefficients(n, b)) % mod - 1)\n\n', 'q, a, b = map(int, input().split())\n\nn = 10 ** 9\nk = 2 * 10 ** 5\nmod = 10**9 + 7\n\n\ndef power(x, a):\n if a == 0:\n return 1\n elif a == 1:\n return x\n elif a % 2 == 0:\n return power(x, a//2) **2 % mod\n else:\n return power(x, a//2) **2 * x % mod\n\n\n# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6\ndef modinv(x):\n return power(x, mod-2)\n\ndef binomial_coefficients(n, k):\n numera = 1 \n denomi = 1 \n\n for i in range(k):\n numera *= n-i\n numera %= mod\n denomi *= i+1\n denomi %= mod\n return numera * modinv(denomi) % mod\n\n\nprint(((((power(2, q) - binomial_coefficients(q, a)) % mod) - binomial_coefficients(q, b)) % mod - 1) % mod)\n\n']
['Wrong Answer', 'Accepted']
['s566902374', 's042862871']
[3064.0, 3064.0]
[156.0, 156.0]
[934, 942]
p02768
u112317104
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['def ten_to_n(X, n):\n i = int(X / n)\n s = str(X % n)\n if (i):\n return ten_to_n(i, n) + s\n return s\n\ndef solve():\n N, M = map(int, input().split())\n n = ten_to_n(N, M)\n return len(n)\n \nprint(solve())\n', 'def solve():\n n, a, b = list(map(int, input().split()))\n MOD = 10 ** 9 + 7\n fact = [1, 1]\n factinv = [1, 1]\n inv = [0, 1]\n \n for i in range(2, max(a, b)+1):\n fact.append((fact[-1] * i) % MOD)\n inv.append((-inv[MOD % i] * (MOD // i)) % MOD)\n factinv.append((factinv[-1] * inv[-1]) % MOD)\n \n def ncr(n, r):\n ret = factinv[r]\n for i in range(n, n-r, -1):\n ret = ret * i % MOD\n return ret\n \n ans = pow(2, n, MOD)\n ans = (ans-ncr(n, a)-ncr(n, b)-1) % MOD\n return ans\n\n\nprint(solve())\n']
['Runtime Error', 'Accepted']
['s513618350', 's500495228']
[2940.0, 27112.0]
[18.0, 247.0]
[226, 575]
p02768
u115110170
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['def comb_mod(n,m,mod):\n p = q = 1\n for i in range(m):\n p = p*(n-i) % mod\n q = q*(i+1) % mod\n return p* pow(q,mod-2,mod) % mod\n\nn,a,b = map(int,input().split())\n\nprint( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )', 'n,a,b = map(int,input().split())\nmod = 10**9+7\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, mod):\n a=framod(n, mod)\n b=framod(k, mod)\n c=framod(n-k, mod)\n return (a * power(b, mod-2, mod) * power(c, mod-2, mod)) % mod\n\n\n\nxx = 2**n % mod\n\n\nprint((xx - comb(n,a,mod) - comb(n,b,mod)) % mod)\n \n', 'def comb_mod(n,m,mod):\n p = q = 1\n for i in range(m):\n p = p*(n-i) % mod\n q = q*(i+1) % mod\n return p* pow(q,mod-2,mod) % mod\n\nn,a,b = map(int,input().split())\nmod = 10**9 +7\nprint( (pow(2,n,mod)-1 -comb_mod(n,a,mod) -comb_mod(n,b,mod) ) % mod )\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s477118710', 's935961000', 's969957415']
[3060.0, 199436.0, 3060.0]
[17.0, 2106.0, 143.0]
[240, 536, 255]
p02768
u123872895
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import math\n\nn, a, b = list(map(int, input().split()))\n\nMOD = 10**9 + 7\n\ndef make_fact_list(n, MOD):\n # make factorial list from 0 to n\n fact = [0] * (n+1)\n inv = [0] * (n+1)\n factinv = [0] * (n+1)\n\n fact[0]=fact[1]=1\n inv[1]=1\n factinv[0]=factinv[1]=1\n\n for i in range(2,n+1):\n fact[i] = fact[i-1] * i % MOD\n inv[i] = MOD - (( inv[MOD % i] * (MOD // i)) % MOD )\n factinv[i] = factinv[i-1] * inv[i] % MOD\n \n return fact, factinv\n\ndef cbn(n_f, k, MOD, fact = [], factinv = []):\n if len(fact) == 0 and len(factinv) == 0:\n fact, factinv = make_fact_list(n, MOD)\n return fact[n] * factinv[n-k] * factinv[k] % MOD\n\ndef power_with_mod(x, n, MOD):\n if n == 0:\n return 1\n elif n % 2 == 0:\n return power_with_mod(x*x % MOD , n // 2, MOD) % MOD\n else:\n return x * power_with_mod(x * x % MOD, n // 2, MOD) % MOD\n\ns = power_with_mod(2, n, MOD)-1\n\nfact, factinv = make_fact_list(b, MOD)\n\ns -= cbn(n, a, MOD, fact, factinv)\ns -= cbn(n, b, MOD, fact, factinv)\n\n\nprint(s)', 'import math\n\nn, a, b = list(map(int, input().split()))\n\nMOD = int(1e9) + 7\n\ns = pow(2, n, MOD)-1\n\ndef cbn(n, a, MOD):\n x = 1\n for i in range(a):\n x = (x * (n-i)) % MOD\n\n y = math.factorial(a) % MOD\n return x * pow(y, MOD-2, MOD) %MOD\n\ns = (s- cbn(n, a, MOD)) %MOD\ns = (s- cbn(n, b, MOD)) %MOD\n\n\nprint(s)']
['Runtime Error', 'Accepted']
['s810596147', 's388205970']
[26868.0, 5460.0]
[189.0, 1498.0]
[1050, 322]
p02768
u130860911
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['Sn = pow(2,n,MOD) - 1\nif a > b:\n a,b = b,a\nXa, Xb = 1,1\nYa, Yb = 1,1\nfor i in range(b):\n if i < a:\n Xa = ( Xa * (n-i) ) % MOD\n Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD\n Xb = ( Xb * (n-i) ) % MOD\n Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD\n\nans = Sn - Xa*Ya % MOD - Xb*Yb % MOD\nwhile ans < 0:\n ans += MOD\n \nprint(ans)', 'MOD = 10**9+7\n\nn,a,b = map(int,input().split())\n\nSn = pow(2,n,MOD) - 1\na = min(a, n-a)\nb = min(b, n-b)\nif a > b:\n a,b = b,a\nXa, Xb = 1,1\nYa, Yb = 1,1\nfor i in range(b):\n if i < a:\n Xa = ( Xa * (n-i) ) % MOD\n Ya = ( Ya * pow((a-i),MOD-2, MOD)) % MOD\n Xb = ( Xb * (n-i) ) % MOD\n Yb = ( Yb * pow((b-i),MOD-2, MOD)) % MOD\n\nans = Sn - Xa*Ya % MOD - Xb*Yb % MOD\nwhile ans < 0:\n ans += MOD\n \nprint(ans)']
['Runtime Error', 'Accepted']
['s209060418', 's188976570']
[3064.0, 3064.0]
[18.0, 1607.0]
[346, 427]
p02768
u131406572
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['from scipy.special import comb', '#156D\n\ndef comb(n,r,p=7+10**9):\n bunshi = 1\n for i in range(n-r+1, n+1):\n bunshi =bunshi * i % p\n bunbo = 1\n for i in range(1, r+1):\n bunbo = bunbo * i % p\n return bunshi * pow(bunbo, p-2, p)\nn,a,b=map(int,input().split())\ns=-2+2**n-comb(n,a)-comb(n,b)\nprint(s%(7+10**9))\n', '#156D\np=7+10**9\ndef comb(n,r):\n bunshi = 1\n for i in range(n-r+1, n+1):\n bunshi =bunshi * i % p\n bunbo = 1\n for i in range(1, r+1):\n bunbo = bunbo * i % p\n return bunshi * pow(bunbo, p-2, p)\nn,a,b=map(int,input().split())\ns=-1+pow(2,n,p)-comb(n,a)-comb(n,b)\nprint(s%p)\n']
['Runtime Error', 'Wrong Answer', 'Accepted']
['s494688931', 's556810647', 's875892652']
[14780.0, 199364.0, 3060.0]
[183.0, 2107.0, 116.0]
[30, 283, 280]
p02768
u131881594
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['MOD=10**9+7\n\ndef powmod(a,n,m): #a^n mod m\n ans=1\n while n!=0:\n if n&1: ans=ans*a%m\n a=a*a%m\n n>>=1\n return ans%m\n\ndef fact(n):\n ans=1\n for i in range(n): ans=ans*(i+1)%MOD\n return ans\n\ndef fact(a,b):\n ans=1\n for i in range(a,b+1): ans*=ans*i%MOD\n return ans\n\nn,a,b=map(int,input().split())\n\nans=powmod(2,n,MOD)-1\nta1=fact(n-a+1,n)\ntb1=fact(n-b+1,n)\nta2=pow(fact(a),MOD-2,MOD)\ntb2=pow(fact(b),MOD-2,MOD)\na=ta1*ta2%MOD\nb=tb1*tb2%MOD\nprint((ans-a-b)%MOD)', 'MOD=10**9+7\n\ndef powmod(a,n,m): #a^n mod m\n ans=1\n while n!=0:\n if n&1: ans=ans*a%m\n a=a*a%m\n n>>=1\n return ans%m\n\ndef fact(a,b):\n ans=1\n for i in range(a,b+1): ans=ans*i%MOD\n return ans\n\nn,a,b=map(int,input().split())\n\nans=powmod(2,n,MOD)-1\nta1=fact(n-a+1,n)\ntb1=fact(n-b+1,n)\nta2=pow(fact(1,a),MOD-2,MOD)\ntb2=pow(fact(1,b),MOD-2,MOD)\na=ta1*ta2%MOD\nb=tb1*tb2%MOD\nprint((ans-a-b)%MOD)']
['Runtime Error', 'Accepted']
['s716509156', 's093210974']
[9516.0, 9172.0]
[2206.0, 106.0]
[500, 423]
p02768
u157020659
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['def mod_pow(x, n, mod):\n if n == 0:\n return 1\n if n % 2 == 1:\n return x * mod_pow(x, n - 1, mod) % mod\n else:\n return mod_pow(x, n // 2, mod) ** 2 % mod\n\ndef choose(n, m, mod):\n x, y = 1, 1\n for i in range(m):\n x = x * (n - i) % mod\n y = x * (i + 1) % mod\n return x * mod_pow(y, mod - 2, mod) % mod\n\nn, a, b = map(int, input().split())\nmod = 10 ** 9 + 7\n\nans = (mod_pow(2, n, mod) - 1 - choose(n, a, mod) - choose(n, b, mod)) % mod\nprint(ans)', 'def choose(n, m, mod):\n x, y = 1, 1\n for i in range(m):\n x = x * (n - i) % mod\n y = y * (i + 1) % mod\n return x * pow(y, mod - 2, mod) % mod\n\nn, a, b = map(int, input().split())\nmod = 10 ** 9 + 7\n\nans = (pow(2, n, mod) - 1 - choose(n, a, mod) - choose(n, b, mod)) % mod\nprint(ans)']
['Wrong Answer', 'Accepted']
['s388039037', 's008856403']
[3064.0, 3064.0]
[144.0, 144.0]
[495, 303]
p02768
u162612857
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = list(map(int, input().split()))\n\nmod = 10**9 + 7\n\nimport time\nstart = time.time()\n\n\n# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6\ndef modinv(x):\n\treturn pow(x, mod-2, mod)\n\nmodinv_table = [-1] * (b+1)\nfor i in range(1, b+1):\n modinv_table[i] = modinv(i)\n\nend = time.time()\n# print("time: ", end - start)\n\ndef binomial_coefficients2(n, k):\n ans = 1\n for i in range(k):\n ans *= n-i\n ans *= modinv_table[i + 1]\n ans %= mod\n return ans\n\n# (2 ** n - 1) - nCa - nCb\nans = power(2, n) - 1\n\nans -= (binomial_coefficients2(n, a) + binomial_coefficients2(n, b))\nprint(ans % mod)\n\n\n\n', 'n, a, b = list(map(int, input().split()))\n\nmod = 10**9 + 7\n\nimport time\nstart = time.time()\n\n\n# https://qiita.com/Yaruki00/items/fd1fc269ff7fe40d09a6\ndef modinv(x):\n\treturn pow(x, mod-2, mod)\n\nmodinv_table = [-1] * (b+1)\nfor i in range(1, b+1):\n modinv_table[i] = modinv(i)\n\nend = time.time()\n# print("time: ", end - start)\n\ndef binomial_coefficients2(n, k):\n ans = 1\n for i in range(k):\n ans *= n-i\n ans *= modinv_table[i + 1]\n ans %= mod\n return ans\n\n# (2 ** n - 1) - nCa - nCb\nans = pow(2, n, mod) - 1\n\nans -= (binomial_coefficients2(n, a) + binomial_coefficients2(n, b))\nprint(ans % mod)\n\n\n\n']
['Runtime Error', 'Accepted']
['s824931707', 's176999535']
[10932.0, 10944.0]
[800.0, 925.0]
[812, 815]
p02768
u163320134
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['mod=10**9+7\nn,a,b=map(int,input().split())\nans=pow(2,mod-2,mod)-1\ncomb1=1\nfor i in range(n,n-a,-1):\n comb1*=i\n comb1%=mod\nfor i in range(1,a+1):\n comb1*=pow(i,mod-2,mod)\n comb1%=mod\ncomb2=1\nfor i in range(n,n-b,-1):\n comb2*=i\n comb2%=mod\nfor i in range(1,b+1):\n comb2*=pow(i,mod-2,mod)\n comb2%=mod\nans-=(comb1+comb2)\nans%=mod\nprint(ans)', 'mod=10**9+7\nn,a,b=map(int,input().split())\nans=pow(2,n,mod)-1\ncomb1=1\nfor i in range(n-a+1,n+1):\n comb1*=i\n comb1%=mod\nfor i in range(1,a+1):\n comb1*=pow(i,mod-2,mod)\n comb1%=mod\ncomb2=1\nfor i in range(n-b+1,n+1):\n comb2*=i\n comb2%=mod\nfor i in range(1,b+1):\n comb2*=pow(i,mod-2,mod)\n comb2%=mod\nans-=(comb1+comb2)\nans%=mod\nprint(ans)']
['Wrong Answer', 'Accepted']
['s021586754', 's742808043']
[3064.0, 3064.0]
[1613.0, 1604.0]
[344, 342]
p02768
u169350228
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int,input().split())\nmod = 10**9+7\n\ndef rev(x):\n re = 10**9+5\n num = 1\n ix = x\n while re > 0:\n if re%2 == 1:\n num = (num*ix)%mod\n re //= 2\n ix = (ix**2)%mod\n return(num)\n\ndef kaijo(x):\n num = 1\n for i in range(1,x+1):\n num = (num*i)%mod\n return(num)\n\nre = n\nans = 1\ni2 = 2\nwhile re > 0:\n if re%2 == 1:\n ans = (ans*i2)%mod\n re //= 2\n i2 = (i2**2)%mod\n\nans -= 1\nkn = kaijo(n)\nans = (ans - (((kn*rev(kaijo(a)))%mod)*rev(kaijo[n-a]))%mod)%mod\nans = (ans - (((kn*rev(kaijo(b)))%mod)*rev(kaijo[n-b]))%mod)%mod\nprint(ans)\n', 'n, a, b = map(int,input().split())\nmod = 10**9+7\n\ndef rev(x):\n re = 10**9+5\n num = 1\n ix = x\n while re > 0:\n if re%2 == 1:\n num = (num*ix)%mod\n re //= 2\n ix = (ix**2)%mod\n return(num)\n\ndef kaijo(x):\n num = 1\n for i in range(1,x+1):\n num = (num*i)%mod\n return(num)\n\nre = n\nans = 1\ni2 = 2\nwhile re > 0:\n if re%2 == 1:\n ans = (ans*i2)%mod\n re //= 2\n i2 = (i2**2)%mod\nnca = 1\nncb = 1\nfor i in range(a):\n nca = (nca*(n-i))%mod\nfor i in range(b):\n ncb = (ncb*(n-i))%mod\n\nans -= 1\nans = (ans-(nca*rev(kaijo(a)))%mod)%mod\nans = (ans-(ncb*rev(kaijo(b)))%mod)%mod\n\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s795922815', 's613496011']
[3064.0, 3064.0]
[2104.0, 160.0]
[608, 651]
p02768
u173148629
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b=map(int,input().split())\n\ndef comb(n,k,p):\n from math import factorial\n if n<0 or k<0 or n<k: return 0\n if n==0 or k==0: return 1\n a=factorial(n) %p\n b=factorial(k) %p\n c=factorial(n-k) %p\n return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p\ndef power_func(a,b,p):\n if b==0: return 1\n if b%2==0:\n d=power_func(a,b//2,p)\n return d*d %p\n if b%2==1:\n return (a*power_func(a,b-1,p ))%p\n\n\nc=1\nd=0\nmod=10**9+7\nfor _ in range(n):\n c=c*2\n d+=1\n if d>30:\n d=0\n c=c%mod\nc=c%mod\n\nc-=comb(n,a,mod)+comb(n,b,mod)\n\nif c<0:\n c+=mod\n\nprint(c)\n\n\n\n', 'n,a,b=map(int,input().split())\n\nc=10**9+7\n\ndef com(n,k,c):\n l=1\n m=1\n for i in range(k):\n l*=n-i\n m*=i+1\n l%=c\n m%=c\n return l*pow(m,c-2,c)%c\n\nans=pow(2,n,c)-1-com(n,a,c)-com(n,b,c)\n\nans%=c\n\nprint(ans)']
['Wrong Answer', 'Accepted']
['s348177442', 's201921577']
[3064.0, 3064.0]
[2104.0, 148.0]
[582, 241]
p02768
u177182853
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import numpy as np\nimport math\n\ndef main(n, a, b):\n res = mod(2 ** n - comb(n, a) - comb(n, b) - 1)\n return res\n\ndef comb(n, k):\n res = mod(math.factorial(n)) / mod(math.factorial(n - k)) / mod(math.factorial(k))\n return res\n\ndef mod(n):\n mod = 10 ** 9 + 7\n res = n % mod\n return res\n\nif __name__ == "__main__":\n cin = input()\n n = int(cin.split(" ")[0])\n a = int(cin.split(" ")[1])\n b = int(cin.split(" ")[2])\n \n cout = main(n, a, b)\n print(cout)', 'import numpy as np\nimport math as m\n\ndef main(**kwargs):\n mod = 10 ** 9 + 7\n r = repeatSquare(2, n, mod) - 1\n r -= factMod(n, n - a + 1, mod) * repeatSquare(factMod(a, 1, mod), mod - 2, mod)\n r -= factMod(n, n - b + 1, mod) * repeatSquare(factMod(b, 1, mod), mod - 2, mod)\n r %= mod\n return r\n\ndef repeatSquare(n, p, m):\n if p == 0:\n return 1\n\n if p % 2 == 0:\n tmp = repeatSquare(n, p/2, m) % m\n return tmp * tmp % m\n\n return n * repeatSquare(n, p-1, m) % m\n\ndef factMod(n, r, m):\n res = n\n\n while n > r:\n n -= 1\n res *= n\n res %= m\n\n return res\n\nif __name__ == "__main__":\n \n cin = np.array(input().split(" ")).astype("int")\n n, a, b = cin\n\n cout = main(n=n, a=a, b=b)\n print(cout)\n ']
['Wrong Answer', 'Accepted']
['s741523224', 's650571092']
[205520.0, 12496.0]
[2111.0, 2000.0]
[489, 780]
p02768
u178304274
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b = list(map(int,input().split()))\nkumiawase_bunshi = 1\nkumiawase_bunbo = 1\nt=0\nans = 0\nfor i in range (1,n+1):\n if(i != a and i != b):\n t=n\n for j in range (n-i+1,n+1):\n kumiawase_bunshi = kumiawase_bunshi * j\n for k in range (1,i+1):\n kumiawase_bunbo = kumiawase_bunbo * k\n ans = ans + (kumiawase_bunshi / kumiawase_bunbo)\n kumiawase_bunshi = 1\n kumiawase_bunbo = 1\nans = ans % 1000000007\nprint(ans)', 'def 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,MOD-2,MOD)%MOD \n\nn,a,b = list(map(int,input().split()))\nMOD = 10**9+7\nt=0\nans = pow(2,n,MOD)-1\n\n\nans -= choose(n,a)\nans -= choose(n,b)\n\nans = ans % MOD\nprint(int(ans))']
['Runtime Error', 'Accepted']
['s027061864', 's285053596']
[3064.0, 3064.0]
[18.0, 159.0]
[472, 337]
p02768
u185325486
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b = map(int, input().split())\nif n/2 < a: a=n-a\nif n/2 < b: b=n-b\ntotal, combination = 0,1\n\nfor i in range(1,(n-1)//2+1):\n combination = combination*(n-i+1)/i\n total += combination\n if a == i: a_cnt = combination\n if b == i: b_cnt = combination\n \n total = total%(10**9+7)\n\nif n == 2:\n print(0)\nelif n%2==0:\n answer = total*2+combination*(n-i)/(i+1)-a_cnt-b_cnt+1\n print(answer%(10**9+7))\nelse:\n answer = total*2-a_cnt-b_cnt+1\n print(answer%(10**9+7))', 'n,a,b = map(int, input().split()) \nX,Y = 1,1\nfor i in range(b):\n X *= n-i\n X %= 10**9+7\n Y *= i+1\n Y %= 10**9+7\n\n if a-1 == i:\n Xa,Ya = X,Y\n\ncomb_a = (Xa*pow(Ya,10**9+5))%(10**9+7)\ncomb_b = (X*pow(Y,10**9+5))%(10**9+7)\n\nresult = pow(2,n)-1-comb_a-comb_b\nprint(result if result>=0 else result+10**9+7)', 'n,a,b = map(int, input().split())\nif n/2 < a: a=n-a\nif n/2 < b: b=n-b\ntotal, combination = 0,1\n\nfor i in range(1,(n-1)//2+1):\n combination = combination*(n-i+1)/i\n total += combination\n if a == i: a_cnt = combination\n if b == i: b_cnt = combination\n \n total = total%(10**9+7)\n\nif n%2==0:\n print(total*2+combination*(n-i)/(i+1)-a_cnt-b_cnt+1)\nelse:\n print(total*2-a_cnt-b_cnt+1)', 'def pow_self(x,n):\n ans = 1\n while n>0:\n if n&1 == 1:\n ans = (ans*x)%(10**9+7)\n \n x = (x*x)%(10**9+7)\n n >>= 1\n return ans\n\n \nn,a,b = map(int, input().split()) \nX,Y = 1,1\nfor i in range(b):\n X *= n-i\n X %= 10**9+7\n Y *= i+1\n Y %= 10**9+7\n\n if a-1 == i:\n Xa,Ya = X,Y\n\ncomb_a = (Xa*pow_self(Ya,10**9+5))%(10**9+7)\ncomb_b = (X*pow_self(Y,10**9+5))%(10**9+7)\n\nresult = pow_self(2,n)-1-comb_a-comb_b\nwhile result <0:\n result += 10**9+7\nprint(result)']
['Runtime Error', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s661180332', 's733827122', 's996174209', 's905250148']
[3064.0, 165760.0, 3064.0, 3064.0]
[2104.0, 2106.0, 2104.0, 135.0]
[491, 329, 405, 529]
p02768
u186838327
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a, b = map(int, input().split())\nmod = 10**9+7\n\n#print(x*pow(y,(mod-2),mod)%mod)\n\ndef conv(n, x, mod):\n X = 1\n for i in range(x):\n k = i+1\n X *= (n-k+1)*pow(k,(mod-2),mod)%mod\n X %= mod\n return X\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\n return res\n\n#print(conv(n, a, mod))\n#print(conv(n, b, mod))\n\nans = power_func(2, n, mod) - conv(n, a, mod) - conv(n, b, mod) - 1\nans %= mod\nprint(ans)n, a, b = map(int, input().split())\nmod = 10**9+7\n\n#print(x*pow(y,(mod-2),mod)%mod)\n\ndef conv(n, x, mod):\n X = 1\n for i in range(x):\n k = i+1\n X *= (n-k+1)*pow(k,(mod-2),mod)%mod\n X %= mod\n return X\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\n return res\n\n#print(conv(n, a, mod))\n#print(conv(n, b, mod))\n\nans = power_func(2, n, mod) - conv(n, a, mod) - conv(n, b, mod) - 1\nans %= mod\nprint(ans)', 'n, a, b = map(int, input().split())\nmod = 10**9+7\n\ndef cmb2(n, r, mod):\n res = 1\n temp = 1\n for k in range(1, r+1):\n res *= (n-k+1)\n temp *= k\n res %= mod\n temp %= mod\n res *= pow(temp,(mod-2),mod)\n res %= mod\n return res\n\ndef power(a, n, mod):\n bi=str(format(n,"b")) \n res=1\n for i in range(len(bi)):\n res=(res*res) %mod\n if bi[i]=="1":\n res=(res*a) %mod\n return res\n\nans = power(2, n, mod) - cmb2(n, a, mod) - cmb2(n, b, mod) -1\nans %= mod\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s228229226', 's580940806']
[3064.0, 9240.0]
[17.0, 133.0]
[1078, 544]
p02768
u186974762
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import numpy as np\nN,a,b = np.array(input().split()).astype(int)\nfor i in range(1,N+1):\n S = 0\n if((i!=a)&(i!=b)):\n S += math.factorial(N)/(math.factorial(i)*math.factorial(N-1))\nprint(S%(10**9+7))', 'import numpy as np\nimport math\nN,a,b = np.array(input().split()).astype(int)\n2**N-1-math.factorial(N)/(math.factorial(a)*math.factorial(N-a))-math.factorial(N)/(math.factorial(b)*math.factorial(N-b))', 'import math\nimport numpy as np\nN,a,b = np.array(input().split()).astype(int)\nmod = 10**9+7\ndef power(x, n):\n ans = 1\n while(n > 0):\n if(bin(n & 1) == bin(1)):\n ans = ans*x\n x = x*x%mod\n n = n >> 1 \n return ans\ndef fact(m, n):\n val = 1\n for i in range(m, n + 1):\n val = (val*i)%mod\n return val\ndef cmb(N, r):\n A = fact(N-r, N)\n B = math.factorial(r)\n A = (A*power(B, mod-2))%mod\n return A\nprint((power(N, 2)-1-cmb(N, a)-cmb(N, b))%mod)', 'import numpy as np\nimport math\nN,a,b = np.array(input().split()).astype(int)\ndef cmb(N, r, mod):\n A = math.factorial(N)\n B = math.factorial(r)\n C = math.factorial(N-r)\n return A*B**(10**9+5)*C**(10**9+5)\nprint(2**N-1-cmb(N, a)-cmb(N, b))', 'import numpy as np\nN,a,b = np.array(input().split()).astype(int)\nmod = 10**9+7\nimport math\ndef power(x, n):\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\ndef fact(m, n):\n val = 1\n for i in range(m, n + 1):\n val = (val*i)%mod\n return val\ndef cmb(N, r):\nprint((power(2, N)-1-cmb(N, a)-cmb(N, b))%mod)\n', 'N,a,b = np.array(input().split()).astype(int)\nfor i in range(1,N+1):\n S = 0\n if((i!=a)&(i!=b)):\n S += math.factorial(N)/(math.factorial(i)*math.factorial(N-1))\nprint(S%(10**9+7))', 'import numpy as np\nimport math\nN,a,b = np.array(input().split()).astype(int)\ndef cmb(N, r, mod):\n A = math.factorial(N)\n B = math.factorial(r)\n C = math.factorial(N-r)\n return A*B**(10**9+5)*C**(10**9+5)\nprint(2**N-1-cmb(N, a)-cmb(N, b))', 'import numpy as np\nimport math\nN,a,b = np.array(input().split()).astype(int)\nprint(2**N-1-math.factorial(N)//(math.factorial(a)*math.factorial(N-a))-math.factorial(N)//(math.factorial(b)*math.factorial(N-b))\n', 'N,a,b = [int(i) for i in input().split()]\nmod = 10**9+7\ndef power(x, n):\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\ndef fact(m, n):\n val = 1\n for i in range(m, n+1):\n val = val*i % mod\n return val\n \ndef cmb1(N, r):\n A = fact(N-r+1, N)%mod\n B = fact(1, r)%mod\n return A, B, (A*power(B, mod-2))%mod\ndef cmb2(a, b, A, B):\n A = fact(N-a+1, N-b)*A%mod\n B = fact(b+1, a)*B%mod\n return (A*power(B, mod-2))%mod\nif(a>N//2):\n a = N-a\nif(b>N//2):\n b = N-b\ntmp = max(a,b)\nb = min(a,b)\na = tmp\nA, B, K1 = cmb1(N, b)\nK2 = cmb2(a, b, A, B)\nprint((power(2, N)-1-K1-K2)%mod)']
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s079383048', 's276085746', 's483538076', 's563177368', 's572582140', 's617948887', 's625369037', 's913932548', 's098116472']
[12392.0, 18840.0, 16376.0, 12608.0, 3060.0, 3060.0, 12508.0, 2940.0, 3064.0]
[150.0, 2109.0, 2109.0, 150.0, 17.0, 17.0, 153.0, 17.0, 67.0]
[202, 199, 522, 241, 435, 183, 241, 208, 725]
p02768
u196746947
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['from math import factorial\nimport sys \nimport math\nsys.setrecursionlimit(400000000)\nmod=1000000007\nn,a,b=map(int,input().split())\ndef power(x,y):\n count=1\n rem=x\n while 2*count<y:\n x=x**2\n x=x%mod\n count*=2\n res=y-count\n return x*(pow(rem,res))%mod\n\ndef nck(x,y):\n sum=1\n for i in range(y):\n sum*=(x-i)/(i+1)\n sum=sum%mod\n return sum\n\nans=power(2,n)-1-nck(n,a)-nck(n,b)\nif ans<1:\n print(0)\nelse:\n print(ans)\n\n', 'from math import factorial\nimport sys \nimport math\nsys.setrecursionlimit(400000000)\nmod=1000000007\nn,a,b=map(int,input().split())\ndef fac(n,k,mod):\n sum=1\n for i in range(k):\n sum=sum*(n-i)%mod\n return sum\n\ndef nck(x,y,mod):\n y=min(y,x-y)\n ans=fac(x,y,mod)*pow(fac(y,y,mod),mod-2,mod)%mod\n return ans\n \nans=pow(2,n,mod)-1-nck(n,a,mod)-nck(n,b,mod)\nans=ans%mod\nprint(ans)\n']
['Wrong Answer', 'Accepted']
['s753647784', 's005447345']
[153848.0, 3064.0]
[2105.0, 142.0]
[474, 399]
p02768
u201387466
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import sys\ninput=sys.stdin.readline\n#from collections import defaultdict\n\n#import fractions\n#import math\n#import collections\n#from collections import deque\n\n#N = int(input())\n#A = list(map(int,input().split()))\n#S = list(input())\n#S.remove("\\n")\n#N,M = map(int,input().split())\n#S,T = map(str,input().split())\n#A = [int(input()) for _ in range(N)]\n#S = [input() for _ in range(N)]\n#A = [list(map(int,input().split())) for _ in range(N)]\n#import itertools\nMOD = 10**9 + 7\ndef comb(n, k, p):\n if n<0 or k<0 or n<k:\n return 0\n if n==0 or k==0:\n return 1\n k=k if k<=n-k else n-k\n for i in range(k):\n x=x*(n-i)%mod\n y=y*(i+1)%mod\n return (x*pow(y,mod-2,mod))%mod\nn,a,b = map(int,input().split())\nA = comb(n,a,MOD)\nB = comb(n,b,MOD)\nC = pow(2,n,MOD)\nans = C -A-B-1\nprint(ans%MOD)', 'import sys\ninput=sys.stdin.readline\n#from collections import defaultdict\n\n#import fractions\n#import math\n#import collections\n#from collections import deque\n\n#N = int(input())\n#A = list(map(int,input().split()))\n#S = list(input())\n#S.remove("\\n")\n#N,M = map(int,input().split())\n#S,T = map(str,input().split())\n#A = [int(input()) for _ in range(N)]\n#S = [input() for _ in range(N)]\n#A = [list(map(int,input().split())) for _ in range(N)]\n#import itertools\nMOD = 10**9 + 7\ndef comb(n, k, mod):\n if n<0 or k<0 or n<k:\n return 0\n if n==0 or k==0:\n return 1\n k=k if k<=n-k else n-k\n x = 1\n y = 1\n for i in range(k):\n x=x*(n-i)%mod\n y=y*(i+1)%mod\n return (x*pow(y,mod-2,mod))%mod\nn,a,b = map(int,input().split())\nA = comb(n,a,MOD)\nB = comb(n,b,MOD)\nC = pow(2,n,MOD)\nans = C -A-B-1\nprint(ans%MOD)']
['Runtime Error', 'Accepted']
['s777005163', 's005209980']
[3188.0, 3064.0]
[19.0, 144.0]
[868, 890]
p02768
u201928947
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['\nfrom functools import reduce\nmod = 10**9+7\ndef mul(a,b):\n return a*b % mod\ndef cmb(n,r,mod):\n if r == 0:\n return 1\n r = min(n-r,r)\n above = reduce(mul,range(n-r+1,n+1)) \n below = reduce(mul,range(1,r+1)) \n ans = above*pow(below,mod-2,mod) % mod\n if ans < 0:\n ans += mod\n return ans\nn,a,b = map(int,input().split())\nans = pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod \nif ans < 0:\n ans += mod\n print(ans)\n', 'def cmb(a,b,c):\n b = min(b,a-b)\n num = 1\n for i in range(b):\n num = num*(n-i) % c\n den = 1\n for i in range(b):\n den = den*(i+1) % c\n return num*pow(den,-1,c) % c\nmod = 10**9+7\nn,a,b = map(int,input().split())\nans = (pow(2,n,mod)-cmb(n,a,mod)-cmb(n,b,mod)-1) % mod\nif ans < 0:\n ans = ans + mod\nprint(ans)']
['Runtime Error', 'Accepted']
['s359130894', 's498215386']
[3064.0, 9188.0]
[17.0, 126.0]
[445, 339]
p02768
u207137484
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b = (int(x) for x in input().split())\nmod = 10**9+7\n\ndef minus(n,k):\n x,y =1,1\n for i in range(k):\n x*=(n-i)%mod\n y*=(k-i)%mod\n return x*pow(y, mod-2, mod)%mod\n\nans = pow(2,n,mod)-1-minus(b,a)-minus(b,b)\nwhile ans<0:\n ans+=mod\nprint(ans)\n', 'n,a,b = map(int, input().split())\nmod = 10**9+7\n \ndef minus(n,k):\n x,y =1,1\n for i in range(k):\n x*=(n-i)\n y*=(k-i)\n x%=mod\n y%=mod\n return x*pow(y, mod-2, mod)%mod\n \nans = pow(2,n,mod)-1-minus(n,a)-minus(n,b)\nwhile ans<0:\n ans+=mod\nprint(ans)']
['Wrong Answer', 'Accepted']
['s511072917', 's671765816']
[3588.0, 3064.0]
[2104.0, 151.0]
[268, 283]
p02768
u212786022
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n, a ,b = map(int, input().split())\n\nmod = 1000000007\nwidth = 1000\ntable = [ 1, 128233642, 993191796, 246084337, 175673566, 883787401, 470931556, 119995528, 225567908, 757928892, 250015370, 913979655, 754758, 207715304, 680281231, 630322311, 642314838, 834078844, 599226039, 918470969, 777847830, 188150013, 936569805, 609321015, 803755964, 506567627, 733034722, 525152703, 125374323, 229063893, 64381203, 331225140, 239876153, 938119791, 238030663, 963888220, 269540267, 288849729, 868543185, 176093029, 129227219, 57384053, 510217116, 42904984, 1283621, 229119361, 122050053, 83923714, 99441611, 723598838, 664720426, 824990192, 899870337, 994461247, 78470227, 616312139, 585511607, 457301297, 774218347, 24761471, 220551652, 797724439, 42696969, 433164019, 825454299, 183907026, 881797659, 823559228, 703904407, 624713517, 805011386, 175293956, 157911929, 315160646, 59387184, 711105445, 710926865, 239798930, 734168782, 513146799, 71626953, 883937988, 613778426, 107738376, 960564286, 84887701, 771212964, 71595332, 319321717, 980960223, 368173468, 67320689, 862499851, 864972828, 48646097, 670160814, 725736339, 790163830, 663423088, 255691818, 388742192, 305094892, 522669454, 472392039, 946047214, 445919328, 748072600, 923340633, 932008794, 641127822, 633943807, 473400148, 55310953, 397250219, 468376442, 583215176, 797665328, 890028978, 528044431, 795787957, 546160751, 21487680, 168379396, 292434098, 414672346, 74193376, 460353865, 599810935, 250857617, 915366231, 248863345, 970381475, 792991318, 740333468, 505276601, 404393468, 273222696, 38135257, 776858195, 153730583, 642800490, 383597969, 352113689, 326414281, 751880110, 401720832, 321560177, 799699361, 847915310, 122391227, 227253170, 943226946, 628558171, 741676814, 471158688, 954631869, 493837145, 558658912, 420443735, 350090863, 217956259, 331145950, 853718873, 294871436, 441691230, 450998982, 237913344, 891941663, 1946260, 405112401, 448399780, 134526127, 246436561, 278169858, 460138465, 93785028, 536128669, 614812564, 895531956, 53159706, 343122361, 979426864, 535308676, 821698590, 111592160, 392955473, 447760971, 209213748, 847593978, 203062304, 203128902, 787544197, 498828478, 184919578, 105720019, 69934934, 13384364, 973282740, 449768173, 269308198, 904824556, 182396273, 584885733, 396642025, 609732757, 302161309, 183805719, 163566228, 479978003, 98799651, 976400196, 125377402, 799132752, 870397588, 644664934, 129577634, 690319271, 611331587, 653433224, 140236662, 409788350, 991717810, 62680229, 190864441, 36959486, 149551212, 850748843, 164689931, 861991239, 929807057, 969665321, 847381024, 849985007, 211790079, 300573111, 274608474, 852794964, 947517699, 845476998, 892993251, 942841378, 752521136, 160135971, 872092879, 947081586, 43872472, 699047819, 356785202, 852607095, 799881153, 78633765, 743118036, 270375915, 917589851, 68917553, 710229437, 55629368, 618076743, 280545717, 675792083, 46429647, 151769255, 451990910, 175101818, 843430958, 38053664, 646697534, 23357308, 206681493, 888773710, 419288563, 102196642, 166544838, 158026445, 853567157, 547481582, 271969574, 391772235, 700892631, 483230045, 622773713, 745587272, 464843479, 112408178, 48833532, 419683777, 357283581, 893210864, 753476511, 49462239, 43950471, 623405550, 245081995, 772845334, 469206379, 631437749, 684644905, 793794697, 569684184, 860006640, 158036420, 392172613, 162031808, 602247245, 203070433, 384809257, 29972101, 344657818, 105304879, 159934700, 539867530, 111755839, 775104266, 722056100, 480533881, 603649910, 730015093, 32522487, 687171713, 684911737, 629028067, 75924301, 327784991, 613277615, 911404085, 68597770, 92366073, 745625029, 473314335, 507714509, 98679775, 522660661, 475294170, 305900432, 650978491, 240960675, 954022341, 297423873, 233051932, 288347091, 181067811, 822741050, 72596087, 389928500, 925730861, 660630476, 418823335, 494735470, 956973216, 280787188, 577131628, 195596415, 780760749, 646964034, 492636384, 290950928, 665101198, 971833316, 402869341, 31542354, 448714637, 853057984, 859647481, 659285587, 703667161, 442458694, 57325142, 151885002, 151752857, 953328299, 274699378, 797580192, 900864549, 977052491, 903191059, 560104200, 52364315, 317587469, 733519519, 51326765, 172718980, 394213323, 499127130, 125665101, 599958067, 570048626, 358205301, 955898164, 396169962, 863114450, 524877565, 561615134, 336979830, 751853389, 98033418, 914857313, 669594871, 233002010, 798378948, 353985696, 132400827, 853908795, 633800050, 114199369, 8366891, 369520637, 840068688, 154949227, 766964103, 1213933, 283566441, 213654982, 766431359, 140028557, 389857786, 592586116, 294866824, 626984599, 88266364, 960355422, 299777072, 159529372, 433368021, 546910609, 640482852, 176367836, 62590712, 619758852, 519471843, 689296297, 688241748, 125464096, 549853046, 180640016, 669655376, 304486472, 552708211, 641131096, 250145685, 522823788, 422054382, 614827289, 213695506, 564996794, 816097193, 472957326, 627305145, 419352923, 233618208, 201907686, 789638131, 935757716, 321551236, 258348634, 248012645, 915754672, 94217171, 566557194, 883879696, 841856794, 386613162, 570112346, 183700660, 278268556, 308943479, 160666387, 737303060, 567134616, 327727771, 639296326, 219084929, 949740710, 467443562, 16455771, 875530545, 782951703, 711107295, 863411295, 578371653, 66207956, 375238282, 908681407, 515884084, 90795523, 455372810, 89837046, 165491515, 545433366, 660354454, 653260780, 270146387, 283056775, 39236829, 89221906, 548284763, 958657863, 647273634, 738216290, 960141650, 192631043, 647619052, 435099529, 111019175, 387052722, 349026437, 943168803, 597199864, 798930903, 280032050, 191489048, 871756271, 864201473, 573902924, 776735804, 795907052, 513212481, 703258263, 151087418, 176917020, 492333520, 645927523, 842232145, 918613011, 167094468, 506609335, 871613850, 791653278, 688384948, 512230762, 466482156, 483519685, 433675444, 266224879, 712040274, 316470404, 6297629, 247528343, 266547054, 831469341, 917532298, 459833872, 954893577, 614837703, 484625452, 614869637, 917743182, 905427381, 449126127, 796820262, 408509829, 273602905, 130924280, 1363238, 389499824, 954805317, 932440256, 34161376, 646994455, 672836257, 808301053, 929096963, 231765547, 390778694, 403445961, 653868071, 549355895, 901843642, 882716412, 125812900, 266137390, 250231633, 801863164, 862419855, 603909210, 141087179, 919738330, 901776094, 636804992, 717115643, 982881315, 278589981, 897622715, 592874475, 963773361, 139945137, 389252372, 890252510, 865544569, 462018791, 972099566, 849449796, 319640588, 967009768, 977653667, 710029654, 805234475, 831002177, 275336330, 422855006, 949746887, 541794170, 641881338, 296285475, 292901421, 107561334, 338689309, 112458779, 325082011, 3976415, 304229218, 601214344, 86328828, 751441489, 862204727, 554702266, 186018851, 166853623, 545193868, 432626342, 498556538, 860331963, 609479011, 974179405, 836442658, 315554906, 589911857, 242364047, 745675667, 630588185, 96935486, 898831734, 753652548, 83905053, 205072787, 486649120, 696978729, 371086126, 376354590, 740911902, 983182992, 959047580, 971565881, 279013191, 628219669, 483423122, 559666181, 748528679, 349865602, 276254737, 103092679, 990713044, 883898451, 334011645, 643112778, 85592384, 110938911, 78761716, 162118715, 110215007, 361560450, 218658983, 958290706, 760866197, 29604925, 704254054, 884528885, 571553124, 722545849, 511824535, 189127084, 293444525, 539142876, 642675615, 952158794, 312246024, 275756454, 200298706, 261130169, 62294542, 510890694, 385243308, 87361521, 503202218, 685328461, 550921230, 668093102, 699944378, 251795690, 907314994, 834548983, 352821537, 549529635, 281274542, 587974019, 795434349, 753132255, 415545290, 77523025, 281787237, 176567548, 722869575, 34478434, 714412522, 671034944, 329114990, 958416239, 745926726, 754875902, 211334210, 513547036, 381109223, 400825307, 949915497, 794380771, 663920989, 690042117, 830304630, 901554891, 751723357, 837761558, 378511108, 115298175, 325447247, 614534142, 840758997, 813807256, 591333543, 691718994, 672655144, 699954263, 85458370, 19198497, 754433496, 300341823, 886939169, 54570137, 616323646, 496090306, 34402024, 817983914, 915965688, 479650439, 388452570, 454605978, 750397062, 559638074, 303896928, 22416828, 441748912, 635659640, 815695490, 812160395, 166688469, 740163360, 14049893, 284479436, 190422595, 187192515, 376697732, 47634513, 160874373, 126508400, 775997892, 99363239, 493832830, 763882002, 701596576, 15590851, 257335774, 894463993, 185206871, 441874230, 746700252, 302941806, 868371723, 139345496, 869630341, 144717208, 187345841, 866229903, 724450461, 648235214, 776271119, 672074506, 602185675, 656002752, 240125575, 759576687, 463430427, 24769850, 862837188, 53160078, 513987022, 118514895, 188179897, 699945777, 115323244, 199918423, 833621264, 805714018, 463715736, 180028074, 475829876, 235402877, 772103983, 49684084, 443337661, 655366896, 289638503, 258332145, 360855087, 899672361, 530502576, 801491866, 641986630, 940068353, 797422831, 378645901, 853709985, 87792814, 398991956, 660101704, 243383485, 532777074, 459644547, 702843272, 209971686, 829986137, 470834910, 246066405, 806738292, 39284371, 389133055, 321621467, 698830270, 670701663, 45171714, 633003395, 90710349, 967169522, 541775025, 988685463, 21712927, 170049523, 503374186, 602599325, 962557054, 800216315, 767004598, 737518012, 609437737, 530398437, 82759720, 621977664, 548979006, 245507299, 832068105, 80911832, 416356617, 318565618, 40420676, 412673617, 923197226, 594087420, 42029599, 521233968, 806698019, 833042288, 321490146, 468133703, 773978131, 414775293, 774760659, 300992794, 274025195, 445949927, 819855707, 528038317, 620344533, 51066611, 742263715, 539906647, 9185408, 244838920, 887410937, 539585878, 233938533, 832701367, 208941375, 890452341, 320097016, 460377592, 383972524, 956067685, 534451216, 946322067, 950977861, 379271132, 363268251, 740246294, 446595916, 554740081, 585267057, 666743526, 941443156, 923656781, 122441988, 203736886, 815895710, 498136156, 239856470, 992717436, 743674726, 96127672, 932528338, 278615623, 146992535, 68306453, 131167060, 272573946, 851897254, 782985541, 759971846, 767877668, 505054565, 682447171, 154820240, 351374909, 29839511, 846987109, 213673769, 590919567, 264042121, 189663389, 717706128, 781660659, 590772569, 670325982, 9239468, 791592672, 51083743, 740568821, 281574447, 587141513, 553122503, 340747559, 726765483, 771154066, 145504712, 464498808, 328555850, 866235034, 289880945, 310574040, 31723627, 26631855, 19526377, 58086236, 918654424, 582386705, 784853394, 657402015, 976196645, 154059840, 149978308, 600014675, 7004660, 658540583, 953807513, 842210720, 300038049, 525785906, 487155590, 970029619, 25074612, 511691999, 455850881, 892170974, 730230612, 811413348, 426045335, 640134437, 120756795, 527174688, 712332795, 372350239, 770574347, 775312159, 726265742, 117585021, 808434455, 150599746, 257106196, 676730440, 520558862, 38297346, 220183171, 564917745, 346371991, 627835740, 900198419 ]\ndef factrial(n):\n if n >= mod:\n return 0\n acc = table[n // (mod // width)]\n init = n // (mod // width) * (mod // width)\n for i in range(max(1, init), n+1):\n acc = acc * i % mod\n return acc\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\n return res\n\nX = power_func(2,n,m)\nX = X- 1\nY = (factrial(n)* pow(factrial(a),m-2,m)*pow(factrial(n-a),m-2,m)) % m\nZ = (factrial(n)* pow(factrial(b),m-2,m)*pow(factrial(n-b),m-2,m)) % m\nX = (X-Y + m) % m\nX = (X-Z + m) % m\nprint(int(X))', 'n, a ,b = map(int, input().split())\n\nmod = 1000000007\nwidth = 1000\ntable = [ 1, 128233642, 993191796, 246084337, 175673566, 883787401, 470931556, 119995528, 225567908, 757928892, 250015370, 913979655, 754758, 207715304, 680281231, 630322311, 642314838, 834078844, 599226039, 918470969, 777847830, 188150013, 936569805, 609321015, 803755964, 506567627, 733034722, 525152703, 125374323, 229063893, 64381203, 331225140, 239876153, 938119791, 238030663, 963888220, 269540267, 288849729, 868543185, 176093029, 129227219, 57384053, 510217116, 42904984, 1283621, 229119361, 122050053, 83923714, 99441611, 723598838, 664720426, 824990192, 899870337, 994461247, 78470227, 616312139, 585511607, 457301297, 774218347, 24761471, 220551652, 797724439, 42696969, 433164019, 825454299, 183907026, 881797659, 823559228, 703904407, 624713517, 805011386, 175293956, 157911929, 315160646, 59387184, 711105445, 710926865, 239798930, 734168782, 513146799, 71626953, 883937988, 613778426, 107738376, 960564286, 84887701, 771212964, 71595332, 319321717, 980960223, 368173468, 67320689, 862499851, 864972828, 48646097, 670160814, 725736339, 790163830, 663423088, 255691818, 388742192, 305094892, 522669454, 472392039, 946047214, 445919328, 748072600, 923340633, 932008794, 641127822, 633943807, 473400148, 55310953, 397250219, 468376442, 583215176, 797665328, 890028978, 528044431, 795787957, 546160751, 21487680, 168379396, 292434098, 414672346, 74193376, 460353865, 599810935, 250857617, 915366231, 248863345, 970381475, 792991318, 740333468, 505276601, 404393468, 273222696, 38135257, 776858195, 153730583, 642800490, 383597969, 352113689, 326414281, 751880110, 401720832, 321560177, 799699361, 847915310, 122391227, 227253170, 943226946, 628558171, 741676814, 471158688, 954631869, 493837145, 558658912, 420443735, 350090863, 217956259, 331145950, 853718873, 294871436, 441691230, 450998982, 237913344, 891941663, 1946260, 405112401, 448399780, 134526127, 246436561, 278169858, 460138465, 93785028, 536128669, 614812564, 895531956, 53159706, 343122361, 979426864, 535308676, 821698590, 111592160, 392955473, 447760971, 209213748, 847593978, 203062304, 203128902, 787544197, 498828478, 184919578, 105720019, 69934934, 13384364, 973282740, 449768173, 269308198, 904824556, 182396273, 584885733, 396642025, 609732757, 302161309, 183805719, 163566228, 479978003, 98799651, 976400196, 125377402, 799132752, 870397588, 644664934, 129577634, 690319271, 611331587, 653433224, 140236662, 409788350, 991717810, 62680229, 190864441, 36959486, 149551212, 850748843, 164689931, 861991239, 929807057, 969665321, 847381024, 849985007, 211790079, 300573111, 274608474, 852794964, 947517699, 845476998, 892993251, 942841378, 752521136, 160135971, 872092879, 947081586, 43872472, 699047819, 356785202, 852607095, 799881153, 78633765, 743118036, 270375915, 917589851, 68917553, 710229437, 55629368, 618076743, 280545717, 675792083, 46429647, 151769255, 451990910, 175101818, 843430958, 38053664, 646697534, 23357308, 206681493, 888773710, 419288563, 102196642, 166544838, 158026445, 853567157, 547481582, 271969574, 391772235, 700892631, 483230045, 622773713, 745587272, 464843479, 112408178, 48833532, 419683777, 357283581, 893210864, 753476511, 49462239, 43950471, 623405550, 245081995, 772845334, 469206379, 631437749, 684644905, 793794697, 569684184, 860006640, 158036420, 392172613, 162031808, 602247245, 203070433, 384809257, 29972101, 344657818, 105304879, 159934700, 539867530, 111755839, 775104266, 722056100, 480533881, 603649910, 730015093, 32522487, 687171713, 684911737, 629028067, 75924301, 327784991, 613277615, 911404085, 68597770, 92366073, 745625029, 473314335, 507714509, 98679775, 522660661, 475294170, 305900432, 650978491, 240960675, 954022341, 297423873, 233051932, 288347091, 181067811, 822741050, 72596087, 389928500, 925730861, 660630476, 418823335, 494735470, 956973216, 280787188, 577131628, 195596415, 780760749, 646964034, 492636384, 290950928, 665101198, 971833316, 402869341, 31542354, 448714637, 853057984, 859647481, 659285587, 703667161, 442458694, 57325142, 151885002, 151752857, 953328299, 274699378, 797580192, 900864549, 977052491, 903191059, 560104200, 52364315, 317587469, 733519519, 51326765, 172718980, 394213323, 499127130, 125665101, 599958067, 570048626, 358205301, 955898164, 396169962, 863114450, 524877565, 561615134, 336979830, 751853389, 98033418, 914857313, 669594871, 233002010, 798378948, 353985696, 132400827, 853908795, 633800050, 114199369, 8366891, 369520637, 840068688, 154949227, 766964103, 1213933, 283566441, 213654982, 766431359, 140028557, 389857786, 592586116, 294866824, 626984599, 88266364, 960355422, 299777072, 159529372, 433368021, 546910609, 640482852, 176367836, 62590712, 619758852, 519471843, 689296297, 688241748, 125464096, 549853046, 180640016, 669655376, 304486472, 552708211, 641131096, 250145685, 522823788, 422054382, 614827289, 213695506, 564996794, 816097193, 472957326, 627305145, 419352923, 233618208, 201907686, 789638131, 935757716, 321551236, 258348634, 248012645, 915754672, 94217171, 566557194, 883879696, 841856794, 386613162, 570112346, 183700660, 278268556, 308943479, 160666387, 737303060, 567134616, 327727771, 639296326, 219084929, 949740710, 467443562, 16455771, 875530545, 782951703, 711107295, 863411295, 578371653, 66207956, 375238282, 908681407, 515884084, 90795523, 455372810, 89837046, 165491515, 545433366, 660354454, 653260780, 270146387, 283056775, 39236829, 89221906, 548284763, 958657863, 647273634, 738216290, 960141650, 192631043, 647619052, 435099529, 111019175, 387052722, 349026437, 943168803, 597199864, 798930903, 280032050, 191489048, 871756271, 864201473, 573902924, 776735804, 795907052, 513212481, 703258263, 151087418, 176917020, 492333520, 645927523, 842232145, 918613011, 167094468, 506609335, 871613850, 791653278, 688384948, 512230762, 466482156, 483519685, 433675444, 266224879, 712040274, 316470404, 6297629, 247528343, 266547054, 831469341, 917532298, 459833872, 954893577, 614837703, 484625452, 614869637, 917743182, 905427381, 449126127, 796820262, 408509829, 273602905, 130924280, 1363238, 389499824, 954805317, 932440256, 34161376, 646994455, 672836257, 808301053, 929096963, 231765547, 390778694, 403445961, 653868071, 549355895, 901843642, 882716412, 125812900, 266137390, 250231633, 801863164, 862419855, 603909210, 141087179, 919738330, 901776094, 636804992, 717115643, 982881315, 278589981, 897622715, 592874475, 963773361, 139945137, 389252372, 890252510, 865544569, 462018791, 972099566, 849449796, 319640588, 967009768, 977653667, 710029654, 805234475, 831002177, 275336330, 422855006, 949746887, 541794170, 641881338, 296285475, 292901421, 107561334, 338689309, 112458779, 325082011, 3976415, 304229218, 601214344, 86328828, 751441489, 862204727, 554702266, 186018851, 166853623, 545193868, 432626342, 498556538, 860331963, 609479011, 974179405, 836442658, 315554906, 589911857, 242364047, 745675667, 630588185, 96935486, 898831734, 753652548, 83905053, 205072787, 486649120, 696978729, 371086126, 376354590, 740911902, 983182992, 959047580, 971565881, 279013191, 628219669, 483423122, 559666181, 748528679, 349865602, 276254737, 103092679, 990713044, 883898451, 334011645, 643112778, 85592384, 110938911, 78761716, 162118715, 110215007, 361560450, 218658983, 958290706, 760866197, 29604925, 704254054, 884528885, 571553124, 722545849, 511824535, 189127084, 293444525, 539142876, 642675615, 952158794, 312246024, 275756454, 200298706, 261130169, 62294542, 510890694, 385243308, 87361521, 503202218, 685328461, 550921230, 668093102, 699944378, 251795690, 907314994, 834548983, 352821537, 549529635, 281274542, 587974019, 795434349, 753132255, 415545290, 77523025, 281787237, 176567548, 722869575, 34478434, 714412522, 671034944, 329114990, 958416239, 745926726, 754875902, 211334210, 513547036, 381109223, 400825307, 949915497, 794380771, 663920989, 690042117, 830304630, 901554891, 751723357, 837761558, 378511108, 115298175, 325447247, 614534142, 840758997, 813807256, 591333543, 691718994, 672655144, 699954263, 85458370, 19198497, 754433496, 300341823, 886939169, 54570137, 616323646, 496090306, 34402024, 817983914, 915965688, 479650439, 388452570, 454605978, 750397062, 559638074, 303896928, 22416828, 441748912, 635659640, 815695490, 812160395, 166688469, 740163360, 14049893, 284479436, 190422595, 187192515, 376697732, 47634513, 160874373, 126508400, 775997892, 99363239, 493832830, 763882002, 701596576, 15590851, 257335774, 894463993, 185206871, 441874230, 746700252, 302941806, 868371723, 139345496, 869630341, 144717208, 187345841, 866229903, 724450461, 648235214, 776271119, 672074506, 602185675, 656002752, 240125575, 759576687, 463430427, 24769850, 862837188, 53160078, 513987022, 118514895, 188179897, 699945777, 115323244, 199918423, 833621264, 805714018, 463715736, 180028074, 475829876, 235402877, 772103983, 49684084, 443337661, 655366896, 289638503, 258332145, 360855087, 899672361, 530502576, 801491866, 641986630, 940068353, 797422831, 378645901, 853709985, 87792814, 398991956, 660101704, 243383485, 532777074, 459644547, 702843272, 209971686, 829986137, 470834910, 246066405, 806738292, 39284371, 389133055, 321621467, 698830270, 670701663, 45171714, 633003395, 90710349, 967169522, 541775025, 988685463, 21712927, 170049523, 503374186, 602599325, 962557054, 800216315, 767004598, 737518012, 609437737, 530398437, 82759720, 621977664, 548979006, 245507299, 832068105, 80911832, 416356617, 318565618, 40420676, 412673617, 923197226, 594087420, 42029599, 521233968, 806698019, 833042288, 321490146, 468133703, 773978131, 414775293, 774760659, 300992794, 274025195, 445949927, 819855707, 528038317, 620344533, 51066611, 742263715, 539906647, 9185408, 244838920, 887410937, 539585878, 233938533, 832701367, 208941375, 890452341, 320097016, 460377592, 383972524, 956067685, 534451216, 946322067, 950977861, 379271132, 363268251, 740246294, 446595916, 554740081, 585267057, 666743526, 941443156, 923656781, 122441988, 203736886, 815895710, 498136156, 239856470, 992717436, 743674726, 96127672, 932528338, 278615623, 146992535, 68306453, 131167060, 272573946, 851897254, 782985541, 759971846, 767877668, 505054565, 682447171, 154820240, 351374909, 29839511, 846987109, 213673769, 590919567, 264042121, 189663389, 717706128, 781660659, 590772569, 670325982, 9239468, 791592672, 51083743, 740568821, 281574447, 587141513, 553122503, 340747559, 726765483, 771154066, 145504712, 464498808, 328555850, 866235034, 289880945, 310574040, 31723627, 26631855, 19526377, 58086236, 918654424, 582386705, 784853394, 657402015, 976196645, 154059840, 149978308, 600014675, 7004660, 658540583, 953807513, 842210720, 300038049, 525785906, 487155590, 970029619, 25074612, 511691999, 455850881, 892170974, 730230612, 811413348, 426045335, 640134437, 120756795, 527174688, 712332795, 372350239, 770574347, 775312159, 726265742, 117585021, 808434455, 150599746, 257106196, 676730440, 520558862, 38297346, 220183171, 564917745, 346371991, 627835740, 900198419 ]\ndef factrial(n):\n if n >= mod:\n return 0\n acc = table[n // (mod // width)]\n init = n // (mod // width) * (mod // width)\n for i in range(max(1, init), n+1):\n acc = acc * i % mod\n return acc\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\n return res\n\nX = power_func(2,n,mod)\nX = X- 1\nY = (factrial(n)* pow(factrial(a),mod-2,mod)*pow(factrial(n-a),mod-2,mod)) % mod\nZ = (factrial(n)* pow(factrial(b),mod-2,mod)*pow(factrial(n-b),mod-2,mod)) % mod\nX = (X-Y-Z) % mod\nprint(int(X))']
['Runtime Error', 'Accepted']
['s761094497', 's293615413']
[3832.0, 3832.0]
[19.0, 473.0]
[11579, 11583]
p02768
u219015402
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['\nn,a,b = map(int,input().split())\n\nres = 1\n \ndef cmb(n, r):\n if (r < 0 or r > n):\n return 0\n r = min(r, n-r)\n return fac[n] * finv[r] * finv[n-r] % mod\n \n \nmod = 10**9+7 \nN_cmb = 0\nN_cmb += n \nfac = [1, 1] \nfinv = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor ZZZ in range(2, N_cmb + 1):\n fac.append((fac[-1] * ZZZ) % mod)\n inverse.append(mod-inverse[mod % ZZZ]*(mod//ZZZ) % mod)\n finv.append((finv[-1] * inverse[-1]) % mod)\n \nans = pow(2,n)%mod - cmb(n,a) - cmb(n,b) +1\nprint(ans)', '\nn,a,b = map(int,input().split())\n\nmod = 10**9+7\ndef comb(n,k,p):\n \n from math import factorial\n if n<0 or k<0 or n<k: return 0\n if n==0 or k==0: return 1\n a=factorial(n) %p\n b=factorial(k) %p\n c=factorial(n-k) %p\n return (a*power_func(b,p-2,p)*power_func(c,p-2,p))%p\ndef power_func(a,b,p):\n \n if b==0: return 1\n if b%2==0:\n d=power_func(a,b//2,p)\n return d*d %p\n if b%2==1:\n return (a*power_func(a,b-1,p ))%p\n\nans = power_func(2,n,mod) - comb(n,a,mod)-comb(n,b,mod)\nprint(ans)', 'from math import factorial\n\nn,a,b = map(int,input().split())\n\nmod = 10**9+7\n\ndef comb(n,k,p):\n x = 1\n y = 1\n for i in range(k):\n x= (x *(n-i))%p\n y= (y* (k-i))%p\n yinv = pow(y,p-2,p)\n return (x*yinv)%p\n\nans = (pow(2,n,mod)- 1 - comb(n,a,mod)-comb(n,b,mod))%mod\nprint(ans)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s511475346', 's669897149', 's300283910']
[218544.0, 9280.0, 3064.0]
[2119.0, 2104.0, 133.0]
[747, 578, 282]
p02768
u219417113
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['def pre_cmb_mod(n, mod):\n if n == 0:\n return [1], [1]\n fact = [1, 1]\n inv = [0, 1]\n factinv = [1, 1]\n for i in range(2, n+1):\n fact.append((fact[-1] * i) % mod)\n inv.append((-inv[mod % i] * (mod//i)) % mod)\n factinv.append((factinv[-1] * inv[-1]) % mod)\n return fact, factinv\n\n\ndef cmb_mod(n, r, mod, fact, factinv):\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] % mod\n \n mod = 10**9 + 7\nn, a, b = map(int, input().split())\n\nfact, factinv = pre_cmb_mod(n, mod)\n\nresult = 0\nfor r in range(1, n+1):\n if r == a or r == b:\n continue\n result += cmb_mod(n, r, mod, fact, factinv)\n result %= mod\n\nprint(result)', 'def comb_mod(n, k, p):\n \n numerator = 1\n denominator = 1\n for i in range(k):\n numerator *= n - i\n numerator %= p\n denominator *= i + 1\n denominator %= p\n return numerator * pow(denominator, p-2, p) % p\n\nmod = 10**9 + 7\nn, a, b = map(int, input().split())\nresult = pow(2, n, mod) - 1\n\nfor i in (a, b):\n result -= comb_mod(n, i, mod)\nresult %= mod\n\nprint(result)']
['Runtime Error', 'Accepted']
['s684927147', 's955576045']
[3064.0, 3064.0]
[17.0, 151.0]
[736, 431]
p02768
u221149873
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['import math\nn, a, b = map(int,input().split())\nprint((n**2 - math.factorial(n)/(math.factorial(a)*math.factorial(n-a)) - math.factorial(n)/(math.factorial(b)*math.factorial(b-a)))%(10**9+7))', 'def mod_power(x,y,p):\n if y == 1:\n return x % p\n elif y % 2 == 0:\n return (mod_power(x,y/2,p)**2) % p\n else:\n return (mod_power(x,y-1,p) * x ) % p\n\ndef mod_inv(x,p):\n return mod_power(x,p-2,p)\n\ndef mod_nCa(n,a,p):\n num = 1\n den = 1\n for i in range(a):\n num = (num * (n-i)) % p\n den = (den * (a-i)) % p\n return (num * mod_inv(den,p)) % p\n\n\nn,a,b = map(int,input().split())\n\nm = 10**9 + 7\n\nprint((mod_power(2,n,m) - mod_nCa(n,a,m) - mod_nCa(n,b,m) - 1) % m)']
['Wrong Answer', 'Accepted']
['s358401360', 's284810715']
[7684.0, 3064.0]
[2104.0, 133.0]
[190, 514]
p02768
u223904637
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, two bouquets are considered different when there is a flower that is used in one of the bouquets but not in the other bouquet.
['n,a,b=map(int,input().split())\nmod=10**9+7\nans=pow(2,n,mod)-1\np=1\nfor i in range(a):\n p*=n-i\n p*=pow(i+1,mod-2,mod)\n p%=mod\nfor i in range(b):\n p*=n-i\n p*=pow(i+1,mod-2,mod)\n p%=mod\nprint((ans-p)%mod)', 'n,a,b=map(int,input().split())\nmod=10**9+7\nans=pow(2,n,mod)-1\np=1\nfor i in range(a):\n p*=n-i\n p*=pow(i+1,mod-2,mod)\n p%=mod\np2=1\nfor i in range(b):\n p2*=n-i\n p2*=pow(i+1,mod-2,mod)\n p2%=mod\nprint((ans-p-p2)%mod)\n']
['Wrong Answer', 'Accepted']
['s034122329', 's789877198']
[3064.0, 3064.0]
[1573.0, 1587.0]
[218, 230]