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
p02990
u501163846
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k=map(int,input().split())\nimport sys\nsys.setrecursionlimit(100000)\n#def cmb(n, r):\n# nCr = {}\n# if r>n: return 0\n# if r == 0 or r == n: return 1\n# if r == 1: return n\n# if (n,r) in nCr: return nCr[(n,r)]\n# nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n# return nCr[(n,r)]\n\n\ndef cmb2(n, r,...
['Wrong Answer', 'Accepted']
['s876892937', 's854689365']
[4596.0, 15492.0]
[32.0, 140.0]
[832, 479]
p02990
u502731482
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\n\nn, k = map(int, input().split())\np = factorial(n - k + 1)\n\ndef fac(n, r):\n return factorial(n) // factorial(n - r) * factorial(r)\nfor i in range(1, k + 1):\n print( (fac(n - k + 1, i) * fac(k - 1, i - 1)) % (10 ** 9 + 7))\n', 'from math import factorial\n\nn, k = map(int, inpu...
['Runtime Error', 'Accepted']
['s257852780', 's384231709']
[9308.0, 9396.0]
[228.0, 639.0]
[255, 239]
p02990
u503228842
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int,input().split())\n#BIG_NUM = 10**9+7\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 \nM = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, M + 1 ):\n g1.append( ( g1[-1]...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s191702002', 's263484023', 's588547743']
[4584.0, 4584.0, 3444.0]
[35.0, 30.0, 553.0]
[727, 723, 766]
p02990
u504562455
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\n\nn, k = [int(i) for i in input().split()]\n\nt = [[1 for i in range(k)] for j in range(k)]\n\nfor i in range(2, k):\n for j in range(1, i):\n t[i][j] = (t[i][j-1]+t[i-1][j]-1)*2+1\n\ncnt = 0\nfor i in range(k):\n if i <= n-k:\n ans = (((math.factorial(n-k+i+1)//(math.factorial(i+1)*m...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s166974142', 's283608032', 's240148398']
[767632.0, 564032.0, 357092.0]
[2158.0, 1547.0, 1178.0]
[419, 512, 382]
p02990
u505830998
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import sys\nfrom math import factorial as fc\n\nif sys.platform ==\'ios\':\n\tsys.stdin=open(\'inputFile.txt\')\n\t\t\n#+++++\nbpn=(10**9)+7\n\ndef pat(num, bunkatsu):\n\tif num==0 and bunkatsu == 0:\n\t\treturn 1\n\t\n\tif bunkatsu==0:\n\t\treturn 0\n\t\t\n\tif num < bunkatsu:\n\t\treturn 0\n\t\n\tif bunkatsu==1:\n\...
['Wrong Answer', 'Accepted']
['s607645261', 's538162318']
[3632.0, 3444.0]
[844.0, 836.0]
[886, 887]
p02990
u522293645
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,blue = map(int,input().split())\nred = n-blue\nMOD = 10**9+7\n\ndef cmb(n,r):\n if (n-r)<r: r=n-r\n if r==0: return 1\n if r==1: return n\n\n numerator = [n-r + k+1 for k in range(r)]\n denominator = [k+1 for k in range(r)]\n\n for p in range(2,r+1):\n pivot = denominator[p-1]\n if p...
['Wrong Answer', 'Accepted']
['s886920780', 's235128857']
[3444.0, 3444.0]
[1525.0, 1517.0]
[939, 984]
p02990
u525227429
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nMOD = 1000000007\n\ndef f(n, k, i):\n if i == 1:\n return n - k + 1\n if i == 2:\n return (n - k + 1) * (n - k)\n \n ret = 0\n for j in range(1, k - i + 2):\n for l in range(j + 1, n - k + j + 1):\n ret += f(n - l, k - j, i - 1)\n return ret\n\nfor i in range(1, K...
['Wrong Answer', 'Time Limit Exceeded', 'Runtime Error', 'Accepted']
['s178071144', 's688143423', 's739452885', 's253775770']
[3316.0, 143092.0, 5620.0, 5748.0]
[2104.0, 2113.0, 130.0, 224.0]
[335, 582, 498, 500]
p02990
u528470578
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['# ABC132 D Blue and Red Balls\n\nfrom scipy.misc import comb\n\nN, K = map(int, input().split())\nMOD = int(1e9)+7\n\nfor i in range(1, K+1):\n temp = comb(N-K+1, i) * comb(K-1, i-1)\n print(int(temp % MOD))', '# ABC132 D Blue and Red Balls\n\ndef comb(n, r):\n if n == 0 or r == 0:\n return 1\n if ...
['Runtime Error', 'Accepted']
['s161000738', 's824619278']
[24408.0, 3316.0]
[355.0, 523.0]
[204, 405]
p02990
u534953209
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nans = N - K + 1\nfor i in range(1, K + 1):\n if i > N - K + 1:\n ans = 0\n print(int(ans) % 1000000007)\n ans = ans * ((N - K + 1 - i) // (i + 1)) * ((K - i) // i)\n', 'N, K = map(int, input().split())\nans = N - K + 1\nfor i in range(1, K + 1):\n if i > N - K + 1:...
['Wrong Answer', 'Accepted']
['s072310549', 's580779299']
[3316.0, 3316.0]
[20.0, 20.0]
[208, 214]
p02990
u553921227
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['#atcoder_RedAndBlueBalls\n\nimport numpy as np \n\nMAX = pow(10,9)+7\n\ndef C(n,m):\n arr = np.zeros((n+1,m+1),int)\n arr[0][0] = 1 \n i = 1 \n while(i < n+1):\n arr[i][0] = 1 \n j = 1 \n while(j< i+1):\n arr[i][j] = (arr[i-1][j] + arr[i-1][j-1]) % MAX \n j+=1 \n...
['Time Limit Exceeded', 'Accepted']
['s398045885', 's349352562']
[33208.0, 14944.0]
[2108.0, 465.0]
[486, 366]
p02990
u566529875
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k=map(int,input().split())\nred = n-k\nmod=10**9+7\n\nfor i in range(1,200320032003):\n a=4\nnCk =[[0]*2005 for _ in range(2005)]\nfor i in range(2003):\n nCk[i][0] = 1\n\nfor i in range(1,2003):\n for j in range(1,i+1):\n nCk[i][j] = nCk[i-1][j]+nCk[i-1][j-1]\n\nfor i in range(1,k+1):\n print(nCk[...
['Time Limit Exceeded', 'Accepted']
['s268631689', 's794335605']
[3064.0, 5748.0]
[2104.0, 72.0]
[332, 290]
p02990
u571718615
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["from sys import stdin\nfrom math import factorial\n \nif __name__ == '__main__':\n \n N, K = [int(x) for x in stdin.readline().rstrip().split()]\n \n tmp = 1000000007\n r = 0\n for r in range(K)\n r += 1\n n = N - K + 1\n \n if n - r < 0 or K - r < 0:\n print(0)\n ...
['Runtime Error', 'Accepted']
['s335837875', 's793368408']
[2940.0, 3316.0]
[17.0, 212.0]
[494, 490]
p02990
u580093517
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k = map(int, input().split())\nmod = 10**9+7\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**7+7 \nN = 10**4\ng1 = [1, 1] \ng2 = [1, 1] \ninverse = [0, 1] 計算用テーブル\n\nfor i in range( 2, N + 1 ):\n g1.append( ( g1[-1] * i ) ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s202471039', 's315288102', 's693866664', 's158093558']
[4076.0, 3064.0, 3064.0, 3316.0]
[28.0, 17.0, 17.0, 202.0]
[589, 297, 316, 298]
p02990
u580697892
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['# coding: utf-8\nfrom math import factorial\nN, K = map(int, input().split())\nmod = 10**9 + 7\ndef combination(n, r):\n if n > r:\n return int(factorial(n) // (factorial(r) * factorial(n - r)))\n else:\n return 0\n\nfor i in range(1, K+1):\n print(combination(N-K+1, i) * combination(K-1, i-1)%...
['Wrong Answer', 'Accepted']
['s126527594', 's298833824']
[3316.0, 3316.0]
[831.0, 839.0]
[312, 313]
p02990
u597017430
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = map(int, input().split())\nimport math\ndef kai(x):\n if x == 0:\n return 1\n else:\n return math.factorial(x)\n \nfor i in range(1, k+1):\n print((kai(k-1)*kai(n-k+1)/(kai(i-1)*kai(k-i)*kai(i)*kai(n-k+1-i))) % (10**9 +7))', 'n, k = map(int, input().split())\nimport math\nmod = (10**9) +7\ndef kai(x)...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s362933890', 's676148762', 's963437279', 's459630826']
[3060.0, 3316.0, 3064.0, 3316.0]
[65.0, 65.0, 65.0, 337.0]
[230, 357, 233, 358]
p02990
u598480992
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["from math import factorial\n\n\ndef main():\n MOD = 1000000007\n inp = input().split()\n n = int(inp[0])\n k = int(inp[1])\n r = n - k\n for i in range(1, k + 1):\n if r + 1 < i:\n return\n else:\n rr = cmb(r + 1, i)\n\n if i == 1:\n bb = 1\n ...
['Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s185175618', 's241672580', 's431547064', 's355348038']
[3064.0, 3688.0, 3944.0, 3316.0]
[91.0, 174.0, 178.0, 201.0]
[548, 742, 758, 618]
p02990
u598860476
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from scipy.special import cmb\n\n\nN, K = map(int, input().split())\n\nr_cnt = N - K\nb_cnt = K\n\n\n\n\n\n\n\n\nfor i in range(1, K+1):\n print(( cmb( r_cnt+1, i ) * cmb( b_cnt-1, i-1 )) % (10**9+7))', 'from scipy.special import cmb\n\n\nN, K = map(int, input().split())\n\nr_cnt = N - K\nb_cnt = K\n\n\n\n\n\n\n\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s393861365', 's690930024', 's768861977', 's705381453']
[15408.0, 13344.0, 3064.0, 3944.0]
[158.0, 160.0, 17.0, 549.0]
[510, 538, 389, 411]
p02990
u600402037
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from operator import mul\nfrom functools import reduce\nMOD = 10 ** 9 + 7\n\nN, K = map(int, input().split())\n\ndef cmb(n, r):\n if n < r:\n return 0\n r = min(r, n-r)\n if r == 0:\n return 1\n nume = reduce(mul, range(n, n-r, -1))\n deno = reduce(mul, range(1, r+1))\n \n return nu...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s585439601', 's745491077', 's817195416', 's579426240']
[3944.0, 12604.0, 3700.0, 12752.0]
[545.0, 172.0, 174.0, 172.0]
[459, 1130, 428, 1096]
p02990
u606392530
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import itertools\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\ndef tyou(n, r):\n return combinations_count(n + r - 1, r)\n\n\nn,k=list(map(int,input().split()))\nr=n-k\nfor i in range(1,k+1):\n if(k-i>=0 and r-(i-1)>=0 and k>=i and r>=i-1):\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s044176161', 's078568831', 's246249160', 's477544216', 's504641666', 's550383289']
[3064.0, 3064.0, 3064.0, 3064.0, 3064.0, 3316.0]
[18.0, 18.0, 18.0, 18.0, 17.0, 523.0]
[383, 363, 369, 363, 363, 375]
p02990
u607075479
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nINF = 10**9 + 7\ndef powmod(a, n, mod):\n p = 1\n while n > 0:\n if n % 2 == 0:\n a = a**2 % mod\n n /= 2\n else:\n p *= a\n p %= mod\n n -= 1\n return p\n\ndef invmod(a, mod):\n return powmod(a, mod-2, ...
['Runtime Error', 'Accepted']
['s469280455', 's923032484']
[3064.0, 3444.0]
[74.0, 71.0]
[701, 754]
p02990
u608088992
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import sys\n\ndef comb(n, k, fact, revfact, mod):\n return (fact[n] * revfact[n-k] * revfact[k]) % mod\n\ndef solve():\n input = sys.stdin.readline\n N, K = map(int, input().split())\n mod = 7 + 10 ** 9\n fact = [1] * 2001\n for i in range(1, 2001):\n fact[i] = (fact[i-1] * i) % mod\n revf...
['Wrong Answer', 'Accepted']
['s786531962', 's180023326']
[3316.0, 3316.0]
[24.0, 20.0]
[809, 675]
p02990
u619458041
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["import sys\n\ndef main():\n input = sys.stdin.readline\n MOD = 10**9 + 7\n N, B = map(int, input().split())\n R = N - B\n\n # Preparation for factorial table\n factrial = [1] * (N+1)\n for k in range(1, N+1):\n factrial[k] = (factrial[k-1] * k) % MOD\n\n # Preparation for inverse of fac...
['Wrong Answer', 'Accepted']
['s235256324', 's675981932']
[3444.0, 3444.0]
[23.0, 23.0]
[1272, 1291]
p02990
u626337957
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["N, K = map(int, input().split())\n\nopes = [0] * (K)\nfor i in range(2**N):\n blue_cnt = 0\n ope_count = 0\n operating = False\n for j in range(N+1):\n bin2str = format(i, '0' + int(N) + 'b')\n if blue_cnt > K and j == (N + 1):\n break\n if operating and bin2str[j:j+1:] == ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s013614431', 's118702012', 's167605571', 's278482873', 's406818280', 's408501752', 's537897646', 's724877965', 's993153350', 's528286484']
[2940.0, 3316.0, 2940.0, 3064.0, 2940.0, 2940.0, 3188.0, 2940.0, 3064.0, 166112.0]
[17.0, 19.0, 17.0, 17.0, 17.0, 21.0, 18.0, 17.0, 17.0, 1846.0]
[670, 377, 401, 670, 570, 593, 402, 696, 1348, 433]
p02990
u626468554
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k = map(int,input().split())\n\n\n\nfor i in range(k):\n if not((n-k+2 > i)):\n print(0)\n\n else:\n total = 1\n total2 = 1\n total3 = 1\n for j in range(i+1):\n total *= n-k+1-j\n total2 *= j+1\n \n ww = (i+1)**(k-i-1)\n ans = ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s426818308', 's471830331', 's556895904', 's839110186', 's997600635', 's503019556']
[3316.0, 3060.0, 2940.0, 3316.0, 3316.0, 5748.0]
[257.0, 17.0, 17.0, 363.0, 358.0, 206.0]
[372, 404, 414, 402, 404, 354]
p02990
u626881915
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\n\ndef myfact(n):\n return math.factorial(n) % 1000000007\n\ndef combinations_count(n, r):\n return myfactorial(n) // ((myfactorial(n - r) * myfactorial(r))\n\nn, k = map(int, input().split())\nfor i in range(1, k+1):\n print(combinations_count(k-1, i-1) * combinations_count(i+1+(n-k)-(i-1)-1, (n-k)-...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s039048232', 's044131661', 's365624015', 's522577743', 's765419501', 's004432204']
[2940.0, 2940.0, 3060.0, 2940.0, 2940.0, 3316.0]
[17.0, 23.0, 17.0, 17.0, 17.0, 203.0]
[329, 334, 266, 349, 344, 350]
p02990
u638456847
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N,K = map(int, input().split())\nMOD = 10**9+7\nA = N - K + 1\n\nfrom operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0:\n return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nprint(N-K+1)...
['Runtime Error', 'Accepted']
['s627033597', 's347244004']
[3572.0, 166136.0]
[172.0, 1876.0]
[382, 408]
p02990
u644907318
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['INFTY = 10**9+7\ndef gcd(x,y):\n if x<y:\n x,y = y,x\n while y>0:\n x,y = y,x%y\n return x\ndef com(n,k):\n if k<0:\n return 0\n if k<=n//2:\n A = list(range(n-k+1,n+1))\n B = list(range(2,k+1))\n else:\n A = list(range(k+1,n+1))\n B = list(range(2,n-...
['Wrong Answer', 'Accepted']
['s489723732', 's082770257']
[3064.0, 3444.0]
[2104.0, 22.0]
[707, 565]
p02990
u656917242
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from operator import mul\nfrom functools import reduce\n\nN, K=map(int, input().split())\nred=N-K\n\ndef cmb(n, r):\n if(n<r):\n return 0\n r=min(r,n-r)\n if(r==0):\n return 1\n \n \n upper=reduce(mul, range(n, n-r, -1))\n under=reduce(mul, range(1,r+1))\n \n return upper//under\n\nn = min(N-K+1,K)...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s003229010', 's094574402', 's664323665', 's568799067']
[3572.0, 3684.0, 3940.0, 3944.0]
[27.0, 55.0, 550.0, 545.0]
[377, 362, 361, 370]
p02990
u659481093
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = [int(i) for i in input().split()]\n\n# Create the pascal triangle\npascal = [[0 for i in range(j+1)] for j in range(4001)]\npascal[0][0] = 1\nfor i in range(4000):\n for j in range(i+1):\n pascal[i+1][j] += pascal[i][j]\n pascal[i+1][j+1] += pascal[i][j]\n\n\nclass Mod(object):\n def __init...
['Time Limit Exceeded', 'Accepted']
['s087067880', 's708220910']
[530148.0, 341996.0]
[2139.0, 1685.0]
[1078, 1135]
p02990
u667024514
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,blue = map(int,input().split())\nred = n-blue\nmod = 10 ** 9 + 7\n\nnow = [1]\nfor i in range(1,red+2):\n next = []\n for j in range(min(i+1,blue+1)):\n if j == 0 or j == i:\n next.append(1)\n else:\n next.append((now[j-1]+now[j])%mod)\n now = next\n\n # print(now)\nfor...
['Wrong Answer', 'Accepted']
['s678872163', 's118703687']
[3316.0, 3444.0]
[229.0, 713.0]
[420, 641]
p02990
u669173971
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\nn,k = map(int, input().split())\nend=min(n-k+1,k)\nans=1\nfor i in range(1,end+1):\n ans=math.factorial(n-k+1)*math.factorial(k-1)//(math.factorial(i)*math.factorial(n-k+1-i)*math.factorial(i-1)*math.factorial(k-i))\n print(ans%(10**9+7))\n if end=n-k+1:\n for _ in range(end+1,k+1)\n ...
['Runtime Error', 'Accepted']
['s261137845', 's940227939']
[2940.0, 3316.0]
[17.0, 341.0]
[320, 316]
p02990
u672475305
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\n\nn,k = map(int,input().split())\nmod = 10**9+7\n\ndef comb(n,r):\n return factorial(n) / (factorial(r) * factorial(n-r))\n\nfor i in range(1,k+1):\n if i > n-k+1:\n print(0)\n else:\n x = comb(k-1,i-1) % mod\n y = comb(n-k+1,i) % mod\n print(x*y % mod)...
['Runtime Error', 'Runtime Error', 'Accepted']
['s317200284', 's988779744', 's941609001']
[3316.0, 2940.0, 3316.0]
[91.0, 17.0, 202.0]
[305, 307, 340]
p02990
u675757825
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def fac(n):\n con = 1e+9 + 7\n lp = [1]\n ln = [1, 1]\n for i in range(2, n + 1):\n lp = ln.copy()\n ln = [1]\n ln += [int((lp[j - 1] + lp[j]) % con) for j in range(1, i)]\n ln += [1]\n return ln\n\n[n, k] = [int(i) for i in input().split()]\n\nnr = fac(n - k + 1)\nnb = fac(...
['Wrong Answer', 'Accepted']
['s252658379', 's938046467']
[3444.0, 3444.0]
[813.0, 642.0]
[453, 461]
p02990
u677267454
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nMOD = 10 ** 9 + 7\n\n\ndef comb(n, k, p):\n \n from math import factorial\n if n < 0 or k < 0 or n < k:\n return 0\n if n == 0 or k == 0:\n return 1\n a = factorial(n) % p\n b = factorial(k) % p\n c = factorial(n-k) % p\n return (a*power_func(b, ...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s219955010', 's424393630', 's377802064']
[35444.0, 35644.0, 35828.0]
[238.0, 2106.0, 951.0]
[1085, 1099, 1090]
p02990
u679759899
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nMOD = 10**9 + 7\n\n\nMAX = 2005\ncom = [[0] * MAX for _ in range(MAX)]\ncom[0][0] = 1\nfor i in range(1, MAX):\n com[i][0] = 1\n for j in range(1, MAX):\n com[i][j] = (com[i-1][j-1] + com[i-1][j]) % MOD\nfor i in range(1, K+1):\n if (N-K+1) <= i:\n ans = (com[N...
['Wrong Answer', 'Accepted']
['s320764156', 's575549454']
[98628.0, 98676.0]
[1875.0, 994.0]
[425, 427]
p02990
u686230543
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = map(int, input().split())\nmod = 10 ** 9 + 7\n\nfact = [1] * (n + 1)\nfor i in range(2, n + 1):\n fact[i] = fact[i-1] * i % mod\ninv_fact = [1] * (n + 1)\ninv_fact[n] = pow(fact[n], mod - 2, mod)\nfor i in range(n - 1, 1, -1):\n inv_fact[i] = inv_factor[i + 1] * (i + 1) % mod\n\ndef comb(_n: int, _k: int) ->...
['Runtime Error', 'Accepted']
['s884457956', 's200889859']
[3064.0, 3444.0]
[18.0, 21.0]
[506, 504]
p02990
u687044304
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['# -*- coding:utf-8 -*-\ndef permutation_formula(n, r):\n return factorial(n) // factorial(n-r)\n\ndef combination_formula(n, r):\n return factorial(n) // (factorial(r)*factorial(n-r))\n\ndef solve():\n N, K = list(map(int, input().split()))\n B, R = K, N-K\n MOD = 10**9+7\n\n for i in range(1, K+1):...
['Runtime Error', 'Accepted']
['s746953312', 's106516443']
[3064.0, 3316.0]
[17.0, 202.0]
[659, 659]
p02990
u687929074
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\nN, K = map(int,input().split())\nfor i in range(1,K+1):\n ans = (math.factorial(K-1) // (math.factorial(K-1-i+1)*math.factorial(i-1))) * (math.factorial(N-K+1) // (math.factorial(N-K-i)*math.factorial(i)))\n tans = int(ans % (10**9+7))\n print(tans)', 'import math\nN, K = map(int,input().split()...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s564493522', 's594496353', 's691219134', 's823292552', 's226514699']
[3188.0, 3188.0, 3188.0, 3188.0, 3316.0]
[203.0, 202.0, 203.0, 203.0, 202.0]
[266, 264, 298, 261, 328]
p02990
u691896522
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n , k = list(map(int, input().split()))\nkaijou = []\nkaijou.append(1)\nkaijou.append(1)\ni = 2\nwhile(i <= k + 1):\n kaijou.append(i * kaijou[i - 1])\n i += 1\nfor i in range(1, k + 1):\n print(int((kaijou[k - 1] / (kaijou[i - 1] * kaijou[n - i + 1]) * ( kaijou[n - k + 1] / (kaijou[i] * kaijou[n - k + 1 - ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s326171909', 's526762859', 's585965238', 's711634580', 's540519888']
[3064.0, 3896.0, 5364.0, 5364.0, 9272.0]
[17.0, 75.0, 31.0, 30.0, 37.0]
[328, 275, 333, 345, 831]
p02990
u700805562
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def nCr(n, r, mod):\n x, y = 1, 1\n for r_ in range(1, r+1):\n x = x*(n+1-r_)%mod\n y = y*r_%mod\n return x*pow(y, mod-2, mod)%mod\n\nn, k = map(int, input().split())\nfor i in range(1, k+1): print(nCr(n-k+1, i, mod)*nCr(k-1, i-1, mod))', 'def cmb(n, r, mod):\n if (r < 0 or r > n):\n ...
['Runtime Error', 'Accepted']
['s010724766', 's748429983']
[3060.0, 3572.0]
[18.0, 23.0]
[251, 509]
p02990
u701199820
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\nfrom decimal import *\n\nn,k = map(int, input().split())\n\nfor i in range(1, k+1):\n if n-k < i:\n print(0)\n else:\n ans = ((factorial(n-k+1) // factorial(i) // factorial(n-k+1-i)) * \\\n (factorial(k-1) // factorial(i-1) // factorial(k-i))) \\\n ...
['Wrong Answer', 'Accepted']
['s570189808', 's214852554']
[5332.0, 5332.0]
[231.0, 229.0]
[402, 404]
p02990
u701318346
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["import math\n\ndef nCr(n,r):\n f = math.factorial\n return int(f(n) / f(r) / f(n-r))\n\ndef nHk(n, k):\n f = math.factorial\n return int(f(n + k - 1) // f(k) // f(n - 1))\n\nN, K = map(int, input().split())\nMOD = 10 ** 9 + 7\n\nfor i in range(1, K + 1):\n# print('i: ' + str(i))\n \n blue = 1\n\n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s159935444', 's506519174', 's625858897', 's888935239', 's336369213']
[3316.0, 3316.0, 3316.0, 3316.0, 3944.0]
[24.0, 19.0, 24.0, 21.0, 176.0]
[1026, 457, 989, 1010, 718]
p02990
u702227316
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['\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 if n == k:\n ...
['Wrong Answer', 'Accepted']
['s246527081', 's983058753']
[3444.0, 3444.0]
[244.0, 450.0]
[859, 862]
p02990
u706828591
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = map(int,input().split())\n\ndivnum = 10**9+7\n\npTri =[[1]]\nrowNum = 2000\n\ndef comb(n,m):\n if (n-k+1 >= i):\n return pTri[n][m]\n return 0\n\nfor i in range(1,rowNum):\n ls = [1]\n for j in range(1,i):\n ls.append(pTri[i-1][j-1] + pTri[i-1][j])\n ls.append(1)\n pTri.append(l...
['Wrong Answer', 'Accepted']
['s773443750', 's994360052']
[341608.0, 341608.0]
[1075.0, 1126.0]
[393, 389]
p02990
u707498674
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nMOD = 10 ** 9 + 7\n\nC = [[0] * 4005 for _ in range(4005)]\n\ndef init():\n C[0][0] = 1\n for i in range(4002):\n for j in range(0, i+1):\n C[i+1][j] += C[i][j]\n C[i+1][j] %= MOD\n C[i+1][j+1] += C[i][j]\n C[i+1][j+1] %= MOD\n...
['Time Limit Exceeded', 'Accepted']
['s166458357', 's803483506']
[221076.0, 3944.0]
[2118.0, 549.0]
[697, 619]
p02990
u711238850
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['M = 10**9+7\n\ndef factorial(n):\n f = 1\n for i in range(1,n+1):\n f = f*i%M\n return f\n\ndef comb(n,k):\n if n==0 or k == 0:\n return 1\n if n<k:\n return 0\n\n return perm(n,k)*inverse(factorial(k))%M\n\ndef mcomb(n,k):\n return comb(n+k-1,k)\n\ndef perm(n,k):\n if n==...
['Runtime Error', 'Accepted']
['s517578592', 's652493184']
[3064.0, 3316.0]
[18.0, 530.0]
[602, 617]
p02990
u712273874
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\n\ndef count_pattern(n, r):\n if r == 0:\n return 1\n else:\n a = factorial(k) / factorial(r) / factorial(n - r)\n\nn, k = map(int, input().split())\n\nfor i in range(k):\n blue_pattern = count_pattern(n, i - 1)\n red_pattern = count_pattern(k, i)\n total_patte...
['Runtime Error', 'Accepted']
['s238543143', 's104575015']
[3060.0, 3316.0]
[17.0, 885.0]
[379, 492]
p02990
u720065198
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = map(int, input().split())\n\nfrom operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: \n return 1\n over = reduce(mul, range(n,n-r,-1)\n under = reduce(mul, range(1,r+1))\n return over//under\n\ndef out(num):\n print(num%1000000007)\n\nfor i i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s085365419', 's145907437', 's279835359']
[2940.0, 2940.0, 3944.0]
[17.0, 17.0, 176.0]
[392, 401, 406]
p02990
u727148417
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from scipy.misc import comb\nimport math\nMOD = 10 ** 9 + 7\nN, K = map(int, input().split())\nans = 0\nfor j in range(min(K, N-K+1)):\n if j != N-K:\n tmp = (comb(N-K+1, j+1)) % MOD\n else:\n tmp = 1\n print(int((comb(K-1, j) * tmp) % MOD))\nif min(K, N-K+1) == N-K+1:\n for i in range(N-K+1...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s243527110', 's285683050', 's338347849', 's200373095']
[16052.0, 16056.0, 23256.0, 3316.0]
[209.0, 221.0, 324.0, 212.0]
[329, 329, 332, 312]
p02990
u728566015
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nmod = 10**9 + 7\n\nfor i in range(1, K + 1):\n print(int(((comb(K - 1, i - 1) % mod) * (comb(N - K + 1, i) % mod)) % mod))', 'N, K = map(int, input().split())\nmod = 10**9 + 7\n\nfactorial = [1]\ninverse = [1]\n\nfor i in range(1, N + 2):\n factorial.append(factorial[i - 1] * i...
['Runtime Error', 'Accepted']
['s908418660', 's300347593']
[2940.0, 3572.0]
[17.0, 29.0]
[155, 568]
p02990
u729133443
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k=map(int,input().split())\np=n-k+1\nfor i in range(k):print(p%(10**9+7));p=p*(k-i)*(n-k+1-i)//i//-~i', 'M=10**9+7\nn,k=map(int,input().split())\nfac=[1]\nfor i in range(1,n+k+1):fac+=fac[-1]*i%M,\ninv=[pow(fac[-1],M-2,M)]\nfor i in range(1,n+k+1)[::-1]:inv+=inv[-1]*i%M,\ninv.reverse()\ncomb=lambda n,k:k<=n and fac...
['Runtime Error', 'Accepted']
['s988134026', 's069739059']
[3060.0, 3572.0]
[17.0, 22.0]
[101, 284]
p02990
u735891571
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['\nfrom operator import mul\nfrom functools import reduce\n\ndef cmb(n,r):\n r = min(n-r,r)\n if r == 0: return 1\n over = reduce(mul, range(n, n - r, -1))\n under = reduce(mul, range(1,r + 1))\n return over // under\n\nN, K = map(int, input().split())\n\nif N-K+1 > K:\n p = K\n for i in range(1, ...
['Wrong Answer', 'Accepted']
['s557011485', 's664493375']
[3688.0, 3944.0]
[180.0, 181.0]
[446, 569]
p02990
u740284863
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k = map(int,input().split())\nmod = 10**9+7\na = 1\nb = n-k+1\nfor i in range(k):\n ans = a*b % mod\n print(ans)\n a *= ((k-1-i)//(i+1))\n b *= ((n-k-i)//(i+2))', 'n,k = map(int,input().split())\nmod = 10**9+7\na = 1\nb = n-k+1\nfor i in range(k):\n ans = a*b % mod\n print(ans)\n a *= (k-1-i)//...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s036408387', 's145670452', 's605776762', 's799168446']
[9104.0, 9176.0, 9224.0, 9096.0]
[25.0, 29.0, 32.0, 35.0]
[166, 162, 186, 168]
p02990
u750783400
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['\n\nimport sys\nsys.setrecursionlimit(100000)\nnCr = {}\ndef cmb(n, r):\n if r == 0 or r == n: return 1\n if r == 1: return n\n if (n,r) in nCr: return nCr[(n,r)]\n nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1)\n return nCr[(n,r)]\n\na = cmb(n,r)\n\n\nn,k = map(int,input().split())\n\nfor i in range(1,k+1):\n...
['Runtime Error', 'Accepted']
['s254727370', 's614207936']
[3064.0, 3944.0]
[18.0, 175.0]
[405, 462]
p02990
u756399469
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import sys\nN, B = map(int,input().split())\nR = N-B\nT = 1000000007\n\nc1 = 1\nc2 = R +1\n\nprint(c1*c2%T)\n\ni = 2\nwhile(i <= B and i <= R+1):\n\tc1 = c1 // (i-1)* (B-1-i+2)\n\tc2 = c2 // i * (R+1-i +1)\n\tif B-1-i+2>0 and R+1-i +1 > 0 and c1 >0 and c2 > 0:\n\t\tprint((c1%T)*(c2%T)%T)\n\telse:\n\t\tbreak\n\ti += 1...
['Wrong Answer', 'Accepted']
['s097945573', 's458493763']
[3188.0, 99212.0]
[20.0, 793.0]
[291, 580]
p02990
u767432305
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\ndef comb(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nN,K=map(int,input().split())\ndiv=10**9+7\n\nfor i in range(K):\n if N-K+<i:\n print(0)\n else:\n print(comb(K-1,i)*comb(N-K+1,i+1)%div)', 'import math\ndef comb(n, r):\n return math.fac...
['Runtime Error', 'Accepted']
['s244374513', 's819048456']
[2940.0, 3316.0]
[17.0, 202.0]
[254, 253]
p02990
u775681539
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["import sys\nread = sys.stdin.buffer.read\nreadline = sys.stdin.buffer.readline\nreadlines = sys.stdin.buffer.readlines\nP = int(1e9)+7\nfrom math import factorial\nimport numpy as np\n\ndef C(n, r, P):\n if (r == 0) or (n == 0):\n return 1\n u = np.multiply.accumulate(np.arange(n-r+1, n+1))[-1]\n r = ...
['Wrong Answer', 'Accepted']
['s139107143', 's817872083']
[18748.0, 3316.0]
[304.0, 798.0]
[586, 400]
p02990
u778926388
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10**9+7\n\nN, K = map(int, input().split())\nR = N-K\n\nfor i in range(1, K+1):\n if i > R+1:\n print(0)\n else:\n ans = cmb(R+1, i, mod) * cmb(K-1, i-1, mod) % mod...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s051703291', 's443664321', 's981857694', 's618626814']
[3060.0, 3444.0, 2940.0, 4596.0]
[17.0, 1114.0, 17.0, 30.0]
[325, 305, 548, 550]
p02990
u781262926
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import sys\ninputs = sys.stdin.readlines()\n\nfrom functools import lru_cache\n\ndef xgcd(a, b):\n x0, y0, x1, y1 = 1, 0, 0, 1\n while b != 0:\n q, a, b = a // b, b, a % b\n x0, x1 = x1, x0 - q * x1\n y0, y1 = y1, y0 - q * y1\n return a, x0, y0\n\n@lru_cache(maxsize=MOD)\ndef modinv(a, m...
['Runtime Error', 'Wrong Answer', 'Accepted']
['s489016637', 's908479150', 's931801405']
[3700.0, 3444.0, 9208.0]
[24.0, 41.0, 42.0]
[1252, 1233, 2523]
p02990
u782009499
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial as f\nn, k = (int(i) for i in input().split())\nfor i in range(1,k+1):\n u1 = f(n-k+1) / (f(n-k+1-i) * f(i))\n u2 = f(k-1) / (f(k-i) * f(i-1))\n ans = (u1 * u2) % (10**9 + 7)\n print(ans)', 'n, k = (int(i) for i in input().split())\nmod = 10**9 + 7\nc = [[1], [1,1]]\nfor i in ra...
['Runtime Error', 'Accepted']
['s914078640', 's442614054']
[3060.0, 83468.0]
[90.0, 799.0]
[220, 380]
p02990
u785578220
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['class BigCombination(object):\n __slots__ = ["mod", "factorial", "inverse"]\n\n def __init__(self, mod: int = 10**9+7, max_n: int = 10**6):\n fac, inv = [1], []\n fac_append, inv_append = fac.append, inv.append\n\n for i in range(1, max_n+1):\n fac_append(fac[-1] * i % mod)\n\n ...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s634839332', 's704870149', 's963154414', 's976290388', 's795639821']
[3064.0, 3064.0, 3064.0, 90044.0, 90044.0]
[17.0, 18.0, 17.0, 415.0, 411.0]
[955, 955, 955, 1009, 958]
p02990
u786793781
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['#!/usr/bin/env python3\n# -*- coding: utf-8 -*-\n\n# pascal = [[] for _ in range(4005)]\n\npascal_triangle = [\n [0 for _ in range(1 + i)] for i in range(4005)\n # [0 for _ in range(1 + i)] for i in range(10)\n]\n\ndef init():\n pascal_triangle[0][0] = 1\n for i in range(1, len(pascal_triangle)):\n ...
['Time Limit Exceeded', 'Accepted']
['s426918430', 's642872407']
[559484.0, 3316.0]
[2138.0, 834.0]
[1474, 792]
p02990
u787456042
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from scipy.misc import comb\n\nn, k = list(map(int, input().split()))\ndekai = 10**9+7\n\ndef mycomb(a, b) :\n return int(comb(a, b, exact=True))%dekai\n\ndef usless(tukau, i) :\n if tukau-i+1 < 0 :\n return 0\n else :\n return mycomb(k-1, i-1)*mycomb(tukau-1,i-2)\n\ndef sousa(i) :\n if i ==...
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s010125013', 's537636351', 's473144921']
[15280.0, 5600.0, 3572.0]
[2108.0, 49.0, 23.0]
[581, 663, 462]
p02990
u788997230
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k = map(int,input().split())\nmod = 10**9+7\n\ndef kai(a):\n ans = 1\n for i in range(1,a+1):\n ans *= i\n return ans\n \nfor i in range(1,k+1):\n if(n-k+1<i):\n print(0)\n continue\n kusan=(kai(n-k+1))//kai(i)//kwai(n-k-i+1)%mod\n haibun=(kai(k-1)//kai(k-i)//kai(i-1))%mod\...
['Runtime Error', 'Accepted']
['s173708695', 's878192517']
[3060.0, 3316.0]
[18.0, 919.0]
[338, 337]
p02990
u797994565
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from scipy.misc import comb\nN, K = map(int,input().split())\n\nfor i in range(1,K+1):\n c1 = comb(K-1,i-1)\n c2 = comb(N-K+1,i)\n print(int((c1*c2)%(1000000000+7)))\n\n', 'def cmb(n, r, mod):\n if ( r<0 or r>n ):\n return 0\n r = min(r, n-r)\n return g1[n] * g2[r] * g2[n-r] % mod\n\nmod = 10...
['Runtime Error', 'Accepted']
['s465345761', 's865636083']
[22144.0, 3572.0]
[337.0, 24.0]
[170, 509]
p02990
u798129018
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N,K = map(int,input().split())\nMax = 2001\n\nfac = [0]*(Max)\nfinv = [0]*(Max)\ninv = [0]*(Max)\nfac[0]=fac[1]=1\nfinv[0]=finv[1]=1\ninv[1]=1\nfor i in range(2,Max):\n fac[i] = fac[i-1] * i % mod\n inv[i] = mod - inv[mod%i]*(mod//i)%mod\n finv[i] = finv[i-1]*inv[i]%mod\n\ndef Comb(n,r):\n if ...
['Runtime Error', 'Accepted']
['s954001165', 's479501261']
[3064.0, 4172.0]
[20.0, 29.0]
[578, 840]
p02990
u802963389
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['c = 10**9+7\n\nn, k = map(int, input().split())\n\ndef combinations_count_mod(n, r):\n ret = 1\n for i in range(r):\n ret *= (n-i)/(r-i) % c\n return ret\n\nfor i in range(1, k+1):\n a = combinations_count_mod(k-1, i-1) \n if n-k > i-1:\n# if n-k-i >= 1:\n b = (combinations_count_mod(n-k-1, i-1) * ((n-k...
['Runtime Error', 'Accepted']
['s721844425', 's800402778']
[3064.0, 3316.0]
[24.0, 830.0]
[427, 356]
p02990
u805403870
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = map(int,input().split())\n\n\ndef reciprocal(m, n):\n\n if (m > n):\n m = m % n\n a0 = n\n a1 = m\n x0 = 1\n x1 = 0\n y0 = 0\n y1 = 1\n while (a1 != 0):\n q = a0 // a1\n r = a0 % a1\n x2 = x0 - q * x1\n y2 = y0 - q * y1\n a0 = a1\n a1 = r...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s095750158', 's584128532', 's868529081']
[3444.0, 3444.0, 3444.0]
[23.0, 28.0, 23.0]
[1253, 1289, 1288]
p02990
u809700806
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def resolve():\n N, K = map(int, input().split())\n const = 1e9 + 7\n n_iter = int(min(K, N - K + 1))\n for i in range(1, n_iter + 1):\n ans = combinations_count(N - K + 1, i) * combinations_count(\n K - 1, i - 1)\n print(int(ans % const))\nresolve()', 'import math\n\n\ndef combin...
['Runtime Error', 'Accepted']
['s506902178', 's612145531']
[3060.0, 3316.0]
[18.0, 202.0]
[279, 443]
p02990
u812587837
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\n\ninf = 10**9+7\n\ndef combinations_count(n, r):\n return math.factorial(n) / (math.factorial(n - r) * math.factorial(r))\n\nn, k = map(int, input().split())\n\nred = n - k\nfor i in range(1,k+1):\n if i == 1:\n print(red + 1 -i)\n else:\n print(combinations_count(red+1, i)*2**(k-i...
['Runtime Error', 'Runtime Error', 'Accepted']
['s201804608', 's761790157', 's385695369']
[3060.0, 3188.0, 3316.0]
[64.0, 138.0, 203.0]
[310, 311, 326]
p02990
u812867074
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k= map(int,input().split())\nfrom math import factorial \nfor i in range(1,k+1):\n print(((factorial(k-1)) * (factorial(n-k+1))/(factorial(i-1))/(factorial(k-i))/(factorial(i))/(factorial(n-k+1-i)))%(10**9+7))', 'n,k= map(int,input().split())\nfrom math import factorial \nfor i in range(1,k+1):\n if n-k+1-i >= i:...
['Runtime Error', 'Runtime Error', 'Accepted']
['s219242256', 's870819592', 's363921984']
[3060.0, 3316.0, 3316.0]
[18.0, 19.0, 212.0]
[209, 256, 289]
p02990
u813569174
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def cmb(n, r):\n if n < r : return 0\n else : return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\nmd=10**9+7\nn,k=map(int,input().split())\nfor i in range(k):\n a=cmb(n-k+1,i)*cmb(k-1,i-1)\n a=a%md\n print(a)', 'N,K=map(int,input().split())\na=[0]*(K+1)\na[1]=N-K+1\nfor i in range(1,K):\n i...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s282842826', 's462964029', 's463399922', 's489410929', 's643881834', 's830768083']
[3060.0, 3316.0, 3572.0, 3060.0, 3572.0, 3316.0]
[17.0, 19.0, 23.0, 17.0, 23.0, 831.0]
[226, 182, 329, 199, 352, 242]
p02990
u821712904
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\n\nn,k=map(int,input().split())\nfor i in range(1,k+1):\n if n-k<i-1:\n print(0)\n else :\n a=math.factorial(k-1)\n b=math.factorial(i-1)\n c=math.factorial(k-i)\n d=math.factorial(n-k+1)\n e=math.factorial(i)\n f=math.factorial(n-k-i+1)\n g=a/b/c\n h=d/e/f\n print(g*h%10...
['Runtime Error', 'Accepted']
['s783617818', 's976908603']
[3060.0, 3316.0]
[17.0, 213.0]
[317, 316]
p02990
u825769322
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['mod = 10**9+7\na = n-k\nif a > k: r = a\nelse: r = k\n\nc = [[0]*(r+1)]\nfor i in range(1,r+2):\n c1 = [1]\n for j in range(1,r+2):\n if i == 1:\n if i == j:\n c1.append(1)\n else:\n c1.append(0)\n else:\n if j <= i:\n c...
['Runtime Error', 'Accepted']
['s280181705', 's743071167']
[3064.0, 356488.0]
[17.0, 1929.0]
[503, 257]
p02990
u832158848
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["n,k =map(int,input().split())\na=[-1 for x in range(n)]\n\ndef kaijo(x):\n\tif x<=1:\n\t\treturn 1\n\tif a[x-1]==-1:\n\t\ta[x-1]=x*kaijo(x-1)\n\treturn a[x-1]\n\nfor i in range(1,k+1):\n\tc=kaijo(k-1)/kaijo(k-i)/kaijo(i-1)*kaijo(n-k+1)/kaijo(i)/kaijo(n-k+1-i)\n\tprint('{}'.format(c))", "def kaijo(x):\n\tif x<=1:\n\t\...
['Runtime Error', 'Runtime Error', 'Accepted']
['s126690088', 's987810442', 's404004779']
[4212.0, 3892.0, 3944.0]
[75.0, 74.0, 194.0]
[263, 210, 398]
p02990
u833492079
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['# coding: utf-8\n#-------------------------------------------------------------------\n#-------------------------------------------------------------------\nimport sys\ndef p(*a):\n s=" ".join(map(str,a))\n #print(s)\n sys.stderr.write(s+"\\n")\n#-------------------------------------------------------------------\...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s267599615', 's766041542', 's258234345']
[3316.0, 3316.0, 3444.0]
[213.0, 211.0, 1010.0]
[983, 1000, 1035]
p02990
u838299083
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from sys import stdin\n\nn, k = [int(x) for x in stdin.readline().rstrip().split()]\nMOD = 1000000007\n\nc = [[0 for i in range(4005)] for j in range(4005)]\nc[0][0] = 1\nfor i in range(4000):\n for j in range(i+1):\n c[i+1][j] += c[i][j]\n c[i+1][j+1] += c[i][j]\n\n\ndef combination(x, y):\n retu...
['Time Limit Exceeded', 'Accepted']
['s231315119', 's473974777']
[490604.0, 3316.0]
[2135.0, 203.0]
[695, 403]
p02990
u858136677
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['comb = [[0 for i in range(2001)] for k in range(2001)] #comb[i][j] = iCj\nmod = int(1e9+7)\nfor i in range(1,2001):\n comb[i][0] = 1\n comb[i][1] = i\nfor i in range(2,2001):\n for j in range(2,2001):\n comb[i][j] = comb[i-1][j] + comb[i-1][j-1]\n comb[i][j] %= mod\n\nn,k = map(int,input().spli...
['Time Limit Exceeded', 'Accepted']
['s455054252', 's546943235']
[98576.0, 5748.0]
[2110.0, 331.0]
[380, 279]
p02990
u860002137
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def prepare(n):\n\n f = 1\n factorials = [1]\n for m in range(1, n + 1):\n f *= m\n f %= MOD\n factorials.append(f)\n inv = pow(f, MOD - 2, MOD)\n invs = [1] * (n + 1)\n invs[n] = inv\n for m in range(n, 1, -1):\n inv *= m\n inv %= MOD\n invs[m - 1] = inv...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s314271137', 's352581776', 's581019497', 's738994726', 's446218451']
[9180.0, 9612.0, 31192.0, 42020.0, 9120.0]
[31.0, 361.0, 130.0, 184.0, 858.0]
[706, 619, 143, 146, 509]
p02990
u864013199
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N,K = map(int,input().split())\n\ndef nCr(n, r, mod=10**9+7):\n r = min(r, n-r)\n numer = denom = 1\n for i in range(1, r+1):\n numer = numer * (n+1-i) % mod\n denom = denom * i % mod\n return numer * pow(denom, mod-2, mod) % mod\n\nfor i in range(1,K+1):\n if N-K+1 < i:\n print(0)...
['Runtime Error', 'Accepted']
['s824425651', 's604450067']
[3060.0, 3316.0]
[17.0, 155.0]
[379, 390]
p02990
u864197622
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from collections import deque\nN, M = map(int, input().split())\n\nX = [[] for i in range(N*3)]\nfor i in range(M):\n x, y = map(int, input().split())\n X[x-1].append(y+N-1)\n X[x+N-1].append(y+N*2-1)\n X[x+N*2-1].append(y-1)\n\nS, T = map(int, input().split())\nS -= 1\nT -= 1\nQ = deque([S])\nD = [999999...
['Runtime Error', 'Accepted']
['s895305325', 's432750504']
[3692.0, 3444.0]
[21.0, 27.0]
[489, 378]
p02990
u866124363
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
["N, K = map(int, input().split(' '))\np = 10**9+7\n\n\ndef mod_inv(n, i):\n\n ans = n**5 % p\n \n while(1):\n n %= p\n\n if i == 1:\n break\n elif i % 2 == 0:\n i /= 2\n n **= 2\n elif i % 5 == 0:\n i /= 5\n n **= 5\n ...
['Wrong Answer', 'Accepted']
['s998864064', 's000182037']
[3316.0, 3316.0]
[2104.0, 819.0]
[723, 725]
p02990
u874059570
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\n\nimport math\n\ncalcj = []\ncalcj.append(0)\nfor j in range(1,N-K+1):\n try:\n calcj.append(int(math.factorial(N-K-1)/(math.factorial(j-1)*math.factorial(N-K-j))))\n except:\n calcj.append(0)\nprint(calcj)\n\nfor i in range(1, K+1):\n ans = 0\n try:\n ...
['Wrong Answer', 'Accepted']
['s003781037', 's967544266']
[3572.0, 356584.0]
[739.0, 850.0]
[697, 408]
p02990
u882209234
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\ndef combinations_count(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\ndiv = 10**9+7\n\nN,K = map(int,input().split())\n\nfor i in range(1,K+1):\n if N-K+1 <= i: break\n ans = combinations_count(N-K+1,i) % div\n ans = ans * combinations_count(K-1,i-1) % div...
['Wrong Answer', 'Accepted']
['s717382258', 's988936258']
[3188.0, 3316.0]
[201.0, 202.0]
[322, 350]
p02990
u889344512
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['\n\nimport sys\nsys.setrecursionlimit(10000)\n\nn, k = map(int,input().split())\nnck = {}\n\ndef c(n,k):\n if k == 0 or n==k:\n return 1\n elif n<k:\n return 0\n elif k == 1:\n return n \n elif (n,k) in nck:\n return nck[(n,k)]\n else:\n nck[n,k] = c(n-1,k-1)+c(n-1,k...
['Runtime Error', 'Accepted']
['s386636441', 's993189250']
[223048.0, 3444.0]
[2114.0, 1258.0]
[423, 741]
p02990
u899866702
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def fact(n, k):\n r1 = 1\n r2 = 1\n for i in range(0, k):\n r1 *= (n - i)\n r2 *= (i + 1)\n r = r1/r2\n return r\n\nN,K = (int(x) for x in input().split())\nR = N - K\nmod = 1000000007\nans = fact(R+1, 1)*fact(K-1,0)\nfor i in range(1,K+1):\n print(int(ans))\n ans = ans*(R - i + 1)*(K - 1)/(i + 1)/i\...
['Wrong Answer', 'Accepted']
['s886363281', 's765225888']
[3316.0, 3316.0]
[21.0, 20.0]
[321, 163]
p02990
u920254817
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nMOD = 10**9 + 7\nkai = []\nkai.append(1)\nfor idx in range(1, MOD+5):\n\tkai.append((kai[idx-1] * idx) % MOD)\n\n\ndef modpow(ori, po, mod):\n\tres = 1;\n\twhile(po > 0):\n\t\tif(po&1):\n\t\t\tres *= ori;\n\t\t\tres %= mod;\n\t\tori *= ori;\n\t\tori %= mod;\n\t\tpo >>= 1;\n\treturn r...
['Time Limit Exceeded', 'Accepted']
['s568698097', 's890318407']
[295320.0, 3444.0]
[2124.0, 60.0]
[485, 566]
p02990
u922449550
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['mod = 10**9 + 7\ng1 = [1, 1]\ng2 = [1, 1]\ninverse = [0, 1]\ndef comb(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\nN, K = map(int, input().split())\nR = N - K\nfor i in range(1, K+1):\n print(comb(K-1, i-1)*comb(R+1, i) % mod)', 'def framod...
['Runtime Error', 'Accepted']
['s955096705', 's506175371']
[3064.0, 3444.0]
[17.0, 945.0]
[291, 1188]
p02990
u927534107
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['import math\ndef modpow(a,b,MOD):\n if b == 0:\n return 1\n if b%2:\n return a*modpow(a**2%MOD,b//2,MOD)%MOD\n else:\n return modpow(a**2%MOD,b//2,MOD)\ndef modinv(a,MOD):\n return modpow(a,MOD-2,MOD)\ndef modcomb(n,r,MOD):\n return math.factorial(n)%MOD*modinv(math.factorial(r),MO...
['Wrong Answer', 'Accepted']
['s768113293', 's523199883']
[3316.0, 3316.0]
[291.0, 293.0]
[500, 502]
p02990
u935424675
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k=map(int,input().split())\nmaxi=min(k,n-k+1)\nq=[]\nq.append(n-k+1)\nc1=n-k+1\nc2=1\nsum=sum(q)%(1000000007)\n\nfor i in range(2,k):\n\n c1=(c1*(n-k+i)/i)%1000000007\n c2=(c2*(k-i+1)/(i-1))%1000000007\n addit=int(c1-(sum*c2))%1000000007\n q.append(addit)\n sum=(sum+addit)%1000000007\nfor i in q:\n ...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s087194320', 's581793581', 's897373456']
[3312.0, 3188.0, 3316.0]
[21.0, 19.0, 19.0]
[323, 328, 156]
p02990
u941645670
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n,k=map(int, input().split())\nmod = 10**9 + 7\nans = [0]*k\nimport math\nans[0]=(math.factorial(2+n-k-1) // (math.factorial(2+n-k-1-n+k) * math.factorial(n-k))) %mod\n\nfor i in range(1,k):\n spl = math.factorial(k-1) // (math.factorial(k-1- i) * math.factorial(i))\n rest = n-k-i\n print(spl,rest)\n if r...
['Runtime Error', 'Accepted']
['s529996979', 's557545207']
[3444.0, 3444.0]
[19.0, 203.0]
[557, 541]
p02990
u944643608
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\nmod = 10 ** 9 + 7\nfor i in range(1, K+1):\n if i > N - K + 1\n print(0)\n else:\n ans = 1\n for j in range(K - i):\n ans = ans * (K - 1 - j )% mod\n ans = ans * pow(K - i - j, mod-2, mod) % mod\n for k in range(N - K - i + 1):\...
['Runtime Error', 'Accepted']
['s222997126', 's108188525']
[2940.0, 3316.0]
[17.0, 568.0]
[439, 479]
p02990
u950708010
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def solve():\n n,k = (int(i) for i in input().split())\n mod = 10**9+7\n fact = [1]*(n+5)\n inv = [1]*(n+5)\n finv = [1]*(n+5)\n fact[0] = fact[1] = 1\n finv[0] = finv[1] = 1\n inv[1] = 1\n for i in range(2,n+4):\n fact[i] = (fact[i-1]*i)%mod\n inv[i] = mod-inv[mod%i]*(mod//i)%mod\n finv[i]= finv[i-1]...
['Wrong Answer', 'Accepted']
['s828146311', 's082754726']
[3572.0, 3572.0]
[20.0, 20.0]
[572, 573]
p02990
u956194864
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['from math import factorial\n\ndef cc(n, r):\n return factorial(n) // (factorial(n - r) * factorial(r))\n\nn, k= list(map(int, input().split()))\n\nif n == k:\n for i in range(k):\n if i == 0:\n cnt = 1\n else:\n cnt = 0\n print(cnt % (10 ** 9 + 7))\n\nelse:\n for i ...
['Runtime Error', 'Runtime Error', 'Accepted']
['s617998605', 's844216264', 's580052803']
[3316.0, 3324.0, 3316.0]
[200.0, 206.0, 203.0]
[470, 457, 469]
p02990
u962479059
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N,K=map(int,input().split())\n\nmod = 10**9+7\nn = N-K+1\nprint(n)\nfor i in range(2,K+1):\n n = n * (N-K+2-i)*(K+1-i)//i*(i-1)\n print(n%mod)\n', 'N,K=map(int,input().split())\n\n\n \nmod = 10**9+7\nx=0\nn = N-K+1\nfor i in range(2,K+1):\n n = n * (N-K+2-i)*(K+1-i)//i*(i-1)\n print(n%mod)\n', 'N,K=map(int,inp...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s305905474', 's334132336', 's402208494']
[3316.0, 3316.0, 3316.0]
[26.0, 26.0, 19.0]
[138, 139, 140]
p02990
u964299793
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N,K=map(int,input().split())\nc=[ [0 for _ in range(4000+1)] for _ in range(4000+1)]\nmod=10**9+7\nc[1][1]=1\nc[1][0]=1\nfor n in range(2,4001):\n c[n][0]=1\n c[n][1]=n\n for r in range(2,n+1):\n c[n][r]=(c[n-1][r]+c[n-1][r-1])%mod\n#print(c[4][0],c[4][1],c[4][2],c[4][3],c[4][4])\nans=0\nfor i in rang...
['Time Limit Exceeded', 'Wrong Answer', 'Accepted']
['s071142421', 's827175840', 's356225320']
[247052.0, 161996.0, 99200.0]
[2122.0, 1945.0, 1948.0]
[370, 377, 465]
p02990
u968846084
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['N, K = map(int, input().split())\ndef nCr(n, r):\n """\n Calculate the number of combination (nCr = nPr/r!).\n The parameters need to meet the condition of n >= r >= 0.\n It returns 1 if r == 0, which means there is one pattern\n to choice 0 items out of the number of n.\n """\n\n # 10C7 = 10C3\n...
['Runtime Error', 'Accepted']
['s773806910', 's716188083']
[3064.0, 3316.0]
[17.0, 552.0]
[663, 757]
p02990
u975116284
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['def comb(n,r):\n return math.factorial(n)/(math.factorial(r)*math.factorial(n-r))\n\nn, k = list(map(int, input().split()))\n\nfor i in range(1, k+1):\n if n-k < i-1:\n print(0)\n else:\n print(comb(k-1, i-1)*comb(n-k+1, i)%(10**9+7))', 'def comb(n,r):\n return math.factorial(n)/(math.factor...
['Runtime Error', 'Runtime Error', 'Accepted']
['s012994745', 's370108636', 's354578687']
[3060.0, 3060.0, 3316.0]
[17.0, 17.0, 203.0]
[248, 272, 262]
p02990
u994064513
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['MOD = 10**9 + 7\n \nN,K = [int(s) for s in input().split()]\n \ncomb = [[1]]\nfor i in range(N + 1):\n comb.append([1])\n for j in range(i):\n comb[-1].append((comb[-2][j] + comb[-2][j + 1]))\n comb[-1].append(1)\n \ndef combi(n,k):\n return comb[n][k] if n >= k else 1\n\nfor i in range(1,K+1):\n ...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s068760732', 's229165117', 's873727848', 's916856389']
[342412.0, 342996.0, 342152.0, 83816.0]
[1010.0, 928.0, 935.0, 853.0]
[352, 322, 282, 396]
p02990
u994910167
2,000
1,048,576
There are K blue balls and N-K red balls. The balls of the same color cannot be distinguished. Snuke and Takahashi are playing with these balls. First, Snuke will arrange the N balls in a row from left to right. Then, Takahashi will collect only the K blue balls. In one move, he can collect any number of consecutive ...
['n, k = list(map(int, input().split()))\nlim = 1E9 + 7\nC = [[1], [1,1]]\n\nfor i in range(2, n+10):\n C.append([1] + [(C[i-1][j-1] + C[i-1][j])%lim for j in range(1, i)] + [1])\n\nfor i in range(1, k+1):\n if n-k+1 < i or k < i:\n print(0)\n else:\n print((C[n-k+1][i]*C[k-1][i-1])%lim)', 'n, k...
['Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s025552264', 's196294272', 's374053562', 's753432527']
[67444.0, 67444.0, 2940.0, 83472.0]
[731.0, 691.0, 17.0, 797.0]
[299, 525, 679, 527]