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
p02554
u637289184
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nmod = 10**9+7\nprint ((pow(10,N,mod) - 2*pow(9,N,mod) + pow(8,N,mod)) % mod)', 'N = int(input())\nmod = 10**9+7\nprint ((pow(10,N,mod) - 2*pow(9,N,mod) + pow(8,N,mod)) % mod)']
['Runtime Error', 'Accepted']
['s987905954', 's021705176']
[9136.0, 8976.0]
[26.0, 30.0]
[92, 92]
p02554
u674588203
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['\n\nimport math\n\nN=int(input())\n\nmod=10**9+7\n\nprint((10**N)%mod-(9**N)%mod)-(9**N)%mod+(8**N)%mod)', '\n\n\nN=int(input())\n\nmod=10**9+7\n\nprint(((10**N)-(9**N)-(9**N)+(8**N))%mod)']
['Runtime Error', 'Accepted']
['s793992007', 's717978348']
[8928.0, 11088.0]
[26.0, 569.0]
[140, 117]
p02554
u679750439
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['import math\nn=int(input)\nm=(10**n)-(2*(9**n))+(8**n)\nprint(m%1000000007)', 'import math\nn=int(input())\nm=((10**n)-(2*(9**n))+(8**n))%1000000007\nprint(m)\n']
['Runtime Error', 'Accepted']
['s387982166', 's364761014']
[9004.0, 10844.0]
[25.0, 390.0]
[72, 77]
p02554
u686036872
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\n\na=pow(10,n,10**9+7)\nb=pow(9,n,10**9+7)\nc=pow(8,n,10**9+7)\nprint((a-2*b+c)%(10**9+7))', 'n = int(input())\n\na=pow(10,n,10**9+7)\nb=pow(9,n,10**9+7)\nc=pow(8,n,10**9+7)\nprint((a-2*b+c)%(10**9+7))\n']
['Runtime Error', 'Accepted']
['s117957704', 's121356952']
[9060.0, 9164.0]
[23.0, 26.0]
[102, 103]
p02554
u694536861
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['import math\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 = int(input())\n\nanswer = 0\nrest = 10 ** 9 + 7\n \nif N == 1:\n ans...
['Runtime Error', 'Accepted']
['s920706544', 's754345262']
[10940.0, 11504.0]
[209.0, 585.0]
[403, 375]
p02554
u696886537
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['mod = 1000000007\ndef f(a, b):\n ans = 1\n while b:\n ans = ans * a % mod\n b >>= 1\n a = a * a % mod\n return ans\nn=int(input())\nprint(((f(10,n)-2*f(9,n)+f(8,n))%mod+mod)%mod)', 'mod = 1000000007\ndef ff(a, b):\n ans = 1\n while b:\n if b & 1: ans = ans * a % mod\n b >>= 1\n a = a * a % mod\...
['Wrong Answer', 'Accepted']
['s208503809', 's173982927']
[9168.0, 9108.0]
[29.0, 33.0]
[181, 196]
p02554
u698916859
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['\nN = int(input())\n \nprint( (10**(N-2) * N * (N-1) - (N * (N-1))) % (10**9 + 7))', 'import math\n\nN = int(input())\nr = 2\ndef combinations_count(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n \nprint(math.ceil(10**(N-2) * combinations_count(N, r) / (10**9 + 7)))', '\nN = int...
['Wrong Answer', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Runtime Error', 'Accepted']
['s024679856', 's156761590', 's408258245', 's435265178', 's448835957', 's460279140', 's644292581', 's647015454', 's883745922', 's914041106', 's524745154']
[10344.0, 15368.0, 10580.0, 14832.0, 14888.0, 14832.0, 9100.0, 10176.0, 10520.0, 10472.0, 11064.0]
[208.0, 2206.0, 198.0, 2206.0, 2206.0, 2206.0, 23.0, 43.0, 201.0, 207.0, 397.0]
[96, 229, 205, 225, 219, 193, 205, 95, 86, 85, 90]
p02554
u699715278
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nmod = 10**9+7\nans = pow(10, n, mod)\nans -= pow(9, n, mod)\nans += pow(8, n, mod)\nprint(ans % mod)\n', 'n = int(input())\nmod = 10**9+7\nans = pow(10, n, mod)\nans -= pow(9, n, mod)*2\nans += pow(8, n, mod)\nprint(ans % mod)\n']
['Wrong Answer', 'Accepted']
['s277497504', 's932841296']
[9064.0, 9104.0]
[29.0, 27.0]
[114, 116]
p02554
u714852797
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\n\nmod = 10 ** 9 + 7\n\nprint((pow(10, n, mod) - 2 * pow(9, n, mod) + pow(8, n, mod)) % mod)', 'print(10 ** int(input()) - 2 * 9 ** int(input()) + 8 ** int(input()))', 'N = int(input())\n\nmod = 10 ** 9 + 7\n\nprint((pow(10, N, mod) - 2 * pow(9, N, mod) + pow(8, N, mod)) % mod)']
['Runtime Error', 'Runtime Error', 'Accepted']
['s288376283', 's998478694', 's188017777']
[9112.0, 10348.0, 8976.0]
[29.0, 200.0, 29.0]
[105, 69, 105]
p02554
u719790500
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['\n\n#include <algorithm>\n#include <string>\n#include <ctype.h>\n#include <cstdlib>\n#include <cmath>\n#include <stack>\n#define _GLIBCXX_DEBUG\nusing namespace std;\n\nint main()\n{\n int n;\n cin >> n;\n long long a = 1, b = 1, c = 1;\n for (int i = 0; i < n; i++)\n {\n a *= 10;\n a %= ...
['Runtime Error', 'Accepted']
['s219727768', 's010754015']
[8936.0, 11100.0]
[20.0, 388.0]
[489, 62]
p02554
u723583932
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['m=10**9+7\nn=int(input())\na=(8**n)%m\nb=(9**n)%m\nc=(10**n)%m\nprint((2*b-c+a)%m)', 'm=10**9+7\nn=int(input())\na=(8**n)%m\nb=(9**n)%m\nc=(10**n)%m\nprint((c-2*b+a)%m)']
['Wrong Answer', 'Accepted']
['s445662609', 's254381643']
[10564.0, 10700.0]
[391.0, 390.0]
[77, 77]
p02554
u731461064
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['a,b,c,d = map(int, input().split())\n\nif a >= 0 and c >= 0:\n print(b*d)\nelif b <= 0 and d <= 0:\n print(a*c)\nelif a < 0 and c < 0:\n if b<=0 or d<=0:\n print(a*c) \n elif abs(a)>=abs(b) and abs(c)>=abs(d):\n print(a*c)\n else:\n print(b*d)\nelif (b<0 and c>=0):\n print(b*c)\nelif (a>=0 and d<0):\n...
['Runtime Error', 'Accepted']
['s785019651', 's280168627']
[9220.0, 9176.0]
[27.0, 26.0]
[333, 198]
p02554
u736729525
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['import sys\n\ndef test(N):\n MOD = 10**9+7\n U = (pow(10, N, MOD) - 1)%MOD\n notA = (pow(9, N, MOD) - 1)% MOD\n notB = (pow(9, N, MOD) - 1)% MOD\n A = (U - notA) % MOD\n B = (U - notB) % MOD\n AnorB = (pow(8, N, MOD) - 1)%MOD\n AorB = (U - AnorB) % MOD\n AandB = (A+B-AorB) %MOD\n print(f...
['Wrong Answer', 'Accepted']
['s930698126', 's098205537']
[9300.0, 9304.0]
[29.0, 33.0]
[862, 863]
p02554
u754511616
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N=int(input())\nprint((10**N-9**N-9**N+8**N)/(10**7+7)', 'MOD=10**9+7\nN=int(input())\nans=pow(10,N,MOD)\nans-=2*pow(9,N,MOD)\nans+=pow(8,N,MOD)\nans%=MOD\nprint(ans)']
['Runtime Error', 'Accepted']
['s889555499', 's422184624']
[8984.0, 9200.0]
[23.0, 27.0]
[53, 102]
p02554
u754727115
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
["y=(2**3)-2\nx=y*9**(y-2)%(10**9+7)\nif x<10**10:print(x)\nelse:print('ERROR')", 'n=int(input())\nx=(10**n)%(10**9+7)\ny=(9**n)%(10**9+7)\nz=(8**n)%(10**9+7)\nprint((x-2*y+z)%(10**9+7))']
['Wrong Answer', 'Accepted']
['s415516892', 's678930746']
[9088.0, 10648.0]
[32.0, 393.0]
[74, 99]
p02554
u770293614
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N=int(input())\n\nif N<2:\n\tprint(0)\nellif N==2:\n\tprint(2)\nelse:\n\twithout=10**(N-2)\n\tconsidered=(without+2)*(without+1)\n\tconsidered=considered%(1000000007)\n\tprint(considered)\n\t\n', 'N=869121\n\nif N<2:\n\tprint(0)\n\nelse:\n\twithout=10**(N-2)\n\teach=N*(N-1)\n\tfinal=without*each-each\n\n\tconsidered=...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s131375306', 's157891641', 's252085561', 's517067510', 's578610881', 's731508527', 's763075585', 's846962795', 's916721149', 's939291039', 's689085432']
[9004.0, 10244.0, 9036.0, 10584.0, 9040.0, 13356.0, 10480.0, 9156.0, 13772.0, 9084.0, 9128.0]
[30.0, 176.0, 25.0, 207.0, 23.0, 575.0, 204.0, 30.0, 667.0, 24.0, 30.0]
[174, 141, 130, 148, 126, 146, 148, 113, 150, 109, 111]
p02554
u773081031
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\n\nx = n*(n-1)*2*(10**(n-2))\n\nprint(x%(10**9 + 7))\n', 'n = int(input())\nx = n*(n-1)*2(10**(n-2))\n\nprint(x%(10**9 + 7))', 'n = int(input())\n\nx = 10**n - 2*(9**n) + 8**n\nprint(x%(10**9+7))']
['Wrong Answer', 'Runtime Error', 'Accepted']
['s447178365', 's976276328', 's317758360']
[10408.0, 10684.0, 11092.0]
[207.0, 199.0, 396.0]
[66, 63, 64]
p02554
u773440446
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['a,b,c,d = map(int,input().split())\nans = []\nfor i in c,d:\n ans.append(a*i)\nfor j in c,d:\n ans.append(b*j)\n\nprint(max(ans))', 'n = int(input())\nmod = 10**9+7\nprint((((10**n)%mod)-(9**n%mod)-(9**n%mod)+(8**n%mod))%mod)']
['Runtime Error', 'Accepted']
['s882370704', 's838626398']
[9160.0, 10556.0]
[24.0, 573.0]
[128, 90]
p02554
u785728112
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nprint(10**n-2*(9**n)-8**n)', 'n = int(input())\ns = (10**n-2*(9**n)-8**n)//1000000007\nprint(10**n-2*(9**n)-8**n)', 'n = int(input())\nmod = (10**9)+7\nans = (10**n) - 2*(9**n) + 8**n\nprint(ans%mod)']
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s023168590', 's704779991', 's121937030']
[10732.0, 11528.0, 11076.0]
[2206.0, 2206.0, 389.0]
[43, 81, 79]
p02554
u799978560
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['\n\nN = int(input())\nprint((10**N - 2*9**N + 8**N) % 10**9+7)', '\n\nN = int(input())\nprint((10**N - 2*9**N + 8**N) % (10**9+7))']
['Wrong Answer', 'Accepted']
['s946784157', 's720347900']
[11148.0, 10896.0]
[391.0, 388.0]
[107, 109]
p02554
u806988802
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\n\nn_zero = 10**n - 9**n #19\nn_nine = 10**n - 9**n #19\nn_non_zn = 8**n #64\n\na = (10**n - n_zero - n_nine - n_zn)\n\nif a < 0:\n a = -a\n\nprint(a % (10**9+7))\n', 'n = int(input())\n\nten = 10**n\nnine = 9**n\neight = 8**n\n\nn_zero = ten - nine #19\nn_zn = eight #64\n\na = (ten - n_zero * 2 - n...
['Runtime Error', 'Accepted']
['s257736398', 's546406799']
[11880.0, 11548.0]
[932.0, 392.0]
[170, 169]
p02554
u810348111
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n=int(input())\n\nprint((10**n-(9**n+9**n-8**n)%(10**9+7))', 'n=int(input())\n\nprint((10**n-(9**n+9**n-8**n))%(10**9+7))\n']
['Runtime Error', 'Accepted']
['s029258016', 's541214593']
[8944.0, 11388.0]
[27.0, 569.0]
[56, 58]
p02554
u814986259
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['a, b, c, d = map(int, input().split())\nprint(max(a*c, a*d, b*c, b*d))\n', 'N = int(input())\nans = N*(N-1)\nmod = 10**9 + 7\nans %= mod\nans = 1\nA = 1\nB = 1\nC = 1\nfor i in range(N):\n A *= 10\n B *= 9\n C *= 8\n A %= mod\n B %= mod\n C %= mod\n\nprint((A-B*2+C) % mod)\n']
['Runtime Error', 'Accepted']
['s182094035', 's921739519']
[9008.0, 9180.0]
[26.0, 522.0]
[70, 200]
p02554
u830588156
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
["def main():\n N = int(input())\n \n A = 1\n countA = 0\n for i in range(N):\n if A*10 >= 10**9 + 7:\n countA += 1\n A = (A*10)%(10**9 + 7)\n \n B = 1\n countB = 0\n for i in range(N):\n if B*9 >= 10**9 + 7:\n countB += 1\n B = (B*9)%...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s476414486', 's947805108', 's412891710']
[9152.0, 9220.0, 9096.0]
[482.0, 514.0, 312.0]
[647, 676, 406]
p02554
u837340160
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\n\nif N == 1:\n print(0)\nelif N == 2:\n print(1)\nelse:\n a = 10 ** 2\n b = 2 * 9 ** 2\n c = 8 ** 2\n mod = 10 ** 9 + 7\n ans = 0\n for i in range(N-2):\n a = a * 10 % mod\n b = b * 9 % mod\n c = c * 8 % mod\n ans = a - b + c\n ans %= mod\n ...
['Wrong Answer', 'Accepted']
['s228798962', 's152154520']
[9132.0, 9188.0]
[539.0, 570.0]
[314, 314]
p02554
u849559474
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nmod = 10**9+7\n\ndef pow(n, num):\n s = num\n for i in range(1,num):\n s = s*num%mod\n return s\nprint((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)\n', 'n = int(input())\nmod = 10**9+7\n\ndef pow(n, num):\n s = num\n for i in range(1,num):\n s = s*n%mod\n return s\nprint((pow(n,10) - 2*pow(n...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s446197336', 's535823578', 's735558186', 's343215854']
[9152.0, 9152.0, 9180.0, 9152.0]
[26.0, 30.0, 29.0, 331.0]
[160, 158, 161, 158]
p02554
u868281230
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = input()\nmod = 10**9 + 7\nans = (pow(10, n, mod) - ((2 * pow(9, n, mod)) % mod - pow(8, n, mod) + mod) % mod + mod) % mod\nprint(ans)', 'n = int(input())\nmod = 10**9 + 7\nans = (pow(10, n, mod) - ((2 * pow(9, n, mod)) % mod - pow(8, n, mod) + mod) % mod + mod) % mod\nprint(ans)\n']
['Runtime Error', 'Accepted']
['s006683005', 's664833577']
[9096.0, 9168.0]
[30.0, 28.0]
[134, 140]
p02554
u873660730
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['a = 1000000007\n\nn = input()\n\nnot0 = 1\nnot0and9 = 1\nall = 1\nfor i in range(n):\n not0and9 = (not0and9 * 8) % a\n not0 = (not0 * 9) % a\n all = (all * 10) % a;\n \nprint((all + not0and9 - 2 * not9) % a) ', 'a = 1000000007\n \nn = int(input())\n \nnot0 = 1\nnot0and9 = 1\nall = 1\nfor i in range(n):\n not0and...
['Runtime Error', 'Accepted']
['s955321477', 's150965750']
[9112.0, 9180.0]
[27.0, 417.0]
[200, 207]
p02554
u889405092
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N=int(input())\nprint((10**N-2*9*N+8**N)%(10**9+7))', 'N=int(input())\nprint((10**N-2*9**N+8**N)%(10**9+7))']
['Wrong Answer', 'Accepted']
['s440238397', 's536251905']
[10756.0, 11032.0]
[210.0, 389.0]
[50, 51]
p02554
u905029819
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\n\nnum = (N*(N-1)*10**(N-2)) / (10**9 +7)\nprint(num)', 'N = int(input())\n\nnum = N*(N-1)*(10**(N-2))/ (10**9 +7)\nprint(num)', 'N = int(input())\n\nnum = 10**N - 2*(9**N) + 8**N\nprint(num % (10**9 + 7))\n\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s231005638', 's417024988', 's856124616']
[10448.0, 10500.0, 11052.0]
[201.0, 205.0, 394.0]
[67, 66, 74]
p02554
u918601425
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N=int(input())\nMOD=10**9+7\nMAX=N+1\npowerls=[0 for i in range(MAX)]\npowerls[0]=1\npowerls[1]=base \ndef powermod(ind):\n if powerls[ind]!=0:\n return powerls[ind]\n elif ind%2==0:\n p=(powermod(base,ind//2)**2)%MOD\n powerls[ind]=p\n return p\n else:\n p=((powermod(base,ind//2...
['Runtime Error', 'Accepted']
['s118601610', 's813176887']
[16888.0, 9188.0]
[63.0, 34.0]
[416, 262]
p02554
u928758473
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['import os\nimport sys\nfrom collections import defaultdict, Counter\nfrom itertools import product, permutations,combinations, accumulate\nfrom operator import itemgetter\nfrom bisect import bisect_left,bisect\nfrom heapq import heappop,heappush,heapify\nfrom math import ceil, floor, sqrt, factorial\nfrom copy import...
['Runtime Error', 'Accepted']
['s953602551', 's343138508']
[11500.0, 11496.0]
[393.0, 393.0]
[484, 463]
p02554
u936988827
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nmod = 10**9+7\n\nans = pow(10,n,mod)\nans += pow(9,n,mod)*2\nans -= pow(8,n,mod)\n\nprint(ans%mod)\n', 'n = int(input())\nmod=10^9+7\nans = pow(10,n,mod)\nans =- pow(2*9,n,mod)\nans =+ pow(8,n,mod)\nprint(ans%mod)\n', 'x=int(input())\ny=10^x- 9^x -9^x-8^x\nprint(y)\n', 'n = int(input())\nmod=10**9+7...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s172356204', 's425113755', 's465865567', 's686599382', 's691906888', 's795968609', 's772645325']
[9016.0, 9096.0, 9128.0, 9136.0, 10820.0, 9000.0, 9144.0]
[30.0, 27.0, 24.0, 29.0, 387.0, 30.0, 26.0]
[110, 105, 45, 105, 97, 106, 110]
p02554
u941645670
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['\nn = int(input())\nn_all = 10**(n) % mod\nbad_0 = 9**(n)%mod\nbad_9 = 9**(n)%mod\nbad_18 = 8**(n)%mod\n\nprint(n_all-bad_0-bad_9+bad_18)', 'n = int(input())\nmod = (10**9)+7\nn_all = 10**(n) % mod\nbad_0 = 9**(n)%mod\nbad_9 = 9**(n)%mod\nbad_18 = 8**(n)%mod\n\nprint((n_all-bad_0-bad_9+bad_18)%mod)']
['Runtime Error', 'Accepted']
['s862020763', 's775302597']
[10384.0, 10600.0]
[206.0, 580.0]
[130, 151]
p02554
u944731949
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\n\nans = (N ** 10 - N ** 9 - N ** 9 + N ** 8) % (10 ** 9 + 7)\nprint(ans)', 'N = int(input())\n\nans = (10 ** N - 9 ** N - 9 ** N + 8 ** N) % (10 ** 9 + 7)\nprint(ans)']
['Wrong Answer', 'Accepted']
['s462496876', 's967065006']
[8988.0, 11072.0]
[31.0, 581.0]
[87, 87]
p02554
u945342410
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['import math\nn = int(input())\nans = math.factorial(10) / math.factorial(10 - (n-2))\nprint(ans % (10**9 + 7))', 'n = int(input())\nans = math.factorial(10) // math.factorial(10 - (n-2))\nprint(ans % (10**9 + 7))', 'import math\nn = int(input())\nans = math.factorial(10) // math.factorial(10 - (n-2))\nprint(ans % (10...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s023481420', 's059306032', 's105787969', 's154672259', 's129179719']
[9148.0, 9108.0, 9164.0, 10668.0, 11116.0]
[24.0, 32.0, 29.0, 460.0, 583.0]
[107, 96, 108, 73, 74]
p02554
u955125992
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\n\nMOD = 10**9 + 7\n\nans = pow(10, n, MOD)-pow(9, n, MOD) - pow(9, n, MOD) + pow(8, n, MOD)\n\n\nans (ans+MOD)%MOD\n\nprint(ans)', 'n = int(input())\n\nMOD = 10**9 + 7\n\nans = pow(10, n, MOD)-pow(9, n, MOD) - pow(9, n, MOD) + pow(8, n, MOD)\n\n\nans = (ans+MOD)%MOD\n\nprint(ans)']
['Runtime Error', 'Accepted']
['s231918471', 's147189131']
[9020.0, 9124.0]
[25.0, 30.0]
[150, 152]
p02554
u964904181
2,000
1,048,576
How many integer sequences A_1,A_2,\ldots,A_N of length N satisfy all of the following conditions? * 0 \leq A_i \leq 9 * There exists some i such that A_i=0 holds. * There exists some i such that A_i=9 holds. The answer can be very large, so output it modulo 10^9 + 7.
['from functools import reduce\n\nN = int(input())\nmod = 10**9 + 7\n\n\ndef powmod(val, n, mod):\n vals = [val]*n\n ret = reduce(lambda x, y : x * y % mod, vals)\n\n return ret\n\n \n \n\n return ret\n\n\nall = powmod(10, N, mod)\nb = powmod(9, N, mod)\nc = powmod(8, N, mod)', 'from functools import ...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s096942477', 's694832032', 's998600991']
[17340.0, 9472.0, 9492.0]
[422.0, 23.0, 312.0]
[319, 361, 373]
p02555
u011220523
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['#ifdef mmlang_source_11_lines\n\nS = inputInt()\n\n@memo(size=2005)\ndef func(x) -> int:\n if x<3:\n return 0\n ret = 1\n ret += func(x-(3:x-3+1)) mod 1e9+7\n return ret\n\nprint(func(S))\n\n#endif\n\n//#define NDEBUG\n\n\n\n#include <deque>\n#include <string>\n#include <map>\n\n#include <stack>\n#...
['Runtime Error', 'Accepted']
['s577101964', 's808116819']
[8944.0, 9300.0]
[25.0, 513.0]
[4903, 292]
p02555
u021019433
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['b,c,a=1,M=1e9+7;main(s){for(scanf("%d",&s);s-->2;c=(a+b)%M)a=b,b=c;print("%d",c);}', 'b,c,a=1,M=1e9+7;main(s){for(scanf("%d",&s);s-->2;c=(a+b)%M)a=b,b=c;printf("%d",c);}', 'a = 1; b = c = 0\nfor _ in range(int(input()) - 2):\n a, b, c = b, c, (a + c) % (10**9 + 7)\nprint(c)\n']
['Runtime Error', 'Runtime Error', 'Accepted']
['s367646134', 's869433281', 's484733399']
[8856.0, 9016.0, 9108.0]
[22.0, 23.0, 29.0]
[82, 83, 100]
p02555
u131881594
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s=int(input())\ndp=[0 for i in range(s+10)]\ndp[3]=1\nmod=10**9+7\nfor i in range(3,s+3):\n dp[i]=1\n for j in range(i-2): dp[i]=(dp[i]+dp[j])%mod\nprint(dp)', 's=int(input())\ndp=[0 for i in range(s+10)]\ndp[3]=1\nmod=10**9+7\nfor i in range(3,s+3):\n dp[i]=1\n for j in range(i-2): dp[i]=(dp[i]+dp[j])%mo...
['Wrong Answer', 'Accepted']
['s827572332', 's571055886']
[9120.0, 9184.0]
[430.0, 419.0]
[156, 159]
p02555
u165318982
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\ntable = [0,0,1]\nif N >= 4:\n for i in range(3, N):\n table.append((table[i-1] + table[i-3]) % mod)\n print(table[-1] % mod)\nelif N == 3:\n print(1)\nelse:\n print(0)', 'import math\nmod = 10 ** 9 + 7\ndef combinations_count(n, r): \n return math.factorial(n) // (math.factorial(n - r) * m...
['Runtime Error', 'Accepted']
['s862035684', 's754785380']
[9172.0, 9232.0]
[26.0, 115.0]
[183, 612]
p02555
u173925978
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nif S < 3: return 0\nMODULO = int(1e9+7)\ndp = [0,0,0,1]\nfor i in range(4,S+1):\n x = dp[i-3] + dp[i-1]\n x %= MODULO\n dp.append(x)\nprint(dp[-1])', 'S = int(input())\nif S < 3: return 0\nMODULO = int(1e9+7)\ndp = [0,0,0,1]\nfor i in range(4,S+1):\n x = dp[i-3] + dp[i-1]\n x %= MODULO\n dp.ap...
['Runtime Error', 'Runtime Error', 'Accepted']
['s620259399', 's727406569', 's773658943']
[9064.0, 8984.0, 9088.0]
[25.0, 23.0, 32.0]
[160, 159, 204]
p02555
u189806337
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\np = [1]*(s+1)\nmod = 10**9 + 7\n\np[1] = 0\np[2] = 0\nif s >= 3\n\tfor i in range(3,s+1):\n\t\tp[i] = (sum(p[:i-2]))%mod\nprint(p[s])', 's = int(input())\np = [0]*(s+1)\nmod = 10**9 + 7\np[0] = 1\n\nif s >= 3:\n\tfor i in range(3,s+1):\n\t\tp[i] = (sum(p[:i-2]))%mod\nprint(p[s])']
['Runtime Error', 'Accepted']
['s506280980', 's824253304']
[8868.0, 9204.0]
[23.0, 46.0]
[139, 131]
p02555
u237380198
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\nmaxcount = int(s / 3)\namari = s % 3\ncount = 0\nif amari == 0 and maxcount > 0:\n count = 1\n\nfor i in range(maxcount):\n amari = s - (i + 1) * 3\n count += comb(amari + i, i, exact=True)\n count %= 1000000007\nprint(count)', 'from scipy.special import comb\n\ns = int(input())\nmaxcoun...
['Runtime Error', 'Accepted']
['s728971010', 's667721704']
[9124.0, 42320.0]
[27.0, 236.0]
[244, 299]
p02555
u240444124
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['n=int(input())\nif n<6:print(int(n>2));quit()\nM=10**9+7\nln,hn,dp=n-6,n-5,2\ns=0\nn,d=n-5,1\nwhile n:\n for i in range(3):n=(n*ln)%M;ln-=1\n for i in range(2):n=(n*pow(hn,-1,M))%M;hn-=1\n d=(d*pow(dp,-1,M))%M,dp+=1\n s=(s+n*d)%M\nprint(s)', 'n=int(input())\nif n<6:print(int(n>2));quit()\nM=10**9+7\nln,hn,dp=n-6,...
['Runtime Error', 'Runtime Error', 'Accepted']
['s834808175', 's843042687', 's763413664']
[9048.0, 9224.0, 9200.0]
[23.0, 30.0, 31.0]
[232, 232, 230]
p02555
u265506056
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S=int(input())\nMOD=10**9+7\ndp=[0]*(S+1)\ndp[0]=1\nfor i in range(1,S+1):\n for j in range(0,S-2):\n dp[i]+=dp[j]\n dp[i]%=MOD\nprint(dp[S])', 'S=int(input())\nMOD=10**9+7\ndp=[0]*(S+1)\ndp[0]=1\nfor i in range(1,S+1):\n for j in range(0,S-2):\n dp[i]+=dp[j]\n dp[i]%=MOD\nprint(dp)'...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s339144390', 's839657202', 's067874684']
[9208.0, 9196.0, 9172.0]
[856.0, 877.0, 456.0]
[150, 147, 150]
p02555
u280016524
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S=int(input())\nans=int(0)\niqs=[1]\nfor i in range(1,S):\n iqs.append(i*iqs[-1])\n\nfor i in range(1,S//3+1):\n raw=S-i*3\n \n ans+=iqs[raw+i-1]//iqs[i-1]//iqs[raw]\n ans=ans%(10**9+7)\n print(ans)\nprint(ans)', 'S=int(input())\nans=int(0)\niqs=[1]\nfor i in range(1,S):\n iqs.append(...
['Wrong Answer', 'Accepted']
['s954740421', 's932853492']
[11296.0, 11400.0]
[56.0, 56.0]
[277, 258]
p02555
u280978334
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
[' from math import log10\n\n class Mod:\n fac = []\n inv = []\n finv = []\n mod = 0\n def __init__(self,maxi:int ,mod:int):\n self.mod = mod\n self.fac = [1]*maxi\n self.inv = [1]*maxi\n self.finv = [1]*maxi\n for i in rang...
['Runtime Error', 'Accepted']
['s582331027', 's801604329']
[8864.0, 9288.0]
[29.0, 30.0]
[1107, 967]
p02555
u285443936
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from scipy.special import comb\n\nS = int(input())\n\nn = S//3\nk = S%3\nQ = 10**9+7\nans = 0\nfor i in range(n):\n \n m = n-i \n ans += comb(n-1,i,exact=true)*comb(m,k,exact=True)\n if k==2:\n ans += k\n ans %=Q\nprint(ans)', 'S = int(input())\nA = [0]*(S+1)\nA[0] = 1\nMOD = 10**9+7\n\nif S<=2:...
['Runtime Error', 'Accepted']
['s165095649', 's406352658']
[42152.0, 9084.0]
[215.0, 316.0]
[270, 186]
p02555
u306033313
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\n\ntable = [1, 1, 1]\nfor i in range(s):\n table.append(table[i]+table[i+2])\nprint(table[s])', 's = int(input())\nmod = 10**9+7\ntable = [1, 0, 0]\nfor i in range(s):\n table.append((table[i]+table[i+2])%mod)\nprint(table[s])']
['Wrong Answer', 'Accepted']
['s737087569', 's081808320']
[9200.0, 9152.0]
[29.0, 33.0]
[106, 125]
p02555
u311379832
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\nINF = 10 ** 9 + 7\nprint((pow(10, N, INF) - 2 * pow(9, N, INF) + pow(8, N, INF)) % INF)', 'S = int(input())\nINF = 10 ** 9 + 7\ndp = [0] * (S + 1)\ndp[0] = 1\n\nfor i in range(1, S + 1):\n for j in range(i - 2):\n dp[i] += dp[j]\n dp[i] %= INF\n\nprint(dp[S])']
['Wrong Answer', 'Accepted']
['s971259323', 's978631892']
[8984.0, 9020.0]
[30.0, 492.0]
[103, 175]
p02555
u364555831
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['mod = 10 ** 9 + 7\n\nclass Solution:\n def FactorialMod(self, n):\n if n <= 1:\n return 1\n else:\n return n * self.FactorialMod(n - 1) % mod\n def ModInv(self, p):\n if p <= 1:\n return 1\n return (-self.ModInv(mod % p) * (mod // p)) % mod\n def F...
['Runtime Error', 'Accepted']
['s118588058', 's281227810']
[9756.0, 9208.0]
[101.0, 533.0]
[1516, 681]
p02555
u385650604
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import math\nN = input()\nN = int(N)\nx = N / 3\np = 10 **9 + 7\nif x == 0:\n print(0)\nsum = 0\nelse:\n for k in range(x):\n y = N - 3 * k\n l = k - 1\n M = y + l\n a = math.factorial(l)\n b = math.factorial(M) \n c = math.factorial(y)\n z = b / a / c\n z = z % p\n sum += z\n\nprint(z)\n\n \n\n ', 'impo...
['Runtime Error', 'Accepted']
['s042276247', 's144205729']
[9024.0, 9076.0]
[25.0, 116.0]
[286, 366]
p02555
u402228762
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['\n"""a = int(input())\n\nimport itertools\na_list = [i for i in range(3,a+1)]\n#print(a_list)\n\nfor i in itertools.combinations_with_replacement(a_list,len(a_list)):\n if(sum(i) == a):\n print(sum(i))\n """\n\nMOD = 10**9 + 7\nS = int(input())\n\ndp = [1] * 2001\ndp[0] = dp[1] = dp[2] = 0\n"""\nfor ...
['Runtime Error', 'Accepted']
['s288153923', 's667648900']
[140108.0, 9232.0]
[1215.0, 314.0]
[523, 524]
p02555
u408375121
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['n = int(input())\nmod = 10**9 + 7\n\nper = [1] * (n+1)\nfor i in range(1, n+1):\n per[i] = per[i-1] * i\n per[i] %= mod\n\ninv = [1] * (n+1)\ninv[-1] = pow(per[-1], mod-2, mod)\nfor j in range(2, n+1):\n inv[-j] = inv[-j+1] * (n-j+1)\n inv[-j] %= mod\n\ndef C(n, k):\n cmb = per[n] * inv[k] * inv[n-k]\n cmb %= m...
['Wrong Answer', 'Accepted']
['s385914936', 's017853029']
[9240.0, 9256.0]
[31.0, 33.0]
[432, 433]
p02555
u419978514
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s=int(input())\na=[0]*2001\nx=(10**9)+7\nif s<3:\n print(0)\n exit()\n \nelif 3<=x<6:\n for i in range(3,6):\n a[i]=1\n \nelse:\n for i in range(6,2001):\n a[i]=(sum(a[2:i-2])+1)%(x)\n\nprint(a[s])\n ', 'n=int(input)\n\na=list()\nfor i in range(n):\n\n a.append(list(map(int,input().strip().split()))...
['Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Accepted']
['s020553578', 's071991478', 's651780798', 's557544618']
[9196.0, 9104.0, 9128.0, 9144.0]
[47.0, 27.0, 48.0, 44.0]
[199, 247, 199, 206]
p02555
u423966555
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['def main():\n s = int(input())\n mod = 10**9+7\n dp = [0] * (s+1)\n dp[0] = 1\n for i in range(1, s+1):\n for j in range(1, (i-3)+1):\n dp[i] += dp[j]\n dp[i] %= mod\n print(dp[s])\n\nif __name__ == "__main__":\n main()\n', 'def main():\n s = int(input())\n mod ...
['Wrong Answer', 'Accepted']
['s834765250', 's169754757']
[9112.0, 9188.0]
[264.0, 28.0]
[258, 265]
p02555
u447679353
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import scipy.special.comb\nS = int(input)\nans = 0\nfor i in range(3, S+1, 3):\n ans += scipy.special.comb(S-2*(i//3)-1, i//3-1, exact=True)\nprint(ans)', 'from scipy.special import comb\nS = int(input())\nans = 0\nmod = 10**9+7\nfor i in range(3, S+1, 3):\n ans = (ans +comb(S-2*(i//3)-1, i//3-1, exact=True)) % mod...
['Runtime Error', 'Accepted']
['s335029184', 's419580807']
[42424.0, 42192.0]
[184.0, 217.0]
[148, 169]
p02555
u460745860
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\nfor i in range(S+1):\n for j in range(0,(i-3)+1):\n dp[i] += dp[j]\n dp[i] %= 10**9+7\n\nprint(dp[-1] % 10**9+7)', 'mod = pow(10,9) + 7\nS = int(input())\n\ndp = [0] * (S+1)\n\ndp[0] = 1\n\nfor i in range(S+1):\n for j in range(0,(i-3)+1):\n dp[i] += dp[...
['Wrong Answer', 'Accepted']
['s423566931', 's610509958']
[9136.0, 9144.0]
[442.0, 480.0]
[161, 173]
p02555
u466332671
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\nMOD = 1000000007\ndp = [0] * (s+1)\ndp[0] = 1\nfor i in range(1, s+1):\n for j in range(0, (i-3)+1):\n dp[i] += dp[j]\n dp[i] %= MOD\n\nprint(dp)', 's = int(input())\nMOD = 1000000007\ndp = [0] * (s+1)\ndp[0] = 1\nfor i in range(1, s+1):\n for j in range(0, (i-3)+1):\n dp[...
['Wrong Answer', 'Accepted']
['s164577669', 's680397590']
[9072.0, 9220.0]
[471.0, 476.0]
[171, 174]
p02555
u496009935
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from scipy.special import comb\nimport copy\n\nMOD = 10**+7\ns = int(input())\nnum = copy.copy(s)\ncnt = 0\nans = 0\n\nwhile num // 3 > 1:\n num //= 3\n cnt += 1\n ans += comb(s-3*cnt, cnt, exact=True, repetition=True)%MOD\n\nprint(ans)', 'from scipy.special import comb\nimport copy\n\nMOD = 10**9+7\ns = int...
['Wrong Answer', 'Accepted']
['s583878733', 's030498080']
[42392.0, 42308.0]
[219.0, 217.0]
[231, 340]
p02555
u525589885
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\nl = 10**9+7\nlist_1 = [0, 1, 1, 1]\nlist_2 = [0, 1, 2]\nfor i in range(3, s):\n list_2.append((list_2[i-1] + list_1[i])%l)\n list_1.append(list_2[i-2])\nif s = 1 or s = 2:\n print(0)\nelse:\n print(list_1[s-1])\n', 's = int(input())\nl = 10**9+7\nlist_1 = [0, 1, 1, 1]\nlist_2 = [0, 1, 2]\nfor i ...
['Runtime Error', 'Accepted']
['s644249933', 's287091939']
[8868.0, 9188.0]
[26.0, 31.0]
[223, 226]
p02555
u534610124
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\n\nL = S//3\nmod = 10**9+7\n\nres = 0\nfrom scipy.special import comb\n\nfor l in range(1,L+1):\n s = S - l*3\n a = comb(s+l-1, l-1)\n res += a\n\nprint(res%mod)', 'S = int(input())\n\nL = S//3\nmod = 10**9+7\n\nfrom operator import mul\nfrom functools import reduce\ndef cmb(n,r):\n r = m...
['Wrong Answer', 'Accepted']
['s509809719', 's220917873']
[42612.0, 9568.0]
[1755.0, 72.0]
[174, 368]
p02555
u536034761
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['def dp(i):\n if i == 1 or i == 2:\n return 0\n elif i == 3 or i == 4:\n return 1\n else:\n return dp[i - 3] + dp[i - 1]\n\n\nS = int(input())\nprint(dp(S))\n', 'S = int(input())\nmod = 10 ** 9 + 7\ndp = [0 for _ in range(S)]\ndp[0] = dp[1] = 0\ndp[2] = dp[3] = 0\n\nfor i in range(S - 3):...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s022302678', 's614775522', 's956903166', 's321910314']
[9116.0, 9076.0, 8968.0, 9144.0]
[31.0, 31.0, 24.0, 29.0]
[176, 182, 450, 273]
p02555
u539953365
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from math import comb\nmod = 10**9 + 7\ns = 1729\nans = 0\nn = 1\nwhile s - 2*n - 1 >= 0:\n ans += comb(s-2*n-1, n-1)\n ans %= mod\n n += 1\nprint(ans)', 'from math import comb\nmod = 10**9 + 7\ns = int(input())\nans = 0\nn = 1\nwhile s - 2*n - 1 >= 0:\n ans += comb(s-2*n-1, n-1)\n ans %= mod\n n +=...
['Wrong Answer', 'Accepted']
['s111268184', 's241210603']
[9036.0, 9164.0]
[72.0, 87.0]
[151, 160]
p02555
u543000780
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nmod = 10**9+7\nmemo = [-1]*(S+1)\ndef redis(s):\n if memo[s] != -1:\n return memo[s]\n else:\n if s < 3:\n memo[s] = 0\n return 0\n elif s < 6:\n memo[s] = 1\n return 1\n else:\n tmp = 0\n for num in range(s):\n tmp += (redis(num)*redis(s-num))%mod\...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s646263708', 's796016533', 's991660518', 's534239292']
[9528.0, 9000.0, 8844.0, 9140.0]
[26.0, 396.0, 24.0, 407.0]
[365, 352, 335, 365]
p02555
u556594202
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['bun=[]\nbun.append([0,0]+[1]*(s-2))\nfor j in range(1,s//3):\n bun.append([0]*(3*(j+1)-1)+[1])\n for i in range(3*(j+1),s):\n bun[j].append((bun[j][i-1]+bun[j-1][i-3])%(10**9+7))\n\nans=0\nfor i in range(s//3):\n ans = (ans+bun[i][s-1])%(10**9+7)\n\nprint(ans)', 's=int(input())\n\nbun=[]\nbun.append([...
['Runtime Error', 'Accepted']
['s296152759', 's732374815']
[9140.0, 46076.0]
[22.0, 314.0]
[265, 281]
p02555
u573234244
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from math import factorial\n \ns = int(input())\n \nans = 0\nfor i in range(s // 3):\n box = i + 1 \n ball = s - 3 * box \n \n\u3000\u3000\n \n \n ans += factorial(ball + box - 1) // (factorial(ball) * factorial(box - 1)) % (10**9 + 7)\nprint(ans)', 'from math import factorial\n\ns = int(input())\n \n...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s169007038', 's323428886', 's335183934', 's444708642', 's558367330', 's687273539', 's563927620']
[8960.0, 9016.0, 9016.0, 8956.0, 9184.0, 42332.0, 9172.0]
[30.0, 28.0, 25.0, 24.0, 26.0, 191.0, 120.0]
[678, 677, 696, 694, 727, 261, 325]
p02555
u597455618
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['MOD = 10**9+7\n\ns = int(input())\na = [0]*range(s+1)\na[0] = 1\nfor i in range(3, s+1):\n a[i] = sum(a[:i-2]) % MOD\nprint(a[s])\n', 'MOD = 10**9+7\n\ns = int(input())\na = [0]*(s+1)\na[0] = 1\nfor i in range(3, s+1):\n a[i] = sum(a[:i-2]) % MOD\nprint(a[s])\n']
['Runtime Error', 'Accepted']
['s072910178', 's217231882']
[9160.0, 9064.0]
[25.0, 41.0]
[126, 121]
p02555
u602773379
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s=int(input())\nINF=10**9 + 7\n\ndp=[0]*(s+1)\ndp[0]=1\n\nfor i in range(1,s+1): \n\tfor j in range(0,(i-3)+1):\n\t\tdp[i]+=dp[j]\n\t\tdp[i]%=INF\n\tprint(dp)\n\nprint(dp[-1])', 's=int(input())\nINF=10**9 + 7\n\ndp=[0]*(s+1)\ndp[0]=1\n\nfor i in range(1,s+1): \n\tfor j in range(0,(i-3)+1):\n\t\tdp[i]+=dp[j]\n\t\tdp[i...
['Wrong Answer', 'Accepted']
['s723918388', 's394998511']
[34256.0, 9136.0]
[730.0, 485.0]
[170, 159]
p02555
u636290142
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nmod = 10**9 + 7\n\ndp = [0] * (S+1)\ndp[0] = 1\nfor i in range(1, S+1):\n for j in range((i+3)+1):\n dp[i] += dp[j]\n dp[i] %= mod\n\nprint(dp[S])\n', 'S = int(input())\nmod = 10**9 + 7\n\ndp = [0] * (S+1)\ndp[0] = 1\nfor i in range(1, s+1):\n for j in range((i+3)+1):\n dp...
['Runtime Error', 'Runtime Error', 'Accepted']
['s468324851', 's780384905', 's929893705']
[9176.0, 9104.0, 9172.0]
[484.0, 26.0, 494.0]
[172, 172, 172]
p02555
u686230543
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\n\nfact = [1] * s\ninv = [1] * s\ninvf = [1] * s\nfor i in range(2, s):\n fact[i] = fact[i-1] * i % mod\n inv[i] = -(p // i) * inv[p % i] % mod\n invf[i] = invf[i-1] * inv[i] % mod\n\ncount = 0\nrest = s\nfor n in range(1, (s + 2) // 3):\n rest -= 3\n count = (count + inv[rest + n - 1] * invf[re...
['Runtime Error', 'Accepted']
['s674504227', 's910141333']
[9172.0, 9184.0]
[28.0, 29.0]
[341, 362]
p02555
u688839540
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['def f(n):\n if n <= 1:\n return 1\n return f(n-1)*n\n\ndef h(n,m):\n return f(n+m-1)/f(n)/f(m-1)\n\ns=int(input())\n\nres = 0\n\npair = s//3\n\nfor i in range(1,pair+1):\n res += h(s-3*i,i)\nprint(res)\n ', 'def f(n):\n res = 1\n if n <= 1:\n return 1\n while n>1:\n res *= n\n n-=1\n return res\n...
['Runtime Error', 'Accepted']
['s213495346', 's930174506']
[9632.0, 9168.0]
[59.0, 537.0]
[195, 249]
p02555
u694665829
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\na = [0]*2001\na[3] = 1\nfor i in range(4,n+1):\n a[i] = a[i-3] + a[i-1]\nmod = 10**9+7\nprint(a[s]%mod)', 's = int(input())\na = [0]*2001\na[3] = 1\nfor i in range(4,s+1):\n a[i] = a[i-3] + a[i-1]\nmod = 10**9+7\nprint(a[s]%mod)']
['Runtime Error', 'Accepted']
['s816997456', 's613850294']
[9184.0, 9240.0]
[29.0, 28.0]
[118, 118]
p02555
u698479721
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['N = int(input())\na = [0,0,0,1,1,1,2,3,4,6,9]\ns = 0\nfor nums in a:\n s += nums\nif N <= 10:\n print(a[N])\nelse:\n while len(a)<=N:\n a.append(1+s-a[-1]-a[-2])\n s += a[-1]\n\np = 10**9+7\nprint(a[-1]%p)\n ', 'N = int(input())\na = [0,0,0,1,1,1,2,3,4,6,9]\ns = 0\nfor nums in a:\n s += nums\nif N <= 10:...
['Wrong Answer', 'Accepted']
['s287223398', 's619241842']
[9236.0, 9304.0]
[30.0, 28.0]
[206, 209]
p02555
u728095140
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from operator import mul\nfrom functools import reduce\n\n\ndef combinations_count(n, r):\n r = min(r, n - r)\n numer = reduce(mul, range(n, n - r, -1), 1)\n denom = reduce(mul, range(1, r + 1), 1)\n return numer // denom\n\n\nN = int(input())\nans = 0\namari = int(N % 3)\nshou = int(N // 3)\n\nfor i in r...
['Wrong Answer', 'Wrong Answer', 'Accepted']
['s248070389', 's968291720', 's611590822']
[9632.0, 9576.0, 9536.0]
[70.0, 70.0, 73.0]
[448, 432, 433]
p02555
u729133443
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
["a,b,c=1,0,0\nexec('a,b,c=b,c,a+c;'*int(input()))\nprint(a%(1e9+7))", "a=1\nb=c=0\nexec('a,b,c=b,c,a+c;'*int(input()))\nprint(a%(10**9+7))"]
['Runtime Error', 'Accepted']
['s984487944', 's861436631']
[22480.0, 22236.0]
[54.0, 52.0]
[64, 64]
p02555
u740157634
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nmod = 10**9+7\n\ndp = [1]+[0]*(S-1)\n\nfor i in range(0, S+1):\n for j in range(3, S-2):\n dp[i] += dp[j]\n\nprint(dp[S]%mod) \n', 'S = int(input())\nmod = 10**9+7\n\ndp = [1]+[0]*S\n\nfor i in range(1, S+1):\n for j in range(0, i-2):\n dp[i] += dp[j]\n\nprint(dp[S]%mod)\n']
['Runtime Error', 'Accepted']
['s164032622', 's421851922']
[9112.0, 8964.0]
[485.0, 294.0]
[146, 141]
p02555
u764066313
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import sys\nsys.setrecursionlimit(10**7)\n\ndef input(): return sys.stdin.readline()[:-1]\nmod = 10**9 + 7\ndef readInt():return int(input())\ndef readIntList():return list(map(int,input().split()))\ndef readStringList():return list(input())\ndef readStringListWithSpace():return list(input().split())\ndef readString(...
['Runtime Error', 'Accepted']
['s915265265', 's671757161']
[8892.0, 9220.0]
[28.0, 598.0]
[584, 585]
p02555
u770293614
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['MOD=10**9+7\ndef cmb(n,r):\n if n-r < r: r = n-r\n if r == 0: return 1\n denominator = 1 \n numerator = 1 \n for i in range(r):\n numerator *= n-i\n numerator %= Q\n denominator *= i+1\n denominator %= Q\n return numerator*pow...
['Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Runtime Error', 'Accepted']
['s028651338', 's061093526', 's090260011', 's097669009', 's482633410', 's543584976', 's553081830', 's680333199', 's801356446', 's853832375', 's870781406', 's915379274', 's924472156', 's933774816', 's966439365', 's490556718']
[9028.0, 9216.0, 9044.0, 9120.0, 9188.0, 8980.0, 8848.0, 8684.0, 9120.0, 9556.0, 9072.0, 9232.0, 9120.0, 9016.0, 9116.0, 9208.0]
[26.0, 32.0, 28.0, 26.0, 26.0, 27.0, 29.0, 24.0, 27.0, 27.0, 25.0, 26.0, 30.0, 25.0, 25.0, 70.0]
[483, 259, 276, 275, 258, 273, 218, 284, 274, 271, 287, 283, 230, 889, 230, 592]
p02555
u809495242
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nfrom math import factorial\nans = 0\n\n\nm = S // 3 \n\nprint(m)\n\nfor p in range(1,m+1):\n x = S - 3*(p) \n a = factorial(x+p-1) \n b = factorial(p-1) \n c = factorial(x)\n ans += ( a / b / c )%(10**9+7)\n\n\nprint(int((ans)%(10**9+7)))\n\n\n', 'S = int(input())\nfrom math import fa...
['Runtime Error', 'Accepted']
['s581069325', 's736979406']
[9192.0, 9564.0]
[26.0, 73.0]
[286, 542]
p02555
u849559474
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s = int(input())\nmod = 10**9+7\nimport numpy as np\n\nif s == 1 or s == 2:\n print(0)\nelif s == 3 or s == 4:\n print(1)\nelse:\n array = np.zeros(s)\n array[2] = 1\n array[3] = 1\n for i in range(4, s):\n array[i] = (array[i-1] + array[i-3]) % mod\n print(array[s])\n', 's = int(input())\nmod = 10**9+7\nim...
['Runtime Error', 'Wrong Answer', 'Runtime Error', 'Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s012568308', 's178795900', 's205122226', 's211664496', 's343651671', 's578949413', 's630051120', 's144220476']
[27020.0, 27068.0, 27732.0, 28592.0, 26980.0, 27000.0, 9004.0, 27108.0]
[117.0, 132.0, 344.0, 252.0, 124.0, 127.0, 24.0, 121.0]
[264, 265, 263, 234, 237, 255, 263, 242]
p02555
u860002137
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['def cmb(n, r, p):\n if (r < 0) or (n < r):\n return 0\n r = min(r, n - r)\n return fact[n] * factinv[r] * factinv[n-r] % p\n\n\nMOD = 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) % MOD)\n inv.append((-inv[MOD % i] *...
['Runtime Error', 'Accepted']
['s137184837', 's943177442']
[127412.0, 127352.0]
[1097.0, 1143.0]
[491, 509]
p02555
u910632349
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['n=int(input())\nr=[list(map(int,input().split())) for _ in range(n)]\na,c,b,d=0,10**10,0,10**10\nfor i in range(n):\n x,y=r[i]\n a=max(a,x+y)\n c=min(c,x+y)\n b=max(b,x-y)\n d=min(d,x-y)\n d=max(0,d)\nprint(abs(max(a-c,b-d)))', 'n=int(input())\np=10**9+7\nl=[1]*(2001)\nl[1],l[2]=0,0\ns=1\nfor i in r...
['Runtime Error', 'Accepted']
['s202575462', 's820903659']
[9060.0, 9108.0]
[28.0, 33.0]
[233, 129]
p02555
u936985471
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import sys\nreadline=sys.stdin.readline\n\nS = int(readline())\n\n\n\n\nN = S // 3\n\nDIV = 10 ** 9 + 7\nn = (10 ** 6) * 2\ng1 = [1] * 2 + [0] * (n - 2) \ng2 = [1] * 2 + [0] * (n - 2) \ninverse = [0, 1] + [0] * (n - 2) 計算用テーブル\n\nfor i in range(2, n):\n g1[i] = (g1[i - 1] * i) % DIV\n inverse[i] = (-inverse[DIV % i...
['Time Limit Exceeded', 'Accepted']
['s438732306', 's153119212']
[261964.0, 9560.0]
[2213.0, 237.0]
[935, 716]
p02555
u936988827
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['n=int(input())\nmod = 10**9+7\n\ndp = [0]*(s+1)\ndp[0] = 1\n\nprint(dp[])', 's=int(input())\nmod = 10**9+7\n\ndp = [0]*(s+1)\ndp[0] = 1\nx = 0\n\nfor i in range(1,s+1):\n if i-3>=0:\n x += dp[i-3]\n x %= mod\n dp[i]=x\nprint(dp[s])\n ']
['Runtime Error', 'Accepted']
['s277473954', 's093634763']
[8972.0, 9192.0]
[27.0, 27.0]
[67, 155]
p02555
u944325914
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s=int(input())\nif s==1:\n print(0)\nexit()\nmod=10**9+7\ndp=[0]*(s+1)\ndp[1]=0\ndp[2]=0\n\nfor i in range(3,s+1):\n for j in range(3,i+1):\n dp[i]+=(dp[i-j])%mod\n dp[i]+=1\n\nprint(dp[s]%mod)', 's=int(input())\nif s==1:\n print(0)\n\u3000\u3000exit()\nmod=10**9+7\ndp=[0]*(s+1)\ndp[1]=0\ndp[2]=0\n...
['Wrong Answer', 'Runtime Error', 'Accepted']
['s061483361', 's554505399', 's123795067']
[9116.0, 9004.0, 9128.0]
[25.0, 23.0, 465.0]
[195, 201, 199]
p02555
u951289777
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['from scipy.special import comb\n\n\ns = int(input())\n\nif s < 3:\n print(0)\nelse:\n\n count = 0\n total = 0\n\n while True:\n s = s-3\n count += 1\n\n if s >= 0:\n total += comb(s+count-1, count-1)\n else:\n break\n\n print(total % (10**9+7))\n', 'from...
['Wrong Answer', 'Accepted']
['s676598710', 's900779576']
[42360.0, 41844.0]
[257.0, 252.0]
[288, 330]
p02555
u955248595
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['S = int(input())\nDP = [0]*(S+1)\nDP[0] = 1\nDP[1] = 0\nDP[2] = 0\nfor TS in range(3,S+1):\n DP[TS] = (DP[TS-1]+DP[TS-3])%Mod\nprint(DP[S])', 'S = int(input())\nDP = [0]*(S+1)\nMod = 10**9+7\nif S>=3:\n DP[0] = 1\n DP[1] = 0\n DP[2] = 0\n for TS in range(3,S+1):\n DP[TS] = (DP[TS-1]+DP[TS-3])%Mo...
['Runtime Error', 'Accepted']
['s624592917', 's705940904']
[9188.0, 9212.0]
[27.0, 25.0]
[135, 201]
p02555
u961223096
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import numpy as np\n \nn = int(input())\nprint(n)', 'import sys\nimport numpy as np\n\ndef dump(x):\n print(x, file=sys.stderr)\n\n\nMOD = 10**9+7\n\nN = int(input())\narr = np.zeros((N+1,N+1),dtype=int)\nfor i in range(3,N+1):\n arr[0,i] = 1\n\nfor i in range(1,N+1):\n sum_ = 0\n for j in range(3*i,N+1):...
['Wrong Answer', 'Accepted']
['s379292330', 's863716398']
[26872.0, 34012.0]
[136.0, 617.0]
[46, 461]
p02555
u985929170
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['import scipy', 'mod = 10**9+7\n\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\ns = int(input())\nif s==1 or s==2:\n print(0)\n ...
['Wrong Answer', 'Accepted']
['s394514375', 's532135292']
[30856.0, 9608.0]
[131.0, 68.0]
[12, 440]
p02555
u987692205
2,000
1,048,576
Given is an integer S. Find how many sequences there are whose terms are all integers greater than or equal to 3, and whose sum is equal to S. The answer can be very large, so output it modulo 10^9 + 7.
['s=int(input())\nmod=10**9+7\ndp=[0]*s\ndp[0]=1\n\nfor i in range(0,s+1):\n\tdp[i]=dp[i-1]+dp[i-3]\n\tdp[i]%=mod\n\nprint(dp[s])\n\n', 's=int(input())\nmod=10**9+7\ndp=[0]*s\n\n\nfor i in range(4,s+1):\n\tfor j in range(0,(i-3)+1):\n\t\tdp[i]+=dp[j]\n\t\tdp[i]%=mod\nprint(dp[s])\n\n', 's=int(input())\nmod=10**9+7\ndp=...
['Runtime Error', 'Runtime Error', 'Accepted']
['s009225638', 's693725798', 's171752907']
[9064.0, 9108.0, 9168.0]
[28.0, 394.0, 482.0]
[118, 131, 142]
p02556
u033602950
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['import sys\n\nfrom collections import deque, Counter, defaultdict\n#from fractions import gcd\nimport bisect\nimport heapq\n#import math\nimport itertools\nimport numpy as np\ninput = sys.stdin.readline\nsys.setrecursionlimit(10**8)\ninf = 10**18\nMOD = 1000000007\nri = lambda : int(input())\nrs = lambda : input().st...
['Runtime Error', 'Accepted']
['s783033674', 's596299018']
[43628.0, 43868.0]
[424.0, 448.0]
[513, 514]
p02556
u094191970
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:tuple(map(int,stdin.readline().split()))\n\nn=int(input())\n\nl=list(set(tuple([lnii() for i in range(n)])))\nl.sort()\n#rint(l)\n\nif len(l)==1:\n print(0)\n exit()\n\nmax_v=0\nmin_v=10**10\nfor x,y in l:\n max_v=max(max_v,abs(x)+abs...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Runtime Error', 'Accepted']
['s054116157', 's100473685', 's575035424', 's701014330', 's330187328']
[48912.0, 48848.0, 48844.0, 9044.0, 24904.0]
[654.0, 520.0, 550.0, 26.0, 238.0]
[358, 561, 433, 399, 273]
p02556
u205116974
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['def cost(x1,y1,x2,y2):\n return abs(x1-x2) + abs(y1-y2)\n\n\nn = int(input())\n\nx = []\ny = []\nfor i in range(n):\n a,b = map(int,input().split())\n x.append(a)\n y.append(b)\nans = - math.inf\nfor i in range(n):\n for j in range(i+1,n):\n ans = max(ans,cost(x[i],y[i],x[j],y[j]))\nprint(ans)',...
['Runtime Error', 'Accepted']
['s503402321', 's817022039']
[24816.0, 24928.0]
[400.0, 666.0]
[300, 425]
p02556
u223904637
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['n=int(input())\nl=[]\nfor i in range(n):\n l.append(list(map(int,input().split())))\np=sorted(l,key=lambda x: x[0]+x[1])\nq=sorted(l,key=lambda x: x[0]-x[1])\nprint(max(p[-1]-p[0],q[-1]-q[0]))', 'n=int(input())\nl=[]\nfor i in range(n):\n l.append(list(map(int,input().split())))\np=[a+b for a,b in l]\nq=[a-b fo...
['Runtime Error', 'Accepted']
['s866257037', 's846276909']
[58080.0, 62108.0]
[695.0, 578.0]
[189, 178]
p02556
u239725287
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
["import sys\n\ndef I(): return int(sys.stdin.readline())\ndef MI(): return map(int, sys.stdin.readline().split())\ndef LI(): return list(map(int, sys.stdin.readline().split()))\ndef main():\n n = I()\n x, y = MI()\n x1 = x\n x2 = x\n x3 = x\n x4 = x\n y1 = y\n y2 = y\n y3 = y\n y4 = y\n ...
['Wrong Answer', 'Accepted']
['s420223023', 's354092668']
[9364.0, 9228.0]
[520.0, 232.0]
[832, 820]
p02556
u329865314
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['n = int(input())\nl = []\nfor i in range(n):\n l.append(list(map(int,input().split())))\nm = []\nfor i in l:\n a,b = i\n k.append(a+b)\n m.append(a-b)\nk.sort()\nm.sort()\nprint(max([k[-1]-k[0],m[-1] -m[0]]))', 'n = int(input())\nl = []\nfor i in range(n):\n l.append(list(map(int,input().split())))\n\nk = []\nm ...
['Runtime Error', 'Accepted']
['s336050724', 's697684172']
[45408.0, 62052.0]
[451.0, 637.0]
[201, 209]
p02556
u347502437
2,000
1,048,576
There are N points on the 2D plane, i-th of which is located on (x_i, y_i). There can be multiple points that share the same coordinate. What is the maximum possible Manhattan distance between two distinct points? Here, the _Manhattan distance_ between two points (x_i, y_i) and (x_j, y_j) is defined by |x_i-x_j| + |y_...
['def main():\n N = int(input())\n pts = []\n m = 0\n a1 = 0\n a2 = 0\n b1 = 0\n b2 = 0\n while N != 0:\n x, y = map(int, input().split())\n a1 = max(a1, x + y)\n a2 = min(a2, x + y)\n b1 = max(b1, y - x)\n b2 = min(b2, y - x)\n N = N - 1\n print(max(...
['Wrong Answer', 'Wrong Answer', 'Wrong Answer', 'Accepted']
['s415552133', 's645753436', 's980291015', 's055680604']
[9204.0, 8992.0, 9208.0, 9172.0]
[464.0, 464.0, 462.0, 474.0]
[330, 330, 330, 371]