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
s687273539
p02555
u573234244
1600028473
Python
Python (3.8.2)
py
Runtime Error
191
42332
261
s = int(input()) from scipy.special import comb ans = 0 for i in range(x): Box = i + 1 Nokori = s - 3 * Box ans_ = comb(Nokori + Box - 1, Nokori, exact=True) % (10 ** 9 + 7) ans += ans_ #ans = ans % (10 ** 9 + 7) print(ans % (10 ** 9 + 7))
s884198204
p02555
u801576633
1600028454
Python
PyPy3 (7.3.0)
py
Runtime Error
342
128344
617
N=int(input()) sp=[[-1 for i in range(2000)] for j in range(2000)] mod=10**9+7 def spnum(n, l): global sp if sp[n][l] != -1: return sp[n][l] if n==l: sp[n][l]=1 return 1 if n-l < 3: sp[n][l]=0 return 0 if n-l == 3: sp[n][l]=1 return 1 i...
s951648478
p02555
u951289777
1600028429
Python
Python (3.8.2)
py
Runtime Error
239
42400
293
from scipy.special import comb s = int(input()) if s < 3: print(0) else: count = 0 total = 0 while True: s = s-3 count += 1 if s >= 0: total += comb(s+count-1, count-1) else: break print(int(total % (10**9+7)))
s020150564
p02555
u905029819
1600028317
Python
Python (3.8.2)
py
Runtime Error
85
9188
259
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3 + 1): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) print(int(sum % divider)) elif 3 <= S <= 5 : print(1) else: print(0)
s030639159
p02555
u905029819
1600028296
Python
Python (3.8.2)
py
Runtime Error
81
9216
254
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3 + 1): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) print(sum % divider) elif 3 <= S <= 5 : print(1) else: print(0)
s581069325
p02555
u809495242
1600028287
Python
Python (3.8.2)
py
Runtime Error
26
9192
286
S = int(input()) from math import factorial ans = 0 m = S // 3 #最大桁数 print(m) for p in range(1,m+1): x = S - 3*(p) #p桁 自由度x a = factorial(x+p-1) b = factorial(p-1) c = factorial(x) ans += ( a / b / c )%(10**9+7) print(int((ans)%(10**9+7)))
s632577494
p02555
u137346245
1600028261
Python
Python (3.8.2)
py
Runtime Error
85
9064
290
import math N = int(input()) a = 1 k = 1 s = 1 o = 5 b = N // 3 for i in range (b - 1): u = int(math.factorial(N-o)) k = int(math.factorial(N - o - a)) p = int(math.factorial(a)) a = a + 1 s = s + u / (k * p) o = o + 2 if N < 3: s = 0 print(int(s) % 1000000007)
s072842101
p02555
u905029819
1600028250
Python
Python (3.8.2)
py
Runtime Error
86
9212
255
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) print(int(sum % divider)) elif 3 <= S <= 5 : print(1) else: print(0)
s728971010
p02555
u237380198
1600028243
Python
Python (3.8.2)
py
Runtime Error
27
9124
244
s = int(input()) maxcount = int(s / 3) amari = s % 3 count = 0 if amari == 0 and maxcount > 0: count = 1 for i in range(maxcount): amari = s - (i + 1) * 3 count += comb(amari + i, i, exact=True) count %= 1000000007 print(count)
s657204530
p02555
u002765126
1600028233
Python
PyPy3 (7.3.0)
py
Runtime Error
82
68796
230
import sys input = sys.stdin.readline n=int(input()) X=[] Y=[] #P=np.ndarray((0,2)) for i in range(n): x,y = map(int,input().split()) X.append(x+y) Y.append(x-y) ans = max(max(X)-min(X),max(Y)-min(Y)) print(ans)
s108918104
p02555
u024568043
1600028204
Python
Python (3.8.2)
py
Runtime Error
85
9496
204
import math def calc(n, d): if (n == 0): return 0 return calc(n-1, d+3) + math.factorial(n-1+d)/(math.factorial(n-1)*math.factorial(d)) S = int(input()) print(int(calc(int(S/3), S%3)%(10**9+7)))
s821765955
p02555
u842033632
1600028198
Python
Python (3.8.2)
py
Runtime Error
266
42508
215
from scipy.special import comb S = int(input()) slen = int(S/3) Ans = 0 for i in range(1,slen+1): szan = S - 3*i c = int(comb(szan+i-1,szan)) # print(szan, szan+i-1,c) Ans += c print((Ans%(10**9+7)))
s430853231
p02555
u137346245
1600028183
Python
Python (3.8.2)
py
Runtime Error
89
9080
312
import math N = int(input()) a = 1 k = 1 s = 1 o = 5 b = N // 3 for i in range (b - 1): u = int(math.factorial(N-o)) k = int(math.factorial(N - o - a)) p = int(math.factorial(a)) a = a + 1 print(u / (k * p)) s = s + u / (k * p) o = o + 2 if N < 3: s = 0 print(int(s) % 1000000007)
s438961491
p02555
u567225946
1600028181
Python
PyPy3 (7.3.0)
py
Runtime Error
133
68544
153
mod=10**9+7 s=int(input()) dp=[1]*(s+1) dp[0]=0 dp[2]=0 dp[1]=0 for i in range(3,s+1): for j in range(3,i-2): dp[i]+=dp[j] print(dp[s]%mod)
s752778437
p02555
u455354923
1600028109
Python
PyPy3 (7.3.0)
py
Runtime Error
173
79608
332
import math S=int(input()) n=S//3 ans = 0 for i in range(1,n+1): x = S-(i*3) #print("i",i,"x",x) #print(math.factorial(x+i-1),math.factorial(x),math.factorial(i-1)) ans += math.factorial(x+i-1)/(math.factorial(x)*math.factorial(i-1)) #print(ans) print(int((ans%((10**9)+7)))) #print("ans",int(ans%((...
s416902020
p02555
u931394483
1600028104
Python
Python (3.8.2)
py
Runtime Error
122
9148
352
import math s = int(input()) if s < 6: print("0") else: bar = (s // 3) - 1 ans = 0 for i in range(bar+1): if i == 0: ans += 1 else: val = s - 3 * (i+1) count = math.factorial(val+i) // (math.factorial(val) * math.factorial(i)) ans += count ...
s859089506
p02555
u905029819
1600027990
Python
Python (3.8.2)
py
Runtime Error
88
9160
249
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) elif 3 <= S <= 5 : sum = 1 else: sum = 0 print(sum % divider)
s412046247
p02555
u364555831
1600027984
Python
Python (3.8.2)
py
Runtime Error
512
8848
633
S = int(input()) mod = 10 ** 9 + 7 if S <= 2: print(0) exit() ans = 0 max_items = S // 3 # print("max_items", max_items) for item in range(1, max_items + 1): # print("---------------------------") n = S - 3 * item modinv_table = [-1] * (n + 1) modinv_table[1] = 1 for i in range(2, n + 1)...
s019354696
p02555
u729245484
1600027919
Python
Python (3.8.2)
py
Runtime Error
85
9244
474
n = int(input()) maxi = n//3 #print(maxi) import math if maxi == 0: print("0") elif maxi == 1: print("1") else: ans = 1 for i in range(1,maxi): #iがbarの数 #i + 1が要素の数 #要素の数のmax = maxi amari = n - 3*(i+1) total = math.factorial(i + amari) bar = math.factorial(i) ball = math.factoria...
s737806793
p02555
u097852911
1600027852
Python
Python (3.8.2)
py
Runtime Error
82
9208
366
import math s = int(input()) def com(a,b): return math.factorial(a)/(math.factorial(a-b)*math.factorial(b)) maxi = s//3 ans = 0 div = 10**9 + 7 if maxi == 0: print(0) else: for i in range(maxi): n=1+i sumation = s-3*n kosu= com(n-1+sumation,n-1) ans += kosu #print("n=",n,"sumation=",sumation,...
s222527872
p02555
u184421630
1600027847
Python
Python (3.8.2)
py
Runtime Error
26
9116
296
s = int(input()) if s <= 2: print(0) lst = [] counter = 0 for i in range(3, s+1): lst.append([]) lst[counter].append(i) if i != s: lst[counter].append[s - i] counter += 1 for j in range(len(lst)): for k in range(len(lst[0])): if lst[j][k] <= 2: lst.pop(j) print(len(lst))
s969841406
p02555
u905029819
1600027824
Python
Python (3.8.2)
py
Runtime Error
84
9232
250
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) print(sum % divider) elif 3 <= S <= 5 : print(1) else: print(0)
s012038692
p02555
u905029819
1600027787
Python
Python (3.8.2)
py
Runtime Error
86
9232
250
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / (math.factorial(S-3*i) * math.factorial(i-1)) print(sum / divider) elif 3 <= S <= 5 : print(1) else: print(0)
s853987127
p02555
u961223096
1600027753
Python
PyPy3 (7.3.0)
py
Runtime Error
136
68604
461
import sys import numpy as np def dump(x): print(x, file=sys.stderr) MOD = 10**9+7 N = int(input()) arr = np.zeros((N+1,N+1),dtype=int) for i in range(3,N+1): arr[0,i] = 1 for i in range(1,N+1): sum_ = 0 for j in range(3*i,N+1): sum_ += arr[i-1,j] sum_ %= MOD if j+3 >= N + 1...
s368330107
p02555
u610042046
1600027735
Python
Python (3.8.2)
py
Runtime Error
114
9168
262
import math def comb(n, r): return math.factorial(n) // (math.factorial(n - r) * math.factorial(r)) s = int(input()) a = s//3 if a == 0: print(0) else: m = 10**9+7 cnt = 1 for i in range(2, a+1): cnt += comb(s-2*i-1, i-1) print(cnt%m)
s542723789
p02555
u905029819
1600027684
Python
Python (3.8.2)
py
Runtime Error
50
9220
262
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) print(sum / divider) elif 2 < S < 6 : print(1/divider) else: print(0/divider)
s572813213
p02555
u458412487
1600027553
Python
Python (3.8.2)
py
Runtime Error
26
9112
217
N=int(input()) X=[] for i in range(N): array = list(map(int,input().split())) X.append(array) D=[] for i in range(N): for j in range(N-i): D.append(abs(X[i][0]-X[j][0])+abs(X[i][1]-X[j][1])) print(max(D))
s011995841
p02555
u905029819
1600027489
Python
Python (3.8.2)
py
Runtime Error
46
9200
248
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) print(sum / divider) elif 3 <= S <= 5 : print(1) else: print(0)
s498831971
p02555
u905029819
1600027476
Python
Python (3.8.2)
py
Runtime Error
30
9028
247
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) print(sum / divider elif 3 <= S <= 5 : print(1) else: print(0)
s644249933
p02555
u525589885
1600027474
Python
Python (3.8.2)
py
Runtime Error
26
8868
223
s = int(input()) l = 10**9+7 list_1 = [0, 1, 1, 1] list_2 = [0, 1, 2] for i in range(3, s): list_2.append((list_2[i-1] + list_1[i])%l) list_1.append(list_2[i-2]) if s = 1 or s = 2: print(0) else: print(list_1[s-1])
s993957388
p02555
u534610124
1600027448
Python
Python (3.8.2)
py
Runtime Error
236
42488
180
S = int(input()) L = S//3 mod = 10**9+7 res = 0 from scipy.special import comb for l in range(1,L+1): s = S - l*3 a = comb(s+l-1, l-1) res += a print(int(res%mod))
s855585754
p02555
u755056246
1600027429
Python
PyPy3 (7.3.0)
py
Runtime Error
187
111644
357
nCr = {} def cmb(n, r): if r == 0 or r == n: return 1 if r == 1: return n if (n,r) in nCr: return nCr[(n,r)] nCr[(n,r)] = cmb(n-1,r) + cmb(n-1,r-1) return nCr[(n,r)] S = int(input()) sho = S // 3 ans = 1 S -= 5 if sho > 0: for i in range(1,sho): ans += cmb(S, i) S -= 2 prin...
s134369993
p02555
u729679908
1600027372
Python
Python (3.8.2)
py
Runtime Error
32
9212
401
import sys N = int(input()) A = list(map(int,input().split())) B = list(map(int,input().split())) C = B for i in range(1,N+1): i = A.count(i) + B.count(i) if i > N: print("No") sys.exit() print("Yes") for j in range(0,N): for k in range(0,N): if B[k] != A[j] and B[k] != 0: ...
s952403530
p02555
u273914730
1600027369
Python
Python (3.8.2)
py
Runtime Error
28
8908
221
S=int(input()) def hiteku(S,a) while S>=3: a=[] m=0 for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(S,a) print((m)%(10**9+7))
s949601279
p02555
u947664173
1600027356
Python
PyPy3 (7.3.0)
py
Runtime Error
88
68332
413
s=int(input()) import math ketamax=math.floor(s/3) def kaijo(a,b): x=a for i in range(a+1,b+1): x=x*i return x def comb(n, r): if r==0: return 1 elif r==1: return n else: a=kaijo(n-r+1,n)/kaijo(1,r) return a ans=0 for i in range(1,ketamax+1): nokori=s-3*i...
s139809156
p02555
u273914730
1600027348
Python
Python (3.8.2)
py
Runtime Error
25
8948
222
S=int(input()) def hiteku(S,a) while S>=3: a=[] m=0 for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(S,a) print((m)%(10**9+7))
s216422317
p02555
u905029819
1600027337
Python
Python (3.8.2)
py
Runtime Error
52
9160
249
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 5: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) elif 3 <= S <= 5 : print(1) else: print(0) print(sum / divider)
s325542005
p02555
u578441226
1600027331
Python
Python (3.8.2)
py
Runtime Error
2206
9808
306
def dfs(i,sum,box): global ans if i == s-2: if sum == s: ans += 1 if box == s: ans += 1 else: dfs(i + 1, sum + sl[i],sl[i]) dfs(i + 1, sum,box) s = int(input()) sl = list(range(3,s+1)) # print(sl) ans = 0 dfs(0,0,0) print(ans)
s877182019
p02555
u905029819
1600027275
Python
Python (3.8.2)
py
Runtime Error
51
9036
243
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S > 3: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) elif S == 3: print(1) else: print(0) print(sum / divider)
s954097736
p02555
u836080851
1600027265
Python
Python (3.8.2)
py
Runtime Error
86
9200
217
import math S = int(input()) d = 10**9+7 n = int(S/3) co = 0 for i in range(n): a = i+1 if a == 1: co += 1 else: co += math.factorial(S-2*a-1)/(math.factorial(S-3*a)*math.factorial(a-1)) print(int(co%d))
s774248006
p02555
u475402977
1600027259
Python
Python (3.8.2)
py
Runtime Error
27
8904
545
S=int(input()) def cmb(n, r, mod): if ( r<0 or r>n ): return 0 r = min(r, n-r) return g1[n] * g2[r] * g2[n-r] % mod mod = 10**9+7 #出力の制限 N = 10**4 g1 = [1, 1] # 元テーブル g2 = [1, 1] #逆元テーブル inverse = [0, 1] #逆元テーブル計算用テーブル for i in range( 2, N + 1 ): g1.append( ( g1[-1] * i ) % mod ) inverse....
s714728964
p02555
u905029819
1600027225
Python
Python (3.8.2)
py
Runtime Error
50
9184
220
import math S = int(input()) divider = 10**9 + 7 sum = 0 if S >= 3: for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) else: print(0) print(sum / divider)
s207981049
p02555
u373047809
1600027216
Python
PyPy3 (7.3.0)
py
Runtime Error
101
72048
752
#!/usr/bin/env python3 class Factorial: def __init__(self, n, mod): self.f = f =[0] * (n + 1) f[0] = b = 1 for i in range(1, n + 1):f[i] = b = b * i % mod self.inv = inv = [0] * (n + 1) inv[n] = b = pow(self.f[n], -1, mod) for i in range(n,0,-1):inv[i-1] = b = b * i %...
s559906401
p02555
u923507896
1600027145
Python
PyPy3 (7.3.0)
py
Runtime Error
173
73392
301
import math s = int(input()) n = s//3 ans = 0 if n == 0: print(0) else: for i in range(n): res = s-(3*(i+1)) fact1 = math.factorial(res+i) fact2 = math.factorial(res) fact3 = math.factorial(i) ans += int(fact1/(fact2*fact3)) print(ans % (10**9 + 7))
s762510540
p02555
u905029819
1600027130
Python
Python (3.8.2)
py
Runtime Error
53
9188
188
import math S = int(input()) divider = 10**9 + 7 sum = 0 for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) print(sum / divider)
s451710007
p02555
u273914730
1600027130
Python
Python (3.8.2)
py
Runtime Error
25
9000
218
S=int(input()) def hiteku(a) while S>=3: a=[] m=0 for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print((m)%(10**9+7))
s536708756
p02555
u905029819
1600027079
Python
Python (3.8.2)
py
Runtime Error
50
9164
188
import math S = int(input()) divider = 10**9 + 7 sum = 0 for i in range(1, S//3): sum += math.factorial(S-2*i-1) / math.factorial(S-3*i) * math.factorial(i-1) print(num / divider)
s312731990
p02555
u323453628
1600027049
Python
PyPy3 (7.3.0)
py
Runtime Error
167
79448
195
from math import factorial s = int(input()) n = s // 3 sum = 0 for i in range(1, n + 1): sum += factorial(s - 2 * i - 1) / (factorial(s - 3 * i) * factorial(i - 1)) print(sum % (10 ** 9 + 7))
s177526823
p02555
u836080851
1600027047
Python
Python (3.8.2)
py
Runtime Error
90
9008
217
import math S = int(input()) d = 10**9+7 n = int(S/3) co = 0 for i in range(n): a = i+1 if a == 1: co += 1 else: co += math.factorial(S-2*a-1)/(math.factorial(S-3*a)*math.factorial(a-1)) print(int(co%d))
s661907821
p02555
u273914730
1600026893
Python
Python (3.8.2)
py
Runtime Error
27
9000
218
S=int(input()) def hiteku(a) while S>=0: a=[] m=0 for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print((m)%(10**9+7))
s829541157
p02555
u273914730
1600026878
Python
Python (3.8.2)
py
Runtime Error
34
8940
221
S=int(input()) def hiteku(a) while S>=0: a=[] m=0 for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print((m)%(10**9+7))
s202692210
p02555
u587370992
1600026827
Python
PyPy3 (7.3.0)
py
Runtime Error
2208
104276
607
S = int(input()) MOD = 10 ** 9 + 7 memo = [] for _ in range(2000): memo.append([None] * 2000) def f(n, s): if memo[n][s] is not None: return memo[n][s] ans = f_(n, s) memo[n][s] = ans return ans def f_(n, s): # print(n, s) if n == 1 and s >= 3: return 1 if n < 1 or 3 *...
s210207641
p02555
u895758916
1600026788
Python
Python (3.8.2)
py
Runtime Error
85
9184
159
import math S=int(input()) MOD=(10**9)+7 if S<3: print(0) else : lim=(S//3) ans=0 for i in range(lim): S=S-3; ans=(ans+math.comb(i+S,i))%MOD print(ans)
s776462500
p02555
u912556688
1600026751
Python
PyPy3 (7.3.0)
py
Runtime Error
97
68656
188
S=int(input()) ans=0 for i in range(S // 3): ans+=(math.factorial(S-2*i)%1000000007)//((math.factorial(i)%1000000007)*(math.factorial(S-3*i))%1000000007)%1000000007 print(ans%1000000007)
s071991478
p02555
u419978514
1600026750
Python
Python (3.8.2)
py
Runtime Error
27
9104
247
n=int(input) a=list() for i in range(n): a.append(list(map(int,input().strip().split()))) a=list(set(a)) ans=0 for i in range(len(a)): for j in range(i+1,len(a)): ans=max(ans,abs(a[i][0]-a[j][0])+abs(a[j][1],a[i][1])) print(ans)
s578193429
p02555
u561615664
1600026725
Python
PyPy3 (7.3.0)
py
Runtime Error
108
68732
158
S = int(input()) mod = 10**9+7 s = s%3 n = (S-s)/3 for i in range(n): jj = 1 for j in range(n-i,2*i+s+n-1): jj *= j ss += jj print(ss%mod)
s734319919
p02555
u875584014
1600026702
Python
Python (3.8.2)
py
Runtime Error
80
9184
182
import math S=int(input()) N=S//3 t=S%3 ans=0 for i in reversed(range(N)): ans+=int(math.factorial(i+t)/(math.factorial(i)*math.factorial(t))) ans=ans%(10**9+7) t+=3 print(ans)
s725367529
p02555
u628285938
1600026623
Python
Python (3.8.2)
py
Runtime Error
227
42468
344
# -*- coding: utf-8 -*- """ Created on Sun Sep 13 20:41:22 2020 @author: liang """ from scipy.special import comb #D key = 10**9 + 7 S = int(input()) #かご n = S//3 ans = 0 for i in range(1,n+1): #玉 a = S - 3*i tmp = int(comb(i-1+a,i-1)) tmp %= key ans += tmp ans %= key #print("print:",i,a...
s254631986
p02555
u392996478
1600026590
Python
PyPy3 (7.3.0)
py
Runtime Error
95
68312
546
from collections import Counter from collections import deque from sys import stdin from bisect import * from heapq import * import math g = lambda : stdin.readline().strip() gl = lambda : g().split() gil = lambda : [int(var) for var in gl()] gfl = lambda : [float(var) for var in gl()] gcl = lambda : list(g()) gbs ...
s361402712
p02555
u742129941
1600026545
Python
Python (3.8.2)
py
Runtime Error
654
9136
170
S = int(input()) a = [0 for _ in range(S+1)] a[3] = 1 for n in range(4, S+1): sm = 0 for i in range(3, S): sm += a[n-i] a[n] = sm+1 print(a[S] % ((10**9) + 7))
s638326714
p02555
u694665829
1600026409
Python
Python (3.8.2)
py
Runtime Error
119
9160
471
n = int(input()) mod = 10**9 + 7 import math def cnt(n, i): if i == 1: return 1 else: l = n - 3*i m = i-1 return math.factorial(l + m)//(math.factorial(l)*math.factorial(m)) if n == 2 or n == 1: print(0) if n == 3: print(1) if n > 3: ans = 0 iter = n /...
s510158452
p02555
u158380546
1600026380
Python
Python (3.8.2)
py
Runtime Error
34
9196
173
s = int(input()) red = [None]*s red[0]= 0 red[1]= 0 red[2]= 0 for x in range(3,s): red[x] = (red[x-1] + red[x-3] + 1) % 1000000007 print((red[s-3]+1) % 1000000007)
s446230746
p02555
u934119021
1600026375
Python
Python (3.8.2)
py
Runtime Error
119
9256
419
import math s = int(input()) p = s // 3 q = s % 3 ans = 0 if s < 3: ans = 0 else: if q == 0: ans += 1 elif q == 1: ans += p elif q == 2: ans += p + math.factorial(p) // (math.factorial(p - 2) * math.factorial(2)) for i in range(1, p): ans += math.factorial((s - 3 * (p - i)) + (p - i - 1)) // (...
s387065680
p02555
u793821463
1600026348
Python
Python (3.8.2)
py
Runtime Error
1594
62344
212
S = int(input()) mod = 10**9 + 7 d = [[0 for i in range(S + 1)] for j in range(S + 1)] d[3][1] = 1 for j in range(S - 3): for i in range(S): d[j+4][i+1] = (d[j+3][i+1] + d[j+1][i]) %mod print(sum(d[S])%mod)
s650207288
p02555
u062691227
1600026304
Python
PyPy3 (7.3.0)
py
Runtime Error
150
68700
155
from math import comb MOD = 10**9+7 n = int(input()) mdiv = n // 3 ans = 0 for i in range(mdiv): ans += comb(n - 3 * (i + 1) + i, i) print(ans % MOD)
s505492668
p02555
u550146922
1600026302
Python
PyPy3 (7.3.0)
py
Runtime Error
137
68716
182
s = int(input()) import sys p = 10**9+7 dp = [0]*100#2003 dp[2]=1 if s<=3: print(dp[s-1]) sys.exit() for i in range(3,s): dp[i] = (dp[i-1]%p+dp[i-3]%p)%p print(dp[s-1])
s775613276
p02555
u273914730
1600026280
Python
Python (3.8.2)
py
Runtime Error
27
8936
163
S=int(input()) def hiteku(a) a=[] m=0 while S>=0: for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print((m)%(10**9+7))
s065793844
p02555
u273914730
1600026222
Python
Python (3.8.2)
py
Runtime Error
27
8908
167
S=int(input()) def hiteku(a) a=[] m=0 while S>=0: for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print((m)%(10**9+7))
s278264613
p02555
u273914730
1600026192
Python
Python (3.8.2)
py
Runtime Error
25
9000
155
S=int(input()) def hiteku(a) a=[] m=0 while S>=0: for i in range(3,S): (a).append(S-i) S=S-i m=m+1 hiteku(a) print(m)
s595776090
p02555
u794066762
1600026002
Python
Python (3.8.2)
py
Runtime Error
532
9220
177
n=int(input()) dp=[1 for i in range(n+1)] dp[0]=dp[1]=dp[2]=0 modd=1e9+7 for i in range(3,n): for j in range(3,n-i+1): dp[i+j]=(dp[i+j]+dp[i])%modd print(int(dp[n]))
s099378823
p02555
u985929170
1600025984
Python
PyPy3 (7.3.0)
py
Runtime Error
116
68684
263
mod = 10**9+7 from scipy.special import comb s = int(input()) if s==1 or s==2: print(0) exit() pk_num = s//3-1 ans = 1 for i in range(pk_num): pk = (i+2)*3 g = s - pk b = i+2 ans += comb(g+b-1,b-1, exact=True) ans %= mod print(ans)
s582331027
p02555
u280978334
1600025977
Python
Python (3.8.2)
py
Runtime Error
29
8864
1107
from math import log10 class Mod: fac = [] inv = [] finv = [] mod = 0 def __init__(self,maxi:int ,mod:int): self.mod = mod self.fac = [1]*maxi self.inv = [1]*maxi self.finv = [1]*maxi for i in range(2,maxi): ...
s122363855
p02555
u628335443
1600025876
Python
PyPy3 (7.3.0)
py
Runtime Error
151
68500
222
S = int(input()) if S < 3: print(0) exit() x = [0] * (S + 1) x[3] = x[4] = x[5] = 1 for i in range(6, S + 1): x[i] += 1 for j in range(3, i - 3 + 1): x[i] += x[i - j] print(x[S] % (10 ** 9 + 7))
s399425679
p02555
u348805958
1600025862
Python
PyPy3 (7.3.0)
py
Runtime Error
86
68608
882
#!python3 import sys iim = lambda: map(int, sys.stdin.readline().rstrip().split()) def cmb_mod(N, mod=10**9+7): N1 = N + 1 g1 = [0] * N1 g2 = [0] * N1 inv = [0] * N1 g1[0] = g1[1] = g2[0] = g2[1] = inv[1] = 1 for i in range(2, N1): g1[i] = g1[i-1] * i % mod inv[i] = -inv[mod %...
s756746760
p02555
u268750247
1600025712
Python
Python (3.8.2)
py
Runtime Error
27
9000
1574
#include <bits/stdc++.h> using namespace std; // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; #define ll long long #define ull unsigned long long #define ld long double // #define ordered_set tree<pair<ll, ll>, null_type, less<pair<ll, ll>>, rb_tre...
s184365631
p02555
u642012866
1600025639
Python
Python (3.8.2)
py
Runtime Error
497
9212
201
S = int(input()) mod = 10**9+7 ans = 0 x = [0]*(S+1) x[3] = 1 x[4] = 1 x[5] = 1 for i in range(6, S+1): x[i] += 1 for j in range(3, i-2): x[i] += x[j] x[i] %= mod print(x[S])
s939730944
p02555
u019685451
1600025594
Python
PyPy3 (7.3.0)
py
Runtime Error
103
68728
178
N = int(input()) M = 10**9 + 7 dp = [0] * (N + 1) dp[3] = 1 dp[4] = 1 dp[5] = 1 for i in range(6, N + 1): dp[i] = sum(dp[3:i - 3 + 1]) + 1 dp[i] %= M print(dp[-1] % M)
s865415608
p02555
u851125702
1600025496
Python
Python (3.8.2)
py
Runtime Error
30
9080
140
S=int(input()) x=10**9+7 a=[0 for i in range(S+1)] a[3]=1 a[4]=1 a[5]=1 a[6]=2 for i in range(7,S+1): a[i]=(a[i-1]+a[i-3])%x print(a[S])
s991049952
p02555
u240444124
1600025494
Python
Python (3.8.2)
py
Runtime Error
32
9068
234
n=int(input()) if n<6:print(int(n>2));quit() M=10**9+7 ln,hn,dp=n-6,n-5,2 s=n-4 n,d=n-5,1 while n: for i in range(3):n=(n*ln)%M;ln-=1 for i in range(2):n=(n*pow(hn,-1,M))%M;hn-=1 d=(d*pow(dp,-1,M))%M;dp+=1 s=(s+n*d)%M print(s)
s843042687
p02555
u240444124
1600025181
Python
Python (3.8.2)
py
Runtime Error
30
9224
232
n=int(input()) if n<6:print(int(n>2));quit() M=10**9+7 ln,hn,dp=n-6,n-5,2 s=0 n,d=n-5,1 while n: for i in range(3):n=(n*ln)%M;ln-=1 for i in range(2):n=(n*pow(hn,-1,M))%M;hn-=1 d=(d*pow(dp,-1,M))%M;dp+=1 s=(s+n*d)%M print(s)
s834808175
p02555
u240444124
1600025118
Python
Python (3.8.2)
py
Runtime Error
23
9048
232
n=int(input()) if n<6:print(int(n>2));quit() M=10**9+7 ln,hn,dp=n-6,n-5,2 s=0 n,d=n-5,1 while n: for i in range(3):n=(n*ln)%M;ln-=1 for i in range(2):n=(n*pow(hn,-1,M))%M;hn-=1 d=(d*pow(dp,-1,M))%M,dp+=1 s=(s+n*d)%M print(s)
s575366343
p02555
u431573188
1600025001
Python
PyPy3 (7.3.0)
py
Runtime Error
112
68524
221
S = int(input()) mod = 10**9+7 table = [1]*(S+1) table[0] = 0 table[1] = 0 table[2] = 0 for s in range(6,S+1): for i in range(3,s-2): table[s] += table[i] table[s] %= mod print(table[S]%mod)
s116559512
p02555
u098012509
1600024784
Python
PyPy3 (7.3.0)
py
Runtime Error
100
68412
380
import sys sys.setrecursionlimit(10 ** 8) input = sys.stdin.readline def main(): S = int(input()) MOD = 10 ** 9 + 7 dp = [1] * (S + 1) dp[0] = 0 dp[1] = 0 dp[2] = 0 for i in range(3, S + 1): for j in range(i - 3, 1, -1): dp[i] += dp[j] dp[i] %= MOD ...
s929116005
p02555
u029000441
1600024694
Python
PyPy3 (7.3.0)
py
Runtime Error
272
68344
1133
def main(): import sys input = sys.stdin.readline sys.setrecursionlimit(10**7) from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq ...
s113527313
p02555
u792078574
1600024692
Python
Python (3.8.2)
py
Runtime Error
305
9408
438
from itertools import accumulate MOD = 10 ** 9 + 7 S = int(input()) # dp[a][b]: 長さaで、合計bである数列の数 dp = [0] * (S+4) dp[0] = 1 acc = list(accumulate(dp)) acc[-1] = acc[-2] = acc[-3] = 0 ans = 0 for a in range(700): ndp = [] for b in range(S+1): ndp.append(acc[b-3] % MOD) ans += ndp[S] ans %= MOD ...
s915265265
p02555
u764066313
1600024586
Python
Python (3.8.2)
py
Runtime Error
28
8892
584
import sys sys.setrecursionlimit(10**7) def input(): return sys.stdin.readline()[:-1] mod = 10**9 + 7 def readInt():return int(input()) def readIntList():return list(map(int,input().split())) def readStringList():return list(input()) def readStringListWithSpace():return list(input().split()) def readString():return in...
s206357866
p02555
u144913062
1600024586
Python
PyPy3 (7.3.0)
py
Runtime Error
190
69160
285
from itertools import accumulate S = int(input()) mod = 10**9 + 7 dp = [0] * (S + 1) dp[0] = 1 ans = 0 for i in range(S): cum = list(accumulate(dp)) for j in range(S, 2, -1): dp[j] = cum[j-3] % mod dp[0] = dp[1] = dp[2] = 0 ans = (ans + dp[S]) % mod print(ans)
s889607048
p02555
u827202523
1600024535
Python
Python (3.8.2)
py
Runtime Error
46
10508
1434
import sys import re import random import math import copy from heapq import heappush, heappop, heapify from functools import cmp_to_key from bisect import bisect_left, bisect_right from collections import defaultdict, deque, Counter # sys.setrecursionlimit(1000000) # input aliases input = sys.stdin.readline getS = la...
s050459252
p02555
u719840207
1600024494
Python
Python (3.8.2)
py
Runtime Error
25
9160
120
s=int(input()) ans=0 wakeru=0 while s>0: s=s-3 ans=ans+cmb(s+wakeru,wakeru,p) wakeru+=1 print(ans%(10**9+7))
s452137643
p02555
u877470159
1600024490
Python
PyPy3 (7.3.0)
py
Runtime Error
112
68484
468
import sys input=sys.stdin.readline s=int(input()) INF=10**9+7 def modcomb(n,k,m): fac=[0]*(n+1) finv=[0]*(n+1) inv=[0]*(n+1) fac[0]=fac[1]=1 finv[0]=finv[1]=1 inv[1]=1 for i in range(2,n+1): fac[i]=fac[i-1]*i%m inv[i]=m-inv[m%i]*(m//i)%m finv[i]=finv[i-1]*inv[i]%m...
s523927768
p02555
u054274920
1600024440
Python
PyPy3 (7.3.0)
py
Runtime Error
91
68620
206
S=int(input()) A=[0 for i in range(S+1)] B=[0 for i in range(S+1)] A[3]=1 B[3]=1 A[4]=1 B[4]=2 A[5]=1 B[5]=3 for i in range(6,S+1): A[i]=(B[i-3]+1)%(10**9+7) B[i]=(B[i-1]+A[i])%(10**9+7) print(A[S])
s480410289
p02555
u607075479
1600024322
Python
PyPy3 (7.3.0)
py
Runtime Error
176
68736
976
import sys import math from collections import deque sys.setrecursionlimit(1000000) MOD = 10 ** 9 + 7 input = lambda: sys.stdin.readline().strip() NI = lambda: int(input()) NMI = lambda: map(int, input().split()) NLI = lambda: list(NMI()) SI = lambda: input() def make_grid(h, w, num): return [[int(num)] * w for _ in...
s273816650
p02556
u644265148
1600716578
Python
Python (3.8.2)
py
Runtime Error
439
24500
298
n = int(input()) z_vec = [0] * n w_vec = [0] * n for i in range(0, n + 1): line = input() tmp = line.split() z_vec[i] = int(tmp[0]) + int(tmp[1]) w_vec[i] = int(tmp[0]) - int(tmp[1]) z_ans = max(z_vec) - min(z_vec) w_ans = max(w_vec) - min(w_vec) print(f'{max(z_ans, w_ans)}')
s905831159
p02556
u644265148
1600716320
Python
Python (3.8.2)
py
Runtime Error
429
24492
282
n = int(input()) z_vec = [0] * n w_vec = [0] * n for i in range(0, n + 1): tmp = input().split() z_vec[i] = int(tmp[0]) + int(tmp[1]) w_vec[i] = int(tmp[0]) - int(tmp[1]) z_ans = max(z_vec) - min(z_vec) w_ans = max(w_vec) - min(w_vec) print(f'{max(z_ans, w_ans)}')
s177137192
p02556
u548272916
1600629106
Python
Python (3.8.2)
py
Runtime Error
2213
214592
359
n = int(input()) x = [] y = [] distance = [] for i in range(n): x1, y1 = input().split() x1 = int(x1) y1 = int(y1) x.append(x1) y.append(y1) for i in range(len(x)): for j in range(i+1,len(x)): temp = abs(x[i] - x[j]) + abs(y[i] - y[j]) distance.append(temp) max = distance[0] if distance[i-...
s948522675
p02556
u548272916
1600627492
Python
Python (3.8.2)
py
Runtime Error
653
48516
406
n = int(input()) x = [] y = [] distance = [] for i in range(n): x1, y1 = input().split() x1 = int(x1) y1 = int(y1) x.append(x1) y.append(y1) for i in range(len(x)-1): for j in range(i, len(x)-1): temp = abs(x[i] - x[j+i]) + abs(y[i] - y[j+i]) distance.append(temp) max = distance[0] for i in...
s295162540
p02556
u699522269
1600547994
Python
Python (3.8.2)
py
Runtime Error
27
8980
155
N,X,M = map(int,input().split()) dps = [0,X%M]+[0 for i in range(N)] rt = 0 for i in range(2,N+1): dps[i] = (dps[i-1]**2)%M rt+= dps[i] print(sum(dps))
s941331231
p02556
u699522269
1600547972
Python
Python (3.8.2)
py
Runtime Error
28
9184
154
N,X,M = map(int,input().split()) dps = [0,X%M]+[0 for i in range(N)] rt = 0 for i in range(2,N+1): dps[i] = (dps[i-1]**2)%M rt+= dp[i] print(sum(dps))
s689064981
p02556
u337264920
1600540789
Python
PyPy3 (7.3.0)
py
Runtime Error
113
74292
437
# -*- coding: utf-8 -*- # E import sys from collections import defaultdict, deque from heapq import heappush, heappop import math import bisect import numpy as np input = sys.stdin.readline # 再起回数上限変更 # sys.setrecursionlimit(1000000) n = int(input()) d1 = [] * n d2 = [] * n for i in range(n): x, y = map(int, in...
s226122621
p02556
u231570044
1600517663
Python
PyPy3 (7.3.0)
py
Runtime Error
158
74696
1305
from dataclasses import dataclass from operator import itemgetter, attrgetter @dataclass class P: x: float y: float def __add__(self, p: P): return P(self.x + p.x, self.y + p.y) def __sub__(self, p: P): return P(self.x - p.x, self.y - p.y) def dot(self, p: P): return (self.x*p.x + self.y*p.y) d...