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 answer = 0\nelse:\n answer = cmb(N, 2) * 2 * (10 ** (N - 2))\nprint(answer % rest)\n\na = cmb(N, 2)\nprint(a)\n', 'from 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\nif N == 1:\n answer = 0\nelse:\n answer = (10 ** N) - (9 ** N) - (9 ** N) + (8 ** N)\nprint(answer % rest)\n'] | ['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\n return ans\nn=int(input())\nprint(((ff(10,n)-2*ff(9,n)+ff(8,n))%mod+mod)%mod)\n'] | ['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(input())\nr = 2\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nprint(10**(N-2) * combinations_count(n, r) / (10**9 + 7))', 'import math\n\ndef combinations_count(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n\n\nN = int(input())\nr = 2\n \nprint((combinations_count(N, r) * (10**(N-r))) / (10**9 + 7))', 'import math\ndef combinations_count(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n \n\nN = int(input())\nr = 2\n \nprint(combinations_count(N, r) * 10**(N-r) % (10**9 +7))', 'import math\ndef combinations_count(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n \n\nN = int(input())\nr = 2\n\nprint(combinations_count(N, r))', 'def combinations_count(N, r):\n return math.factorial(N) // (math.factorial(N - r) * math.factorial(r))\n\n\nN = int(input())\nr = 2\n\nprint(combinations_count(N, r) * 10**(N-r) % (10**9 +7))', '\nN = int(input())\n \nprint( (8**(N-2) * N * (N-1) - (N * (N-1))) % (10**9 + 7))', '\nN = int(input())\n\nprint((10 ** (N-2) * N * (N-1) / 2) % (10**9 + 7))', '\nN = int(input())\n \nprint( (10**(N-2) * N * (N-1) -7) / (10**9 + 7))', '\nN = int(input())\n \nprint((10 ** N - 2* 9 ** N + 8 ** N) % (10 ** 9 + 7))'] | ['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 %= 1000000007;\n b *= 9;\n b %= 1000000007;\n c *= 8;\n c %= 1000000007;\n }\n cout << (a-b-b+c+1000000007)%1000000007 << endl;\n}', 'n = int(input())\nans = 10**n-2*9**n+8**n\nprint(ans%1000000007)'] | ['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 print(a*d)\nelse:\n print(b*d)', 'MOD = 10 ** 9 + 7\n\nN = int(input())\n\nans = pow(10, N, MOD)\nans -= 2 * pow(9, N, MOD)\nans += pow(8, N, MOD)\nans %= MOD \n\nprint(ans)'] | ['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"{U=}, {AorB=}, {A=}, {B=}, {AnorB=}")\n return AandB\n\n\ndef solve(N):\n MOD = 10**9+7\n dp = [[0, 0, 0, 0] for i in range(N+1)]\n dp[0] = [1, 0, 0, 0]\n A = 0\n B = 1\n C = 2\n D = 3\n for i in range(1, N+1):\n dp[i][A] = (dp[i-1][A]*8) % MOD\n dp[i][B] = (dp[i-1][A] + dp[i-1][B]*9) % MOD\n dp[i][C] = (dp[i-1][A] + dp[i-1][C]*9) % MOD\n dp[i][D] = (dp[i-1][B] + dp[i-1][C] + dp[i-1][D]*10) % MOD\n #print(i, dp[i], sum(dp[i]))\n return dp[N][D]\n\nN = int(input())\nprint(test(N))\n#print(solve(N))\n', '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"{U=}, {AorB=}, {A=}, {B=}, {AnorB=}")\n return AandB\n\n\ndef solve(N):\n MOD = 10**9+7\n dp = [[0, 0, 0, 0] for i in range(N+1)]\n dp[0] = [1, 0, 0, 0]\n A = 0\n B = 1\n C = 2\n D = 3\n for i in range(1, N+1):\n dp[i][A] = (dp[i-1][A]*8) % MOD\n dp[i][B] = (dp[i-1][A] + dp[i-1][B]*9) % MOD\n dp[i][C] = (dp[i-1][A] + dp[i-1][C]*9) % MOD\n dp[i][D] = (dp[i-1][B] + dp[i-1][C] + dp[i-1][D]*10) % MOD\n #print(i, dp[i], sum(dp[i]))\n return dp[N][D]\n\nN = int(input())\nprint(test(N))\n#print(solve(N))\n'] | ['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=final%(10**9+7)\n\n\tprint(considered)', 'N=input()\n\nif N<2:\n\tprint(0)\nelif N==2:\n\tprint(2)\nelse:\n\twithout=10*(N-2)\n\tconsidered=(without+2)*(without+1)/2\n\tprint(considered)', 'N=int(input())\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=final%(10**9+7)\n\n\tprint(considered)\n', 'N=input()\n\nif N<2:\n\tprint(0)\nelif N==2:\n\tprint(2)\nelse:\n\twithout=10*(N-2)\n\tconsidered=without*(without-1)/2\n\tprint(considered)', 'N=869121\n\nif N<2:\n\tprint(0)\n\nelse:\n\twithout=10**(N-2)\n\tconsidered=(without+2)*(without+1)\n\tconsidered=considered%(1000000007)\n\tprint(considered)\n\t', 'N=int(input())\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=final%(10**9+7)\n\n\tprint(considered)\n', 'N=int(input())\n\nif N<2:\n\tprint(0)\n\nelse:\n\twithout=10*(N-2)\n\tconsidered=(without+2)*(without+1)\n\tconsider%=10**9+7', 'N=int(input())\n\nif N<2:\n\tprint(0)\n\nelse:\n\twithout=10**(N-2)\n\tconsidered=(without+2)*(without+1)\n\tconsidered=considered%(1000000007)\n\tprint(considered)', 'N=input()\n\nif N<2:\n\tprint(0)\n\nelse:\n\twithout=10*(N-2)\n\tconsidered=(without+2)*(without+1)\n\tprint(considered)\n', 'MOD=10**9+7\nN=int(input())\n \nall=pow(10,N,MOD)\nsub9=pow(9,N,MOD)\nsub8=pow(8,N,MOD)\nprint((all-2*sub9+sub8)%MOD)'] | ['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_zn)\n\nif a < 0:\n a = -a\n\nprint(a % (10**9+7))'] | ['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)%(10**9 + 7)\n \n C = 1\n countC = 0\n for i in range(N):\n if C*8 >= 10**9 + 7:\n countC += 1\n C = (C*8)%(10**9 + 7)\n \n Z = B*(countB-countC)*(10**9 + 7) - C\n \n ans = (A*(countA-countC)*(10**9 + 7) - 2*Z - C) % (10**9 + 7)\n \n print(ans)\n \nif __name__ == '__main__':\n main()", "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)%(10**9 + 7)\n \n C = 1\n countC = 0\n for i in range(N):\n if C*8 >= 10**9 + 7:\n countC += 1\n C = (C*8)%(10**9 + 7)\n \n Z = B*countB*(10**9 + 7) - C*countC*(10**9 + 7)\n \n ans = (A*(countA-countC)*(10**9 + 7) - 2*Z - C*countC*(10**9 + 7)) % (10**9 + 7)\n \n print(ans)\n \nif __name__ == '__main__':\n main()", "def main():\n N = int(input())\n \n A = 1\n countA = 0\n for i in range(N):\n A = (A*10)%(10**9 + 7)\n \n B = 1\n countB = 0\n for i in range(N):\n B = (B*9)%(10**9 + 7)\n \n C = 1\n countC = 0\n for i in range(N):\n C = (C*8)%(10**9 + 7)\n \n ans = (A - 2*B + C)%(10**9 + 7)\n \n print(ans)\n \nif __name__ == '__main__':\n main()"] | ['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 print(ans)\n', 'N = int(input())\n\nif N == 1:\n print(0)\nelif N == 2:\n print(2)\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 print(ans)\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,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*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,n):\n s = s*num%mod\n return s\nprint((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)\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 not0and9 = (not0and9 * 8) % a\n not0 = (not0 * 9) % a\n all = (all * 10) % a;\n \nprint((all + not0and9 - 2 * not0) % a) '] | ['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)**2)*base)%MOD \n powerls[ind]=p\n return p\n\nprint((powermod(10,N)-2*powermod(9,N)+powermod(8,N))%MOD)\n', 'N=int(input())\nMOD=10**9+7\nMAX=N+1\ndef powermod(base,ind):\n if ind==1:\n return base\n elif ind%2==0:\n return (powermod(base,ind//2)**2)%MOD\n else:\n return ((powermod(base,ind//2)**2)*base)%MOD\n\nprint((powermod(10,N)-2*powermod(9,N)+powermod(8,N))%MOD)'] | ['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 deepcopy\n \ndef main():\n n = int(input()) % (10**9+7)\n num = 0\n ans = (10**n) - 2(9**n) + (8**n) \n print(ans%810**9+7)\n \n\nif __name__ == "__main__":\n main()', '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 deepcopy\n \ndef main():\n n = int(input()) \n ans = (10**n) - 2*(9**n) + (8**n) \n print(ans%(10**9+7))\n \n\nif __name__ == "__main__":\n main()'] | ['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\nans = pow(10,n,mod)\nans =- pow(2*9,n,mod)\nans =+ pow(8,n,mod)\nprint(ans%mod)', 'n = int(input())\nmod = 10**9+7\n\nans = pow(10,n)\nans += pow(9,n)*2\nans -= pow(8,n)\n\nprint(ans%mod)', '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', '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'] | ['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**9 + 7))', 'n = int(869121)\nans = 10**n - 9**n - 9**n + 8**n\nprint(ans % (10**9 + 7))', 'n = int(input())\nans = 10**n - 9**n - 9**n + 8**n\nprint(ans % (10**9 + 7))'] | ['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 reduce\n\nN = int(input())\nmod = 10**9 + 7\n\n\ndef powmod(val, n, mod):\n \n \n\n # return ret\n\n for i in range(n):\n ret = ret * val % mod\n\n return ret\n\n\nall = powmod(10, N, mod)\nb = powmod(9, N, mod)\nc = powmod(8, N, mod)\n\nans = (all - (2*b - c))%mod\n\nprint(ans)', 'from functools import reduce\n\nN = int(input())\nmod = 10**9 + 7\n\n\ndef powmod(val, n, mod):\n \n \n\n # return ret\n\n ret = 1\n for i in range(n):\n ret = ret * val % mod\n\n return ret\n\n\nall = powmod(10, N, mod)\nb = powmod(9, N, mod)\nc = powmod(8, N, mod)\n\nans = (all - (2*b - c))%mod\n\nprint(ans)'] | ['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#include <algorithm>\n#include <cstdlib>\n#include <cstdio>\n#include <cstring>\n\nusing namespace std;\n\ntypedef long long int64;typedef __int128 int128;const char*inputCLineOrWord(int mode){static char buf[2097152];static int bufLen=sizeof(buf);static int bufPos=sizeof(buf);static bool canReadFlag=true;static bool crFlag=false;static bool enterFlag=false;if(canReadFlag&&(enterFlag?bufLen<=bufPos:(int)sizeof(buf)<=bufPos+bufPos)){if(0<bufLen-bufPos){memmove(buf,buf+bufPos,bufLen-bufPos);bufLen-=bufPos;}else{bufLen=0;}char*result=fgets(buf+bufLen,sizeof(buf)-bufLen,stdin);canReadFlag=(result!=NULL);if(result!=NULL){int n=strlen(result);enterFlag=(n!=(int)sizeof(buf)-1-bufLen||(1<=bufLen+n&&buf[bufLen+n-1]==\'\\n\'));bufLen+=n;}bufPos=0;}if(mode==0){int pos=bufPos;while(true){char c=buf[pos];if(c==32){buf[pos++]=\'\\0\';break;}else if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]=\'\\0\';break;}else if(c==13){crFlag=true;buf[pos++]=\'\\0\';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;while(true){char c=buf[bufPos];if(c==32||c==10||c==13){++bufPos;}else{break;}}return ret;}else if(mode==1){int pos=bufPos;while(true){char c=buf[pos];if(c==10){if(crFlag){crFlag=false;if(bufPos==pos){pos=++bufPos;continue;}}buf[pos++]=\'\\0\';break;}else if(c==13){crFlag=true;buf[pos++]=\'\\0\';break;}else if(c==0){break;}++pos;}const char*ret=buf+bufPos;bufPos=pos;if(crFlag){while(true){char c=buf[bufPos];if(c==13){++bufPos;crFlag=false;break;}else{break;}}}return ret;}else if(mode==2){return bufLen<=bufPos?NULL:buf+bufPos;}assert(false);return NULL;}const char*inputCWord(){return inputCLineOrWord(0);}int inputInt(){return atoi(inputCWord());}inline int mod(int x,int p){if(p<=x){do{x-=p;}while(p<=x);}else if(x<0){do{x+=p;}while(x<0);}return x;}void print_unit(bool val){printf("%s",val?"true":"false");}void print_unit(char val){printf("%c",val);}void print_unit(int val){printf("%d",val);}void print_unit(unsigned int val){printf("%u",val);}void print_unit(size_t val){printf("%zd",val);}void print_unit(const void*val){printf("%p",val);}void print_unit(long long val){printf("%lld",val);}void print_unit(__int128 val){char buf[128];int idx=128;buf[--idx]=\'\\0\';bool sign=false;if(val<0){sign=true;val=-val;}if(val==0){buf[--idx]=\'0\';}else while(val){buf[--idx]=\'0\'+(val % 10);val /=10;}if(sign){buf[--idx]=\'-\';}printf("%s",buf+idx);}void print_unit(double val){printf("%g",val);}void print_unit(const char*val){printf("%s",val);}void print_unit(const std::string&val){printf("%s",val.c_str());}template<class T>void print_unit(const std::vector<T>&val){printf("vec(%d) {",(int)val.size());for(int i=0;i<(int)val.size();++i){fputc(\' \',stdout);print_unit(val[i]);}printf(" }");}\n#define _print0()\n#define _print1(e)print_unit(e)\n#define _print2(e1,e2)_print1(e1),fputc(\' \',stdout),_print1(e2)\n#define _print3(e1,e2,e3)_print2(e1,e2),fputc(\' \',stdout),_print1(e3)\n#define _print4(e1,e2,e3,e4)_print2(e1,e2),fputc(\' \',stdout),_print2(e3,e4)\n#define _print5(e1,e2,e3,e4,e5)_print3(e1,e2,e3),fputc(\' \',stdout),_print2(e4,e5)\n#define _print6(e1,e2,e3,e4,e5,e6)_print3(e1,e2,e3),fputc(\' \',stdout),_print3(e4,e5,e6)\n#define _print7(e1,e2,e3,e4,e5,e6,e7)_print4(e1,e2,e3,e4),fputc(\' \',stdout),_print3(e5,e6,e7)\n#define _print8(e1,e2,e3,e4,e5,e6,e7,e8)_print4(e1,e2,e3,e4),fputc(\' \',stdout),_print4(e5,e6,e7,e8)\n#define _print9(e1,e2,e3,e4,e5,e6,e7,e8,e9)_print5(e1,e2,e3,e4,e5),fputc(\' \',stdout),_print4(e6,e7,e8,e9)\n#define _print10(e1,e2,e3,e4,e5,e6,e7,e8,e9,e10)_print5(e1,e2,e3,e4,e5),fputc(\' \',stdout),_print5(e6,e7,e8,e9,e10)\n#define _GET_PRINT_MACRO_NAME(_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,NAME,...)NAME\n#define print(...)_GET_PRINT_MACRO_NAME(__VA_ARGS__,_print10,_print9,_print8,_print7,_print6,_print5,_print4,_print3,_print2,_print1,_print0)(__VA_ARGS__),fputc(\'\\n\',stdout)\n#define print0(...)_GET_PRINT_MACRO_NAME(__VA_ARGS__,_print10,_print9,_print8,_print7,_print6,_print5,_print4,_print3,_print2,_print1,_print0)(__VA_ARGS__)\n\n// generated code (by mmlang) :\n\nint func(int x);\n\nint S;\n\nint func$origin(int x) {\n int ret;\n if(x < 3) {\n return 0;\n }\n ret = 1;\n for(int $e=x - 3 + 1, $1=3; $1<$e; ++$1) ret = mod((ret) + (func(x - ($1))), 1e9 + 7);\n return ret;\n}\nvector<int> func$memo;\nint func(int x) {\n if(func$memo.empty()) {\n func$memo.resize(2005, (unsigned int)-1 >> 1);\n }\n auto & ref = func$memo[x];\n if(ref == (unsigned int)-1 >> 1) {\n ref = func$origin(x);\n }\n return ref;\n}\n\nint main() {\n S = inputInt();\n print(func(S));\n return 0;\n}\n', 'S = int(input())\n\ndef memo(func):\n D = {}\n def ret(*args):\n if args not in D:\n D[args] = func(*args)\n return D[args]\n return ret\n\n@memo\ndef func(x):\n if x<3:\n return 0\n ret = 1\n for i in range(3, x-3+1):\n ret = (ret + func(i)) % 1000000007\n return ret\n\nprint(func(S))\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])%mod\nprint(dp[s])'] | ['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) * math.factorial(r))\n\nN = int(input())\n\nif N < 3:\n print(0)\nelif N == 3:\n print(1)\nelse:\n ans = 0\n num_digit = N // 3 \n for i in range(num_digit): \n combi = combinations_count((N - (3 * (i+1)) + i), i) \n ans += combi\n if ans >= mod:\n print(int(ans % mod))\n else:\n print(ans)'] | ['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.append(x)\nprint(dp[-1]', 'S = int(input())\nif S < 3:\n print(0)\nelse:\n MODULO = int(1e9+7)\n dp = [0,0,0,1]\n for i in range(4,S+1):\n x = dp[i-3] + dp[i-1]\n x %= MODULO\n dp.append(x)\n print(dp[-1])'] | ['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())\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 if amari != 0:\n count += comb(amari + i, i, exact=True)\n count %= 1000000007\nprint(count)'] | ['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,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<7:print(n//3);quit()\nM=10**9+7\nln,hn,dp=n-6,n-5,2\ns=n-4\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)'] | ['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)', '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,i-2):\n dp[i]+=dp[j]\n dp[i]%=MOD\nprint(dp[S])'] | ['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(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)\nprint(ans)'] | ['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 range(2,maxi):\n self.fac[i] = self.fac[i - 1]*i%mod\n self.inv[i] = mod - self.inv[mod%i]*(mod//i)%mod\n self.finv[i] = self.finv[i-1]*self.inv[i]%mod\n\n\n def com(self,n:int, k:int)->int:\n #return nCk\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return self.fac[n]*(self.finv[k]*self.finv[n-k]%self.mod)%self.mod\n\n\n def main():\n s = int(input())\n m = Mod(s,10**9 + 7)\n ans = 0\n for n in range(1,s // 3 + 1):\n if 3*n == s:\n ans = (ans+1)%(10**9 + 7)\n break\n ans = (ans + m.com(-2*n + s - 1,s - 3*n))%(10**9 + 7)\n print(ans)\n return\n\n if __name__ == "__main__":\n main()', 'from math import log10\n\nclass 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 range(2,maxi):\n self.fac[i] = self.fac[i - 1]*i%mod\n self.inv[i] = mod - self.inv[mod%i]*(mod//i)%mod\n self.finv[i] = self.finv[i-1]*self.inv[i]%mod\n\n\n def com(self,n:int, k:int)->int:\n #return nCk\n if n < k:\n return 0\n if n < 0 or k < 0:\n return 0\n return self.fac[n]*(self.finv[k]*self.finv[n-k]%self.mod)%self.mod\n\n\ndef main():\n s = int(input())\n m = Mod(s,10**9 + 7)\n ans = 0\n for n in range(1,s // 3 + 1):\n if 3*n == s:\n ans = (ans+1)%(10**9 + 7)\n break\n ans = (ans + m.com(-2*n + s - 1,s - 3*n))%(10**9 + 7)\n print(ans)\n return\n\nif __name__ == "__main__":\n main()'] | ['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:\n print(A[S])\n exit()\n\nfor i in range(3,S+1):\n for j in range(i-2):\n A[i] += A[j]\n A[i]%=MOD\nprint(A[S])'] | ['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 FactorialModInv(self, p):\n if p <= 1:\n return 1\n return modinv_table[p] * self.FactorialModInv(p - 1)\n def Solve(self, n):\n ans = 0\n #Fill in the modinv_table\n for p in range(2, n + 1):\n modinv_table[p] = (-modinv_table[mod % p] * (mod // p)) % mod\n # print(modinv_table)\n for item in range(1, max_items + 1):\n print("----------------------------------")\n print("item", item)\n max_value = S - 3 * item\n print("max_value", max_value)\n add = self.CalculateAddition(max_value, item)\n print("add", add)\n ans += add\n ans %= mod\n return ans\n def CalculateAddition(self, max_value, item):\n if max_value == 0:\n return 1\n add = 1\n add = add * self.FactorialMod(max_value + item - 1) % mod\n add = add * self.FactorialModInv(max_value) % mod\n add = add * self.FactorialModInv(item - 1) % mod\n return add\n\nS = int(input())\nif S <= 2:\n print(0)\n exit()\n\nmax_items = S // 3\n# print("max_items", max_items)\nmodinv_table = [-1] * (S + 1)\nmodinv_table[1] = 1\n\nsol = Solution()\nprint(sol.Solve(S))\n', 'S = int(input())\nmod = 10 ** 9 + 7\n\nif S <= 2:\n print(0)\n exit()\n\nans = 0\nmax_items = S // 3\n\n# print("max_items", max_items)\n\nfor item in range(1, max_items + 1):\n # print("---------------------------")\n # print("item", item)\n n = S - 3 * item\n # print("n", n)\n if n == 0:\n ans += 1\n break\n\n modinv_table = [-1] * (n + 1)\n modinv_table[1] = 1\n for i in range(2, n + 1):\n modinv_table[i] = (-modinv_table[mod % i] * (mod // i)) % mod\n\n add = 1\n for p in range(n):\n add *= (n + item - 1) - p\n add *= modinv_table[p + 1]\n add %= mod\n\n\n # print("add", add)\n\n\n ans += add\n ans %= mod\n\n\n\nprint(ans)\n'] | ['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 ', 'import math\nN = input()\nN = int(N)\nx = N // 3\nx = int(x)\np = 10 ** 9 + 7\nsum = 0\nif x == 0:\n print(0)\nelse:\n for k in range(x):\n y = N - 3*k - 3\n l = k \n M = y + l\n a = math.factorial(l)\n b = math.factorial(M) \n c = math.factorial(y)\n d = a * c\n z = b // d\n z = z % p\n sum += z\n sum = sum %p\n\n sum = int(sum)\n print(sum)\n\n \n\n '] | ['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 i in range(S+1):\n for j in range(3, i):\n dp[i] += dp[i-j]\n print(i,dp[0:S+1])\n\n"""\n\nfor i in range(3,S+1):\n for l in range(i+1-3):\n dp[i] += dp[l]\n\n print(i,dp[0:i+1])\n\n \n\nprint(dp[S] % MOD)\n\n', '\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 i in range(S+1):\n for j in range(3, i):\n dp[i] += dp[i-j]\n print(i,dp[0:S+1])\n\n"""\n\nfor i in range(3,S+1):\n for l in range(i+1-3):\n dp[i] += dp[l]\n\n #print(i,dp[0:i+1])\n\n \n\nprint(dp[S] % MOD)\n\n'] | ['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 %= mod\n return cmb\n\ntotal = 0\nfor k in range(1, n+1):\n if n < 3*k:\n break\n total += C(n-2*k-1, k-1)\n total %= mod\n\nprint(total)', '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+2):\n inv[-j] = inv[-j+1] * (n-j+2)\n inv[-j] %= mod\n\ndef C(n, k):\n cmb = per[n] * inv[k] * inv[n-k]\n cmb %= mod\n return cmb\n\ntotal = 0\nfor k in range(1, n+1):\n if n < 3*k:\n break\n total += C(n-2*k-1, k-1)\n total %= mod\n\nprint(total)\n'] | ['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())))\na=list(set(a))\nans=0\nfor i in range(len(a)):\n for j in range(i+1,len(a)):\n ans=max(ans,abs(a[i][0]-a[j][0])+abs(a[j][1],a[i][1]))\n\nprint(ans)', '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[3:i-2])+1)%(x)\n\nprint(a[s])\n ', 's=int(input())\na=[0]*2001\nx=(10**9)+7\nif s<3:\n print(0)\n exit()\n\n \nelse:\n\n for i in range(3,6):\n a[i]=1\n\n for i in range(6,2001):\n a[i]=(sum(a[3:i-2])+1)%(x)\n\nprint(a[s])\n \n\n\n\n'] | ['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 = 10**9+7\n dp = [0] * (s+1)\n dp[0] = 1\n x = 0\n for i in range(1, s+1):\n if i-3 >= 0:\n x += dp[i-3]\n x %= mod\n dp[i] = x\n print(dp[s])\n\nif __name__ == "__main__":\n main()\n'] | ['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 \nprint(ans)\n'] | ['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[j]\n dp[i] %= mod\n\nprint(dp[-1] % mod)'] | ['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[i] += dp[j]\n dp[i] %= MOD\n\nprint(dp[s])'] | ['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(input())\ncnt = 0\nans = 1\n\nif s <= 2:\n print(0)\nelse :\n s = s-3\n while s >= 3:\n s -= 3\n cnt += 1\n if s > 0:\n ans += comb(s+cnt, cnt, exact=True)\n ans %= MOD\n else :\n ans += 1\n ans %= MOD\n print(ans)\n'] | ['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 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\n'] | ['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 = 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\nres = 0\n\nfor l in range(1,L+1):\n s = S - l*3\n a = cmb(s+l-1, l-1)\n res += a\n\nprint(int(res%mod))'] | ['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):\n dp[i + 3] = (dp[i] + dp[i + 2]) % mod\n \nprint(dp[-1])', 'import math\n\ndef combinations_count(n, r):\n return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))\n\nS = int(input())\nans = 0\nmod = 10 ** 9 + 7\nfor i in range(1,S // 3 + 1): \n \n x = S - 3 * i \n \n ans += (combinations_count(x + i - 1, i - 1)) % mod\u3000\n ans %= mod\n\nprint(ans)\n', 'S = int(input())\nif S == 1 or S == 2:\n print(0)\n\nelif S == 3:\n print(1)\n\nelse:\n mod = 10 ** 9 + 7\n dp = [0 for _ in range(S)]\n dp[0] = dp[1] = 0\n dp[2] = dp[3] = 1\n\n for i in range(3, S):\n dp[i] = (dp[i - 3] + dp[i - 1]) % mod\n\n print(dp[-1])'] | ['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 += 1\nprint(ans)\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\n memo[s] = tmp\n return tmp%mod\nprint(redis(S))\n \n\n', '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-2):\n tmp += redis(num)%mod\n memo[s] = tmp\n return tmp%mod\nprint(redis(S))\n \n\n', 'S = int(input())\nmemo = [-1]*(S+1)\nredis(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)\n memo[s] = tmp\n return tmp\nprint(redis(S))\n ', 'S = int(input())\nmod = 10**9+7\nmemo = [-1]*(S+1)\nmemo[0] = 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-2):\n tmp += redis(num)%mod\n memo[s] = tmp\n return tmp%mod\nprint(redis(S))\n \n\n\n'] | ['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([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)'] | ['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 \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(s_ + i) // (factorial(s_) * factorial(i)) % (10**9 + 7)\n\nprint(ans % (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)\n \nprint(ans % (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)\n ans += ans_\nprint(ans)', 's = int(input())\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 pivot > 1:\n offset = (n - r) % p\n for k in range(p-1,r,p):\n numerator[k - offset] /= pivot\n denominator[k] /= pivot\n\n result = 1\n for k in range(r):\n if numerator[k] > 1:\n result *= int(numerator[k])\n\n return result\n\nans = 0\nfor i in range(x):\n Box = i + 1\n Nokori = s - 3 * Box\n ans_ = cmb(Nokori + Box - 1, Box - 1) \n ans += ans_\nprint(ans % (10 ** 9 + 7))', 's = int(input())\n\nfrom scipy.special import comb\n\nans = 0\nfor i in range(x):\n Box = i + 1\n Nokori = s - 3 * Box\n ans_ = comb(Nokori + Box - 1, Nokori, exact=True) % (10 ** 9 + 7)\n ans += ans_\n \nprint(ans % (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 ans_ = factorial(ball + box - 1) // (factorial(ball) * factorial(box - 1))\n ans += ans_\nprint(ans % (10 ** 9 + 7))'] | ['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]%=INF\n\nprint(dp[-1])'] | ['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[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[i] += dp[j]\n dp[i] %= mod\n\nprint(dp[S])\n'] | ['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[rest] * invf[n - 1]) % mod\nprint(count)', 's = int(input())\nmod = 10 ** 9 + 7\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] = -(mod // i) * inv[mod % i] % mod\n invf[i] = invf[i-1] * inv[i] % mod\n\ncount = 0\nrest = s\nfor n in range(1, s // 3 + 1):\n rest -= 3\n count = (count + fact[rest + n - 1] * invf[rest] * invf[n - 1]) % mod\nprint(count)'] | ['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 \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%(10**9+7))'] | ['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:\n print(a[N])\nelse:\n while len(a)<=N:\n a.append(1+s-a[-1]-a[-2])\n s += a[-1]\n p = 10**9+7\n print(a[-1]%p)\n '] | ['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 range(shou):\n\n ans = (ans + combinations_count((amari + shou - 1), amari)) % (10**9 + 7)\n amari += 3\n shou -= 1\n print(ans)\nprint(ans)\n', '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 range(shou):\n amari += 3\n shou -= 1\n ans = (ans + combinations_count((amari + shou - 1), amari)) % (10**9 + 7)\nprint(ans)\n', '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 range(shou):\n\n ans = (ans + combinations_count((amari + shou - 1), amari)) % (10**9 + 7)\n amari += 3\n shou -= 1\nprint(ans)\n'] | ['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():return input()\n\ntarget = readInt()\nnums = [i for i in range(3,target+1)]\n\ndp = [0] * (1+target)\nfor num in nums:\n if num <= target:\n dp[num] = 1\nfor i in range(target+1):\n for num in nums:\n if i - num > 0:\n dp[i] += dp[i-num]\nprint(dp[-1]%mod', '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():return input()\n\ntarget = readInt()\nnums = [i for i in range(3,target+1)]\n\ndp = [0] * (1+target)\nfor num in nums:\n if num <= target:\n dp[num] = 1\nfor i in range(target+1):\n for num in nums:\n if i - num > 0:\n dp[i] += dp[i-num]\nprint(dp[-1]%mod)'] | ['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(denominator, Q-2, Q)%Q\n\n\ndef main():\n\tS=int(input())\n\tans=0\n\tfor i in range(1,S//3+1):\n\t\tt=S-i*3\n\t\tans+=cmb(t+i-1,i-1)\n\t\tans%=MOD\n\tprint(ans)\n\nif __name__=="__main__":\n\tmain()', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tpossibles+=f(S-2*i-1)/f(S-3*i)/f(i-1)\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1); \n\n\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=(f(left+i-1)/f(i-1)/f(left))\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=(f(left+i-1)/(f(i-1)*f(left)))\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tpossibles=f(S-2*i-1)/f(S-3*i)/f(i-1)\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=1\nbiggest_sub=S//3\nfor i in range(2,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=(f(left+i-1)/f(i-1)/f(left))\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\nimport math\n\ndef nCr(n,r):\n f = math.factorial\n return f(n) / f(r) / f(n-r)\n\npossibles=1\nbiggest_sub=S//3\nfor i in range(2,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=nCr(left+i-1,i-1)\nprint(possibles)', 'S=int(input())\n\ndef f(n):\n\tfact = 1\n \n\tfor i in range(1,n+1): \n\t fact = fact * i\n\t return fact\n\ndef nCr(n,r):\n \n return f(n) / f(r) / f(n-r)\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=nCr(left+i-1,i-1)\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tpossibles=f(biggest_sub-3*i)/f(r)/f(biggest_sub-4*r)\nn=10**9+7\nprint(possibles%n)', 'S=1729\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * f(n - 1);\n\npossibles=0\n\nn=10**9+7\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tpossibles+=f(S-3*i+i-1)/f(i-1)/f(S-3*i)\n\tpossibles%=n\n\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n): \n \n # single line to find factorial \n return 1 if (n==1 or n==0) else n * factorial(n - 1);\n\npossibles=0\n\nn=10**9+7\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tpossibles+=f(S-3*i+i-1)/f(i-1)/f(S-3*i)\n\tpossibles%=n\n\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\n\ndef f(n):\n\tfact = 1\n \n\tfor i in range(1,n+1): \n\t fact = fact * i\n\treturn fact\n\ndef nCr(n,r):\n \n return f(n) / f(r) / f(n-r)\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=nCr(left+i-1,i-1)\nn=10**9+7\nprint(possibles%n)', 'S=int(input())\nimport math\n\ndef nCr(n,r):\n f = math.factorial\n return f(n) / f(r) / f(n-r)\n\npossibles=1\nbiggest_sub=S//3\nfor i in range(2,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=nCr(left+i-1,i-1)\nn=10**9+7\nprint(possibles%n)', '\n \n \nconst int mod = 1e9+7;\nint fact[2020];\n \nint power(int a, int b){\n int ans = 1;\n while(b){\n if (b&1){\n ans = (ans*a)%mod;\n }\n a = (a*a)%mod;\n b>>=1;\n }\n return ans;\n}\n \nint inv(int a){\n return power(a, mod-2);\n}\n \nint ncr(int n, int r){\n int denom = fact[r] * fact[n-r] %mod;\n denom = inv(denom);\n return (fact[n]*denom)%mod;\n}\n \n \nsigned main(){\n ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);\n \n int n;\n cin>>n;\n \n if(n==3){\n cout<<1<<endl;\n return 0;\n }\n \n fact[0] = 1;\n for (int i=1; i<=n; i++){\n fact[i] = (i*fact[i-1])%mod;\n }\n \n //n-1cr-1\n //n-1-2*icri-1\n \n int ans = 0;\n for (int i=1; (n-1-2*i)>0; i++){\n if (n-1-2*i<i-1) break;\n ans = (ans + ncr(n-1-2*i, i-1))%mod;\n }\n cout<<ans<<endl;\n \n \n \n return 0;\n}', 'S=int(input())\nimport math\n\ndef nCr(n,r):\n f = math.factorial\n return f(n) / f(r) / f(n-r)\n\npossibles=0\nbiggest_sub=S//3\nfor i in range(1,biggest_sub+1):\n\tleft=S-3*i\n\tpossibles+=nCr(left+i-1,i-1)\nn=10**9+7\nprint(possibles%n)', "#import sys\n#input = sys.stdin.readline\nQ = 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(denominator, Q-2, Q)%Q\n \ndef main():\n S = int( input())\n ans = 0\n for i in range(1, S//3+1):\n t = S - i*3\n ans += cmb(t+i-1,i-1)\n ans %= Q\n print(ans)\n \nif __name__ == '__main__':\n main()"] | ['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 factorial\nans = 0\n\n\nm = S // 3 \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\n\n\nfor p in range(1,m+1):\n x = S - 3*(p) \n """\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 ans += cmb(x+p-1,p-1)\n\n\nprint(int((ans)%(10**9+7)))\n\n\n'] | ['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\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-1])', '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])', 's = int(input())\nmod = 10**9+7\nimport numpy as np\n\nif s == 1 or s == 2:\n print(0)\nelif s == 3:\n print(1)\nelse:\n array = np.zeros(s)\n array[2] = 1\n for i in range(3, s):\n array[i] = np.sum(array[:i-3]) % mod\n print(array[s-1])', 's = int(input())\nmod = 10**9+7\nimport numpy as np\n\nif s == 1 or s == 2:\n print(0)\nelif s == 3:\n print(1)\nelse:\n array = np.zeros(s+1)\n array[0] = 1\n for i in range(3, s+1):\n array[i] = np.sum(array[:i-2]) % mod\n print(array[s])\n', 's = int(input())\nmod = 10**9+7\nimport numpy as np\n\nif s == 1 or s == 2:\n print(0)\nelif s == 3:\n print(1)\nelse:\n array = np.zeros(s)\n array[0] = 1\n array[2] = 1\n for i in range(4, s):\n array[i] = (array[i-1] + array[i-3]) % mod\n print(array[s-1])', '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\tarray = np.zeros(s)\n\tarray[2] = 1\n\tarray[3] = 1\n for i in range(4, s):\n array[i] = (array[i-1] + array[i-3]) % mod\n\tprint(array[s])', 's = int(input())\nmod = 10**9+7\nimport numpy as np\n\nif s == 1 or s == 2:\n print(0)\nelif s == 3:\n print(1)\nelse:\n array = np.zeros(s+1)\n array[0] = 1\n for i in range(3, s+1):\n array[i] = np.sum(array[:i-2]) % mod\n print(int(array[s]))\n'] | ['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] * (MOD // i)) % MOD)\n factinv.append((factinv[-1] * inv[-1]) % MOD)\n\nans = 0\nfor i in range(1, s // 3 + 1):\n rest = s - 3 * i\n ans += cmb(rest + i - 1, rest, MOD)\n\nprint(ans % MOD)', '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] * (MOD // i)) % MOD)\n factinv.append((factinv[-1] * inv[-1]) % MOD)\n\ns = int(input())\n\nans = 0\nfor i in range(1, s // 3 + 1):\n rest = s - 3 * i\n ans += cmb(rest + i - 1, rest, MOD)\n\nprint(ans % MOD)'] | ['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 range(6,2001):\n l[i]+=s\n l[i]%=p\n s+=l[i-2]\nprint(l[n])'] | ['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] * (DIV // i)) % DIV\n g2[i] = (g2[i - 1] * inverse[i]) % DIV\n\ndef nCr(n, r, DIV):\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] % DIV\n\nans = 0\nfor i in range(N, 0, -1):\n rest = S - 3 * i\n if rest <= 0:\n ans += 1\n continue\n \n \n ans += nCr(rest + i - 1, rest, DIV)\n ans %= DIV\n \nprint(ans)\n', 'import sys\nreadline=sys.stdin.readline\n\nS = int(readline())\n\n\n\n\nN = S // 3\n\nDIV = 10 ** 9 + 7\n\nfrom functools import reduce\ndef nCr(n,r,DIV):\n if r < n - r:\n r = n - r\n if r == 0:\n return 1\n f = lambda x,y:x*y%DIV\n X = reduce(f,range(n-r+1, n+1))\n Y = reduce(f,range(1, r+1))\n return X * pow(Y, DIV - 2, DIV) % DIV\n\nans = 0\nfor i in range(N, 0, -1):\n rest = S - 3 * i\n if rest <= 0:\n ans += 1\n continue\n \n \n ans += nCr(rest + i - 1, rest, DIV)\n ans %= DIV\n \nprint(ans)\n'] | ['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\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 exit()\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)'] | ['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 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 ,exact=True)\n total = total% (10**9+7)\n else:\n break\n\n print(int(total ))\n'] | ['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])%Mod\n print(DP[S])\nelse:\n print(0)'] | ['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):\n sum_ += arr[i-1,j]\n sum_ %= MOD\n if j+3 >= N + 1:\n break\n arr[i,j+3] = sum_\n\ndump(arr)\n\nans = 0\nfor i in range(N+1):\n ans += arr[i,N]\n ans %= MOD\nprint(ans)\n\n\n\n\n\n\n\n\n'] | ['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 exit()\n\npk_num = s//3-1\nans = 1\nfor i in range(pk_num):\n pk = (i+2)*3\n g = s - pk\n b = i+2\n ans += cmb(g+b-1,b-1)\n ans %= mod\nprint(ans)'] | ['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=[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]%=mod\nprint(dp[s])\n\n'] | ['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_i-y_j|. | ['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().strip()\nrl = lambda : list(map(int, input().split()))\n\nn = ri()\na = []\nb = []\nfor i in range(n):\n x,y = rl()\n a.append(x+y)\n b.append(x-y)\na.sort()\nb.sort()\nprint(max(a[-1]-a[0], b[-1]-[0]))', '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().strip()\nrl = lambda : list(map(int, input().split()))\n\nn = ri()\na = []\nb = []\nfor i in range(n):\n x,y = rl()\n a.append(x+y)\n b.append(x-y)\na.sort()\nb.sort()\nprint(max(a[-1]-a[0], b[-1]-b[0]))'] | ['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_i-y_j|. | ['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(y))\n min_x=max(max_v,abs(x)+abs(y))\n\nprint(max_v-min_v)', '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=set(tuple([lnii() for i in range(n)]))\n\nif len(l)==1:\n print(0)\n exit()\n\nx_max=0\nx_min=10**10\ny_max=0\ny_min=10**10\nfor x,y in l:\n# s=abs(x-y)\n s=x-y\n x_max=max(x_max,s)\n x_min=min(x_min,s)\n\n# t=abs(x+y)\n t=x+y\n y_max=max(y_max,t)\n y_mim=min(y_min,t)\n\n\nx_max=abs(x_max)\nx_min=abs(x_min)\ny_max=abs(y_max)\ny_min=abs(y_min)\nprint(x_max,x_min,y_max,y_min)\n\n\nprint(max(x_max-x_min,x_max-y_min,y_max-y_min,y_max-x_min))', '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=set(tuple([lnii() for i in range(n)]))\n\nif len(l)==1:\n print(0)\n exit()\n\nx_max=0\nx_min=10**10\ny_max=0\ny_min=10**10\n\nans=0\nfor x,y in l:\n# s=abs(x-y)\n s=x-y\n x_max=max(x_max,s)\n x_min=min(x_min,s)\n\n# t=abs(x+y)\n t=x+y\n y_max=max(y_max,t)\n y_mim=min(y_min,t)\n\n\n ans=max(s,y)\nprint(ans)', 'from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:list(map(int,stdin.readline().split()))\n\nn=int(input())\n\nl=lnii()\n\nif len(l)==1:\n print(0)\n exit()\n\nx_max=0\nx_min=10**10\ny_max=0\ny_min=10**10\n\nfor x,y in l:\n s=x-y\n x_max=max(x_max,s)\n x_min=min(x_min,s)\n\n t=x+y\n y_max=max(y_max,t)\n y_min=min(y_min,t)\n\nx_ans=x_max-x_min\ny_ans=y_max-y_min\nprint(max(x_ans,y_ans))', 'from sys import stdin\nnii=lambda:map(int,stdin.readline().split())\nlnii=lambda:list(map(int,stdin.readline().split()))\n\nn=int(input())\n\nz=[]\nw=[]\nfor i in range(n):\n x,y=nii()\n z.append(x-y)\n w.append(x+y)\n\nz_ans=max(z)-min(z)\nw_ans=max(w)-min(w)\nprint(max(z_ans,w_ans))'] | ['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_i-y_j|. | ['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)', 'n = 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)\nd1_max = x[0]+y[0]\nd1_min = x[0]+y[0]\nd2_max = x[0] - y[0]\nd2_min = x[0]-y[0]\nans = -1\nfor i in range(1,n):\n d1_max = max(d1_max,x[i]+y[i])\n d1_min = min(d1_min,x[i]+y[i])\n d2_max = max(d2_max,x[i] - y[i])\n d2_min = min(d2_min,x[i]-y[i])\n ans = max((d1_max-d1_min),(d2_max-d2_min))\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_i-y_j|. | ['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 for a,b in l]\np.sort()\nq.sort()\nprint(max(p[-1]-p[0],q[-1]-q[0]))\n'] | ['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_i-y_j|. | ["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 for _ in range(n-1):\n x, y = MI()\n if x+y > x1+y1:\n x1 = x\n y1 = y\n if -x+y > -x2+y2:\n x2 = x\n y2 = y\n if -x-y > -x3-y3:\n x3 = x\n y3 = y\n if x-y > x4-y4:\n x4 = x\n y4 = y\n temp = [abs(x1-x2)+abs(y1-y2), abs(x1-x3)+abs(y1-y3), abs(x1-x4)+abs(y1-y4), abs(x2-x3)+abs(y2-y3), abs(x2-x4)+abs(y2-y4), abs(x3-x4)+abs(y3-y4)]\n ans = max(temp)\n print(ans)\n\nif __name__ == '__main__':\n main()", "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 for _ in range(n-1):\n x, y = MI()\n if x+y > x1+y1:\n x1 = x\n y1 = y\n if -x+y > -x2+y2:\n x2 = x\n y2 = y\n if -x-y > -x3-y3:\n x3 = x\n y3 = y\n if x-y > x4-y4:\n x4 = x\n y4 = y\n temp = [abs(x1-x2)+abs(y1-y2), abs(x1-x3)+abs(y1-y3), abs(x1-x4)+abs(y1-y4), abs(x2-x3)+abs(y2-y3), abs(x2-x4)+abs(y2-y4), abs(x3-x4)+abs(y3-y4)]\n ans = max(temp)\n print(ans)\n\nif __name__ == '__main__':\n main()"] | ['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_i-y_j|. | ['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 = []\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]]))'] | ['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_i-y_j|. | ['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(a1 - a2, b1 - b2))\n\nmain()\n', '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(b1, y - x)\n N = N - 1\n print(max(a1 - a2, b1 - b2))\n\nmain()\n', '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(min(a1 - a2, b1 - b2))\n\nmain()\n', 'def main():\n N = int(input())\n x, y = map(int, input().split())\n a1 = x + y\n a2 = x + y\n b1 = y - x\n b2 = y - x\n N -= 1\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(a1 - a2, b1 - b2))\n\nmain()\n'] | ['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] |