s_id
stringlengths
10
10
p_id
stringlengths
6
6
u_id
stringlengths
10
10
date
stringlengths
10
10
language
stringclasses
1 value
original_language
stringclasses
11 values
filename_ext
stringclasses
1 value
status
stringclasses
1 value
cpu_time
stringlengths
1
5
memory
stringlengths
1
7
code_size
stringlengths
1
6
code
stringlengths
1
539k
s205122226
p02555
u849559474
1600369886
Python
Python (3.8.2)
py
Runtime Error
344
27732
263
s = int(input()) mod = 10**9+7 import numpy as np if s == 1 or s == 2: print(0) elif s == 3 or s == 4: print(1) else: array = np.zeros(s) array[2] = 1 array[3] = 1 for i in range(4, s): array[i] = (array[i-1] + array[i-3]) % mod print(array[s])
s012568308
p02555
u849559474
1600369775
Python
Python (3.8.2)
py
Runtime Error
117
27020
264
s = int(input()) mod = 10**9+7 import numpy as np if s == 1 or s == 2: print(0) elif s == 3 or s == 4: print(1) else: array = np.zeros(s) array[2] = 1 array[3] = 1 for i in range(4, s): array[i] = (array[i-1] + array[i-3]) % mod print(array[s])
s630051120
p02555
u849559474
1600369679
Python
Python (3.8.2)
py
Runtime Error
24
9004
263
s = int(input()) mod = 10**9+7 import numpy as np if s == 1 or s == 2: print(0) elif s == 3 or s == 4: print(1) else: array = np.zeros(s) array[2] = 1 array[3] = 1 for i in range(4, s): array[i] = (array[i-1] + array[i-3]) % mod print(array[s])
s860167706
p02555
u364693468
1600356761
Python
PyPy3 (7.3.0)
py
Runtime Error
140
78640
988
import bisect, collections, copy, heapq, itertools, math, string import sys def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int, sys.stdin.readline().rstrip().split()) def LI(): return list(map(int, sys.stdin.readline().rstrip().split())) def S(): return sys.stdin.readline().rstrip() def LS(): r...
s389321059
p02555
u182166469
1600349922
Python
Python (3.8.2)
py
Runtime Error
83
9168
304
import math def combination(n,r): return math.factorial(n+r) / (math.factorial(n)*math.factorial(r)) s=int(input()) if s==0 or s==1 or s==2: print(0) else: p=int(s/3) sum=0 for i in range(p): distribute=s-3*(i+1) sum+=combination(distribute,i) sum=int(sum)%(10**9+7) print(sum)
s939011005
p02555
u182166469
1600349666
Python
Python (3.8.2)
py
Runtime Error
85
9168
264
import math s=int(input()) if s==0 or s==1 or s==2: print(0) else: p=int(s/3) sum=0 for i in range(p): distribute=s-3*(i+1) sum+=math.factorial(distribute+i) / (math.factorial(distribute)*math.factorial(i)) sum=int(sum)%(10**9+7) print(sum)
s042862031
p02555
u182166469
1600349396
Python
Python (3.8.2)
py
Runtime Error
84
9148
252
import math s=int(input()) if s==0 or s==1 or s==2: print(0) else: p=int(s/3) sum=0 for i in range(p): distribute=s-3*(i+1) sum+=math.factorial(distribute+i) / (math.factorial(distribute)*math.factorial(i)) print(int(sum)%(10**9+7))
s688813833
p02555
u182166469
1600349329
Python
Python (3.8.2)
py
Runtime Error
81
8972
242
import math s=int(input()) if s==0 or s==1 or s==2: print(0) else: p=int(s/3) sum=0 for i in range(p): distribute=s-3*(i+1) sum+=math.factorial(distribute+i) / (math.factorial(distribute)*math.factorial(i)) print(int(sum))
s018669169
p02555
u536230475
1600344177
Python
PyPy3 (7.3.0)
py
Runtime Error
97
77616
465
import os import sys import math import heapq from decimal import * from io import BytesIO, IOBase from collections import defaultdict, deque def r(): return int(input()) def rm(): return map(int,input().split()) def rl(): return list(map(int,input().split())) '''D Redistribution''' mod=10**9+7 n = r() an...
s120119415
p02555
u663404111
1600296077
Python
Python (3.8.2)
py
Runtime Error
60
9144
300
S = int(input()) N = S//3 ans = 0 if N == 0: ans = 0 else: for l in range(N): n = S - 2*l - 3 p = 1 if l == 0: ans += 1 else: for i in range(l): p *= (n - i) / (i + 1) ans += p % 10**9 + 7 ans %= 10**9 + 7 print(int(ans))
s017005119
p02555
u663404111
1600295929
Python
Python (3.8.2)
py
Runtime Error
26
9024
290
S = int(input()) N = S//3 ans = 0 if N == 0: continue else: for l in range(N): n = S - 2*l - 3 p = 1 if l == 0: ans += 1 else: for i in range(l): p *= (n - i) / i % (10**9 + 7) ans += p ans %= 10**9+7 print(ans)
s975859870
p02555
u663404111
1600295861
Python
Python (3.8.2)
py
Runtime Error
26
9004
282
S = int(input()) N = S//3 if N == 0: print(0) else: for l in range(N): n = S - 2*l - 3 p = 1 if l == 0: ans = 1 else: for i in range(l): p *= (n - i) / i % (10**9 + 7) ans += p ans %= 10**9+7 print(ans)
s644574253
p02555
u536034761
1600274905
Python
Python (3.8.2)
py
Runtime Error
28
9084
181
S = int(input()) mod = 10 ** 9 + 7 dp = [0 for _ in range(S)] dp[0] = dp[1] = 0 dp[2] = dp[3] = 1 for i in range(3, S): dp[i] = (dp[i - 3] + dp[i - 1]) % mod print(dp[-1])
s614775522
p02555
u536034761
1600274752
Python
Python (3.8.2)
py
Runtime Error
31
9076
182
S = int(input()) mod = 10 ** 9 + 7 dp = [0 for _ in range(S)] dp[0] = dp[1] = 0 dp[2] = dp[3] = 0 for i in range(S - 3): dp[i + 3] = (dp[i] + dp[i + 2]) % mod print(dp[-1])
s451724030
p02555
u536034761
1600273882
Python
Python (3.8.2)
py
Runtime Error
32
9920
233
from functools import lru_cache @lru_cache(maxsize=None) def dp(i): if i == 1 or i == 2: return 0 elif i == 3 or i == 4: return 1 else: return dp(i - 3) + dp(i - 1) S = int(input()) print(dp(S))
s022302678
p02555
u536034761
1600273761
Python
Python (3.8.2)
py
Runtime Error
31
9116
176
def dp(i): if i == 1 or i == 2: return 0 elif i == 3 or i == 4: return 1 else: return dp[i - 3] + dp[i - 1] S = int(input()) print(dp(S))
s956903166
p02555
u536034761
1600271189
Python
Python (3.8.2)
py
Runtime Error
24
8968
450
import math #n個からr個とるときの組み合わせの数 def combinations_count(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) S = int(input()) ans = 0 mod = 10 ** 9 + 7 for i in range(1,S // 3 + 1): #長さiの数列のとき x = S - 3 * i #3を分配後の余り ans += (combinations_count(x + i - 1, i - 1))...
s811647091
p02555
u132978996
1600267850
Python
Python (3.8.2)
py
Runtime Error
23
8860
3056
#include <bits/stdc++.h> #define FIXED_FLOAT(x) std::fixed <<std::setprecision(7)<<(x) #define all(v) (v).begin(), (v).end() using namespace std; #define loop(i,a,b) for (int i=a; i<b; ++i) using ll = long long; const int mod = 1e9 + 7; typedef pair<int , int> pairs; typedef complex<ll> G; const int N = 1e3 + 10; ...
s816997456
p02555
u694665829
1600265645
Python
Python (3.8.2)
py
Runtime Error
29
9184
118
s = int(input()) a = [0]*2001 a[3] = 1 for i in range(4,n+1): a[i] = a[i-3] + a[i-1] mod = 10**9+7 print(a[s]%mod)
s993440149
p02555
u785697410
1600265116
Python
PyPy3 (7.3.0)
py
Runtime Error
95
74692
1384
import sys #from collections import deque #from functools import * #from fractions import Fraction as f from copy import * from bisect import * #from heapq import * #from math import ceil #from itertools import permutations ,product def eprint(*args): print(*args, file=sys.stderr) zz=1 #sys.setrecursionlimit(1...
s907798995
p02555
u785697410
1600265076
Python
PyPy3 (7.3.0)
py
Runtime Error
89
74224
1384
import sys #from collections import deque #from functools import * #from fractions import Fraction as f from copy import * from bisect import * #from heapq import * #from math import ceil #from itertools import permutations ,product def eprint(*args): print(*args, file=sys.stderr) zz=1 #sys.setrecursionlimit(1...
s780904303
p02555
u869519920
1600261894
Python
Python (3.8.2)
py
Runtime Error
27
9188
112
S=int(input()) a = [0]*(S+1) a[3]=1 for i in range(4, S+1): a[i] = a[i-3] + a[i-1] mod=10**9+7 print(a[S]%mod)
s870273953
p02555
u237935782
1600251596
Python
Python (3.8.2)
py
Runtime Error
28
9304
169
S = int(input()) A = [0,0,1] if S == 1 or S == 2: print(0) elif S == 3: print(1) else: for i in range(3,S): A += [A[i-1] + A[i-3]] print(A[i] % (10 ** 9 + 7))
s943342807
p02555
u237935782
1600251471
Python
Python (3.8.2)
py
Runtime Error
31
9156
103
S = int(input()) A = [0,0,1] for i in range(3,S): A += [A[i-1] + A[i-3]] print(A[i] % (10 ** 9 + 7))
s596621203
p02555
u237935782
1600251391
Python
Python (3.8.2)
py
Runtime Error
29
9300
101
S = int(input()) A = [0,0,1] for i in range(3,S): A += [A[i-1] + A[i-3]] print(A[i]%(10 ** 9 + 7))
s778819298
p02555
u661764795
1600224148
Python
PyPy3 (7.3.0)
py
Runtime Error
121
74180
191
S = int(input()) if S == 1: print(0) sys.exit() dp = [0] * (S + 1) dp[0] = 1 dp[1] = 0 dp[2] = 0 for i in range(3, S + 1): dp[i] = sum(dp[:i - 2]) print(dp[S] % (10 ** 9 + 7))
s646308185
p02555
u661764795
1600224039
Python
PyPy3 (7.3.0)
py
Runtime Error
126
74272
151
S = int(input()) dp = [0] * (S + 1) dp[0] = 1 dp[1] = 0 dp[2] = 0 for i in range(3, S + 1): dp[i] = sum(dp[:i - 2]) print(dp[S] % (10 ** 9 + 7))
s400220506
p02555
u033602950
1600210088
Python
Python (3.8.2)
py
Runtime Error
116
27172
568
import sys #import time from collections import deque, Counter, defaultdict #from fractions import gcd import bisect import heapq #import math import itertools import numpy as np input = sys.stdin.readline sys.setrecursionlimit(10**8) inf = 10**18 MOD = 1000000007 ri = lambda : int(input()) rs = lambda : input().strip(...
s811366886
p02555
u237935782
1600192467
Python
Python (3.8.2)
py
Runtime Error
27
9160
87
S = int(input()) A = [0,0,1] for i in range(3,S): A += [A[i-1] + A[i-3]] print(A[i])
s964722401
p02555
u237935782
1600191885
Python
Python (3.8.2)
py
Runtime Error
2206
9396
172
S = int(input()) def retu(n): if n == 0 or n == 1 or n == 2: return 0 elif n == 3: return 1 else: a = retu(n-1) + retu(n-3) return a print(retu(S))
s930590541
p02555
u033602950
1600182909
Python
Python (3.8.2)
py
Runtime Error
1398
27348
634
import sys #import time from collections import deque, Counter, defaultdict #from fractions import gcd import bisect import heapq #import math import itertools import numpy as np input = sys.stdin.readline sys.setrecursionlimit(10**8) inf = 10**18 MOD = 1000000007 ri = lambda : int(input()) rs = lambda : input().strip(...
s277831090
p02555
u398511319
1600182113
Python
Python (3.8.2)
py
Runtime Error
29
9260
209
N = int(input()) C=[0]*N C[0]=0 C[1]=0 C[2]=1 n=2 #フィボナッチ数列のイメージ while True: n=n+1 C[n]=C[n-1]+C[n-3] #print(n,C[n]) if n==(N-1): break print(C[N-1]%(10**9+7))
s606070330
p02555
u474162944
1600175225
Python
Python (3.8.2)
py
Runtime Error
124
27300
496
import numpy as np S = int(input()) l = int(S//3) #print ('l=' + str(l)) Cp = 1 Ci = 1 count = 0 for i in range(l): r = S - 3*(i+1) #count = count + c #c=(r+i)!/r!/i! #for k in range(i): # Cp = Cp*(r+i-k) # Ci = Ci*(k+1) #c = Cp//Ci Cp = np.arange(r+1,r+i) Ci = np.arange(1,i...
s273596373
p02555
u188745744
1600170514
Python
Python (3.8.2)
py
Runtime Error
27
9180
124
N=int(input()) DP=[0]*(N+1) DP[3]=1 tmp=0 mod=10**9+7 for i in range(4,N+1): DP[i]=(DP[i-1]+DP[i-3])%mod print(DP[N]%mod)
s554505399
p02555
u944325914
1600168653
Python
Python (3.8.2)
py
Runtime Error
23
9004
201
s=int(input()) if s==1: print(0)   exit() mod=10**9+7 dp=[0]*(s+1) dp[1]=0 dp[2]=0 for i in range(3,s+1): for j in range(3,i+1): dp[i]+=(dp[i-j])%mod dp[i]+=1 print(dp[s]%mod)
s079884781
p02555
u944325914
1600168515
Python
Python (3.8.2)
py
Runtime Error
455
9088
167
s=int(input()) mod=10**9+7 dp=[0]*(s+1) dp[1]=0 dp[2]=0 for i in range(3,s+1): for j in range(3,i+1): dp[i]+=(dp[i-j])%mod dp[i]+=1 print(dp[s]%mod)
s299187486
p02555
u150788544
1600159308
Python
Python (3.8.2)
py
Runtime Error
320
9136
377
import sys n = int(input()) ans = [0]*(n+1) #ans[k]:入力値kでの答え #初期値3、4、5 ans[3] = 1 ans[4] = 1 ans[5] = 1 if n == 1 or n == 2: print(0) sys.exit() if 3<= n <=5: print(1) sys.exit() for i in range(6,n+1): start = 3 stop = i-3 s = 1 for j in range(start,stop+1): s = (s+ans[j]) % (10**9+7) ans...
s229220696
p02555
u150788544
1600159129
Python
Python (3.8.2)
py
Runtime Error
304
9132
280
n = int(input()) ans = [0]*(n+1) #ans[k]:入力値kでの答え #初期値3、4、5 ans[3] = 1 ans[4] = 1 ans[5] = 1 for i in range(6,n+1): start = 3 stop = i-3 s = 1 for j in range(start,stop+1): s = (s+ans[j]) % (10**9+7) ans[i] = s print(ans[-1])
s108240276
p02555
u015767468
1600150405
Python
Python (3.8.2)
py
Runtime Error
82
9208
218
S=int(input()) import math N=S//3 t=0 if S==1 or S==2: print (0) else: for i in range(1,N+1): t=t+math.factorial(S-2*i-1)/(math.factorial(i-1)*math.factorial(S-3*i)) i=i+1 print(t%(10**9+7))
s731609105
p02555
u015767468
1600150009
Python
Python (3.8.2)
py
Runtime Error
27
9148
213
S=int(input()) import math N=(S-S%3)/3 t=0 if S==1 or S==2: print (0) else: for i in range(1,N+1): t=t+math.factorial(S-2*i-1)/(math.factorial(i-1)*math.factorial(S-3*i)) i=i+1 print(t)
s818058640
p02555
u015767468
1600149615
Python
Python (3.8.2)
py
Runtime Error
27
9036
171
S=int(input()) import math N=(S-S%3)/3 t=0 for i in range(1,N+1): t=t+math.factorial(S-2*i-1)/(math.factorial(i-1)*math.factorial(S-3*i)) i=i+1 print (t%(10**9+7))
s290911478
p02555
u903005414
1600147165
Python
Python (3.8.2)
py
Runtime Error
29
9144
189
S = int(input()) MOD = 10**9 + 7 A = [0] * (S + 1) A[0] = 1 A[1] = 0 A[2] = 0 cumsum = 1 for i in range(3, len(A)): A[i] = cumsum cumsum += A[i - 2] cumsum %= MOD print(A[-1])
s046617646
p02555
u185249212
1600131629
Python
PyPy3 (7.3.0)
py
Runtime Error
92
74680
1747
from __future__ import print_function import sys from functools import reduce input = sys.stdin.readline def eprint(*args, **kwargs): print(*args, file=sys.stderr, **kwargs) return def solve02(): n = int(input().strip()) L = [] Xmin, Ymin, Xmax, Ymax = (sys.maxsize, sys.maxsize, -100, -100) ...
s468358382
p02555
u988402778
1600121499
Python
PyPy3 (7.3.0)
py
Runtime Error
144
78688
45008
def main(sample_file = ''): """ convenient functions # for i, a in enumerate(iterable) # q, mod = divmod(a, b) # divmod(x, y) returns the tuple (x//y, x%y) # Higher-order function: reduce(operator.mul, xyz_count, 1) # manage median(s) using two heapq https://atcoder.jp/contests/abc127/tasks/abc...
s239468194
p02555
u174523836
1600116184
Python
Python (3.8.2)
py
Runtime Error
292
9156
181
S = int(input()) DP = [0]*(S+1) DP[0] = 0 DP[1] = 0 DP[2] = 0 for i in range(3, S + 1): DP[i] += 1 for j in range(i - 3 + 1): DP[i] += DP[j] print(DP[S] % (10 ** 9 + 7))
s156388081
p02555
u923662841
1600115827
Python
Python (3.8.2)
py
Runtime Error
30
9864
329
S = int(input()) mod = 10**9+7 def dfs_memo(n): memo = [0]*(n+1) memo[3] = 1 def dfs(n): if n < 3: return 0 elif memo[n] != 0: return memo[n] memo[n] = dfs(n-1)+dfs(n-3) return memo[n] return dfs(n) if S <3: print(0) else: print(dfs_mem...
s958081660
p02555
u706330549
1600115068
Python
Python (3.8.2)
py
Runtime Error
28
8920
196
s = int(input()) dp = [0]*(s+1) MOD = 10**9+7 dp[0] = 1 dp[1] = 0 dp[2] = 0 if s >= 3: for i in range(3, s+1): dp[i] = (dp[i-1] + dp[i-3]) % MOD print(dp[s]) else: print(0)
s121103788
p02555
u540877546
1600109753
Python
PyPy3 (7.3.0)
py
Runtime Error
249
74468
278
n = int(input()) mod = 10**9+7 dp = [1]*(n+1) for i in range(3): dp[i] = 0 for j in range(3, 10): if j <= n: dp[j] = 1 for i in range(3, n+1): for j in range(3, n): if i+j <= n: dp[i+j] += dp[i] dp[i+j] %= mod print(dp[-1])
s634289366
p02555
u540877546
1600109727
Python
PyPy3 (7.3.0)
py
Runtime Error
92
74820
278
n = int(input()) mod = 10**9+7 dp = [1]*(n+1) for i in range(3): dp[i] = 0 for j in range(3, 10): if j <= n: dp[j] = 1 for i in range(3, n+1): for j in range(3, n): if i+j <= n: dp[i+j] += dp[i] dp[i+j] %= mod print(dp[-1])
s258029428
p02555
u699522269
1600109035
Python
Python (3.8.2)
py
Runtime Error
35
9152
152
S = int(input()) dp=[1]+[0 for i in range(S)] i = 3 k=1000000007 while True: dp[i]=(dp[i-1]+dp[i-3])%k if i == S: print(dp[-1]) break i+=1
s444708642
p02555
u573234244
1600108890
Python
Python (3.8.2)
py
Runtime Error
24
8956
694
from math import factorial s = int(input()) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数   # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial(s_ + i) // (factorial...
s169007038
p02555
u573234244
1600108702
Python
Python (3.8.2)
py
Runtime Error
30
8960
678
from math import factorial s = int(input()) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数   # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial(s_ + i) // (factorial...
s335183934
p02555
u573234244
1600108626
Python
Python (3.8.2)
py
Runtime Error
25
9016
696
from math import factorial s = int(input()) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数   # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial(s_ + i) // (factorial...
s323428886
p02555
u573234244
1600108541
Python
Python (3.8.2)
py
Runtime Error
28
9016
677
from math import factorial s = int(input()) ans = 0 for i in range(s // 3): box = i + 1 # 箱の数 ball = s - 3 * box # あらかじめ箱に3こずつ入れたあとの残りの玉の数   # 箱の入れ方が何通りあるか計算。 # 割り算を // ではなく / とするとfloat型の計算となりオーバーフローする可能性がある。 # factorial(s_ + i) // (factorial(s_) * factorial(i))ではなくfactorial(s_ + i) // (factorial(s...
s674504227
p02555
u686230543
1600108146
Python
Python (3.8.2)
py
Runtime Error
28
9172
341
s = int(input()) fact = [1] * s inv = [1] * s invf = [1] * s for i in range(2, s): fact[i] = fact[i-1] * i % mod inv[i] = -(p // i) * inv[p % i] % mod invf[i] = invf[i-1] * inv[i] % mod count = 0 rest = s for n in range(1, (s + 2) // 3): rest -= 3 count = (count + inv[rest + n - 1] * invf[rest] * invf[n - 1...
s390908414
p02555
u810787773
1600107582
Python
Python (3.8.2)
py
Runtime Error
212
9244
227
def main(): S = int(input()) dp = [0]*(S+1) dp[0] = 1 dp[1] = 0 dp[2] = 0 for i in range(3,S+1,1): for j in range(0,i-2,1): dp[i] += dp[j] return dp[S]%1000000007 print(main())
s869433281
p02555
u021019433
1600106610
Python
Python (3.8.2)
py
Runtime Error
23
9016
83
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);}
s367646134
p02555
u021019433
1600106555
Python
Python (3.8.2)
py
Runtime Error
22
8856
82
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);}
s606419385
p02555
u956318161
1600103665
Python
Python (3.8.2)
py
Runtime Error
30
9248
274
s = int(input()) #最後に切った場所がiであるようなパターンの数をdp[i]とする dp=[0]*(s+1) dp[0]=1 if s<3: print("0") elif 3<=s<6 : print("1") for i in range(3,s+1): dp[i]=dp[i-1]+dp[i-3] dp.append(dp[i]) score=dp[s]%(10**9+7) print(score)
s329208895
p02555
u956318161
1600103504
Python
Python (3.8.2)
py
Runtime Error
32
9232
247
s = int(input()) #最後に切った場所がiであるようなパターンの数をdp[i]とする dp=[0]*(s+1) dp[0]=1 if s<3: print("0") for i in range(3,s+1): dp[i]=dp[i-1]+dp[i-3] dp.append(dp[i]) score=dp[s]%(10**9+7) print(score)
s587924179
p02555
u956318161
1600103421
Python
Python (3.8.2)
py
Runtime Error
28
9308
223
s = int(input()) #最後に切った場所がiであるようなパターンの数をdp[i]とする dp=[0]*(s+1) dp[0]=1 for i in range(3,s+1): dp[i]=dp[i-1]+dp[i-3] dp.append(dp[i]) score=dp[s]%(10**9+7) print(score)
s957327913
p02555
u385650604
1600096626
Python
Python (3.8.2)
py
Runtime Error
30
9132
355
import math N = input() N = int(N) x = N / 3 x = int(x) p = 10 ** 9 + 7 sum = 0 if x == 0: print(0) else: for k in range(x): y = N - 3*k - 3 l = k M = y + l a = math.factorial(l) b = math.factorial(M) c = math.factorial(y) z = b / a / c z = z % p sum += z sum = sum %p ...
s646263708
p02555
u543000780
1600093786
Python
Python (3.8.2)
py
Runtime Error
26
9528
365
S = int(input()) mod = 10**9+7 memo = [-1]*(S+1) def redis(s): if memo[s] != -1: return memo[s] else: if s < 3: memo[s] = 0 return 0 elif s < 6: memo[s] = 1 return 1 else: tmp = 0 for num in range(s): tmp += (redis(num)*redis(s-num))%mod memo[s] = tm...
s991660518
p02555
u543000780
1600093679
Python
Python (3.8.2)
py
Runtime Error
24
8844
335
S = int(input()) memo = [-1]*(S+1) redis(s): if memo[s] != -1: return memo[s] else: if s < 3: memo[s] = 0 return 0 elif s < 6: memo[s] = 1 return 1 else: tmp = 0 for num in range(s): tmp += redis(num)*redis(s-num) memo[s] = tmp return tmp print...
s693725798
p02555
u987692205
1600093314
Python
Python (3.8.2)
py
Runtime Error
394
9108
131
s=int(input()) mod=10**9+7 dp=[0]*s for i in range(4,s+1): for j in range(0,(i-3)+1): dp[i]+=dp[j] dp[i]%=mod print(dp[s])
s009225638
p02555
u987692205
1600092941
Python
Python (3.8.2)
py
Runtime Error
28
9064
118
s=int(input()) mod=10**9+7 dp=[0]*s dp[0]=1 for i in range(0,s+1): dp[i]=dp[i-1]+dp[i-3] dp[i]%=mod print(dp[s])
s164032622
p02555
u740157634
1600091699
Python
Python (3.8.2)
py
Runtime Error
485
9112
146
S = int(input()) mod = 10**9+7 dp = [1]+[0]*(S-1) for i in range(0, S+1): for j in range(3, S-2): dp[i] += dp[j] print(dp[S]%mod)
s617770116
p02555
u411923565
1600088844
Python
PyPy3 (7.3.0)
py
Runtime Error
90
74676
287
# D - Redistribution S = int(input()) MOD = 10**9+7 # dp[i]: 3 以上の数字で i を作る組み合わせ dp = [0]*(S+1) # 初期条件 dp[3],dp[4],dp[5] = 1,1,1 # i を作る組合わせ for i in range(6,S+1): dp[i] = dp[i-2] + dp[i-3] + dp[i-4] ans = (dp[S])%MOD print(ans)
s737577345
p02555
u547520179
1600088289
Python
Python (3.8.2)
py
Runtime Error
308
9136
186
INF=1000000000+7 s=int(input()) dp=[0]*(s+1); dp[0]=dp[1]=dp[2]=0 dp[3]=1 for i in range(4,s+1): temp=1 for j in range(3,i-2): temp+=dp[j]%INF; temp%=INF; dp[i]=temp print(dp[s])
s710726845
p02555
u955248595
1600084883
Python
Python (3.8.2)
py
Runtime Error
29
9080
149
S = int(input()) DP = [0]*(S+1) Mod = 10**9+7 DP[0] = 1 DP[1] = 0 DP[2] = 0 for TS in range(3,S+1): DP[TS] = (DP[TS-1]+DP[TS-3])%Mod print(DP[S])
s624592917
p02555
u955248595
1600084685
Python
Python (3.8.2)
py
Runtime Error
27
9188
135
S = int(input()) DP = [0]*(S+1) DP[0] = 1 DP[1] = 0 DP[2] = 0 for TS in range(3,S+1): DP[TS] = (DP[TS-1]+DP[TS-3])%Mod print(DP[S])
s954892777
p02555
u478417863
1600083416
Python
Python (3.8.2)
py
Runtime Error
28
9184
160
n=int(input()) mod=10**9+7 a=[0]*(n) a[0]=0 a[1]=0 a[2]=1 if n<3: print(0) else: for i in range(3,n): a[i]=(a[i-3]+a[i-1])%mod print(a[n-1])
s765552495
p02555
u478417863
1600083330
Python
Python (3.8.2)
py
Runtime Error
26
9112
156
n=int(input()) mod=10**9+7 a=[0]*(n) a[0]=0 a[1]=0 a[2]=1 if n<3: print(0) else: for i in range(3,n): a[i]=(a[i-3]+a[i-1])%mod print(a[n-1])
s028651338
p02555
u770293614
1600081078
Python
Python (3.8.2)
py
Runtime Error
26
9028
483
MOD=10**9+7 def cmb(n,r): if n-r < r: r = n-r if r == 0: return 1 denominator = 1 numerator = 1 for i in range(r): numerator *= n-i numerator %= Q denominator *= i+1 denominator %= Q return numerator*pow(denominator,...
s182966090
p02555
u270144704
1600079986
Python
PyPy3 (7.3.0)
py
Runtime Error
84
68660
383
s = int(input()) MOD = 10 ** 9 + 7 ans = 0 fact = [0] * 10000 fact[0], fact[1] = 1, 1 for i in range(2, 10000): fact[i] = (fact[i-1] * i) % MOD def f(n, r): return fact[n] * pow(fact[n-r], -1, MOD) * pow(fact[r], -1, MOD) for i in range(1, s//3+1): if i == 1: ans += 1 else: m = s - i *...
s933774816
p02555
u770293614
1600079767
Python
Python (3.8.2)
py
Runtime Error
25
9016
889
#define int long long const int mod = 1e9+7; int fact[2020]; int power(int a, int b){ int ans = 1; while(b){ if (b&1){ ans = (ans*a)%mod; } a = (a*a)%mod; b>>=1; } return ans; } int inv(int a){ return power(a, mod-2); } int ncr(int n, int r){ ...
s042276247
p02555
u385650604
1600079195
Python
Python (3.8.2)
py
Runtime Error
25
9024
286
import math N = input() N = int(N) x = N / 3 p = 10 **9 + 7 if x == 0: print(0) sum = 0 else: for k in range(x): y = N - 3 * k l = k - 1 M = y + l a = math.factorial(l) b = math.factorial(M) c = math.factorial(y) z = b / a / c z = z % p sum += z print(z)
s853832375
p02555
u770293614
1600078918
Python
Python (3.8.2)
py
Runtime Error
27
9556
271
S=1729 def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * f(n - 1); possibles=0 n=10**9+7 biggest_sub=S//3 for i in range(1,biggest_sub+1): possibles+=f(S-3*i+i-1)/f(i-1)/f(S-3*i) possibles%=n n=10**9+7 print(possibles%n)
s870781406
p02555
u770293614
1600078864
Python
Python (3.8.2)
py
Runtime Error
25
9072
287
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 n=10**9+7 biggest_sub=S//3 for i in range(1,biggest_sub+1): possibles+=f(S-3*i+i-1)/f(i-1)/f(S-3*i) possibles%=n n=10**9+7 print(possibles%n)
s694851785
p02555
u270144704
1600078582
Python
PyPy3 (7.3.0)
py
Runtime Error
83
74916
389
s = int(input()) MOD = 10 ** 9 + 7 ans = 0 fact = [0] * 4000 fact[0], fact[1] = 1, 1 for i in range(2, 4000): fact[i] = (fact[i-1] * i) % MOD def f(n, r): return (fact[n+(r-1)] * pow(fact[n], -1, MOD) * pow(fact[r-1], -1, MOD))%MOD for i in range(1, s//3+1): if i == 1: ans += 1 else: m...
s061093526
p02555
u770293614
1600078547
Python
Python (3.8.2)
py
Runtime Error
32
9216
259
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): possibles+=f(S-2*i-1)/f(S-3*i)/f(i-1) n=10**9+7 print(possibles%n)
s482633410
p02555
u770293614
1600078525
Python
Python (3.8.2)
py
Runtime Error
26
9188
258
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): possibles=f(S-2*i-1)/f(S-3*i)/f(i-1) n=10**9+7 print(possibles%n)
s776222938
p02555
u270144704
1600078521
Python
PyPy3 (7.3.0)
py
Runtime Error
85
75184
389
s = int(input()) MOD = 10 ** 9 + 7 ans = 0 fact = [0] * 4000 fact[0], fact[1] = 1, 1 for i in range(2, 4000): fact[i] = (fact[i-1] * i) % MOD def f(n, r): return (fact[n+(r-1)] * pow(fact[n], -1, MOD) * pow(fact[i-1], -1, MOD))%MOD for i in range(1, s//3+1): if i == 1: ans += 1 else: m...
s667481821
p02555
u270144704
1600078192
Python
PyPy3 (7.3.0)
py
Runtime Error
84
74896
389
s = int(input()) MOD = 10 ** 9 + 7 ans = 0 fact = [0] * 2001 fact[0], fact[1] = 1, 1 for i in range(2, 2001): fact[i] = (fact[i-1] * i) % MOD def f(n, r): return (fact[n+(r-1)] * pow(fact[n], -1, MOD) * pow(fact[i-1], -1, MOD))%MOD for i in range(1, s//3+1): if i == 1: ans += 1 else: m...
s801356446
p02555
u770293614
1600072814
Python
Python (3.8.2)
py
Runtime Error
27
9120
274
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): possibles=f(biggest_sub-3*i)/f(r)/f(biggest_sub-4*r) n=10**9+7 print(possibles%n)
s097669009
p02555
u770293614
1600072466
Python
Python (3.8.2)
py
Runtime Error
26
9120
275
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): left=S-3*i possibles+=(f(left+i-1)/(f(i-1)*f(left))) n=10**9+7 print(possibles%n)
s543584976
p02555
u770293614
1600072300
Python
Python (3.8.2)
py
Runtime Error
27
8980
273
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=1 biggest_sub=S//3 for i in range(2,biggest_sub+1): left=S-3*i possibles+=(f(left+i-1)/f(i-1)/f(left)) n=10**9+7 print(possibles%n)
s090260011
p02555
u770293614
1600072263
Python
Python (3.8.2)
py
Runtime Error
28
9044
276
S=int(input()) def f(n): # single line to find factorial return 1 if (n==1 or n==0) else n * factorial(n - 1); possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): left=S-3*i possibles+=(f(left+i-1)/f(i-1)/f(left)) n=10**9+7 print(possibles%n)
s915379274
p02555
u770293614
1600072067
Python
Python (3.8.2)
py
Runtime Error
26
9232
283
S=int(input()) def f(n): fact = 1 for i in range(1,n+1): fact = fact * i return fact def nCr(n,r): return f(n) / f(r) / f(n-r) possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): left=S-3*i possibles+=nCr(left+i-1,i-1) n=10**9+7 print(possibles%n)
s680333199
p02555
u770293614
1600072046
Python
Python (3.8.2)
py
Runtime Error
24
8684
284
S=int(input()) def f(n): fact = 1 for i in range(1,n+1): fact = fact * i return fact def nCr(n,r): return f(n) / f(r) / f(n-r) possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): left=S-3*i possibles+=nCr(left+i-1,i-1) n=10**9+7 print(possibles%n)
s966439365
p02555
u770293614
1600071924
Python
Python (3.8.2)
py
Runtime Error
25
9116
230
S=int(input()) import math def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) possibles=0 biggest_sub=S//3 for i in range(1,biggest_sub+1): left=S-3*i possibles+=nCr(left+i-1,i-1) n=10**9+7 print(possibles%n)
s984487944
p02555
u729133443
1600071849
Python
Python (3.8.2)
py
Runtime Error
54
22480
64
a,b,c=1,0,0 exec('a,b,c=b,c,a+c;'*int(input())) print(a%(1e9+7))
s924472156
p02555
u770293614
1600071794
Python
Python (3.8.2)
py
Runtime Error
30
9120
230
S=int(input()) import math def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) possibles=1 biggest_sub=S//3 for i in range(2,biggest_sub+1): left=S-3*i possibles+=nCr(left+i-1,i-1) n=10**9+7 print(possibles%n)
s553081830
p02555
u770293614
1600071701
Python
Python (3.8.2)
py
Runtime Error
29
8848
218
S=int(input()) import math def nCr(n,r): f = math.factorial return f(n) / f(r) / f(n-r) possibles=1 biggest_sub=S//3 for i in range(2,biggest_sub+1): left=S-3*i possibles+=nCr(left+i-1,i-1) print(possibles)
s822843186
p02555
u688839540
1600069914
Python
Python (3.8.2)
py
Runtime Error
81
9344
209
def f(n): if n <= 1: return 1 return f(n-1)*n def h(n,m): return f(n+m-1)//f(n)//f(m-1) s=int(input()) res = 0 pair = s//3 for i in range(1,pair+1): res += h(s-3*i,i) print(res%(10**9+7))
s213495346
p02555
u688839540
1600069213
Python
Python (3.8.2)
py
Runtime Error
59
9632
195
def f(n): if n <= 1: return 1 return f(n-1)*n def h(n,m): return f(n+m-1)/f(n)/f(m-1) s=int(input()) res = 0 pair = s//3 for i in range(1,pair+1): res += h(s-3*i,i) print(res)
s577101964
p02555
u011220523
1600064720
Python
Python (3.8.2)
py
Runtime Error
25
8944
4903
#ifdef mmlang_source_11_lines S = inputInt() @memo(size=2005) def func(x) -> int: if x<3: return 0 ret = 1 ret += func(x-(3:x-3+1)) mod 1e9+7 return ret print(func(S)) #endif //#define NDEBUG #include <cassert> #include <vector> #include <deque> #include <string> #include <map> #include <q...
s347557312
p02555
u583285098
1600063334
Python
Python (3.8.2)
py
Runtime Error
52
9104
342
import math s = int(input()) if s <= 2: print(0) exit() ans = 1 mod = 10**9+7 def c(_n, _r): child = math.prod([_i+1 for _i in range(_n-_r, _n)]) mother = math.factorial(_r) return int(child/mother) for i in range(2, (s // 3) + 1): n = s - i * 3 r = i - 1 ans += c(n + r, r) ans %...
s199574074
p02555
u583285098
1600061932
Python
Python (3.8.2)
py
Runtime Error
87
9196
291
import math s = int(input()) if s <= 2: print(0) exit() ans = 1 mod = 10**9+7 def c(_n, _r): return math.factorial(_n) / (math.factorial(_r) * math.factorial(_n - _r)) for i in range(2, (s//3)+1): n = s-i*3 r = i-1 ans += c(n+r, r) ans %= mod print(int(ans))
s804122656
p02555
u773081031
1600061783
Python
Python (3.8.2)
py
Runtime Error
26
8832
102
n = int(input()) s = [s[i-1] + s[i-3] if i>2 elif i<2 0 elif i==2 1 for i in range(n)] print(s[n-1])