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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
s017226595 | p04015 | u879870653 | 1561398906 | Python | PyPy3 (2.4.0) | py | Runtime Error | 420 | 96092 | 505 | N,A = map(int,input().split())
X = list(map(int,input().split()))
ma = max(X)
dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 1
for i in range(1,N+1) :
for k in range(i+1) :
for s in range(ma*N+1) :
if (k >= 1) and (s >= X[i-1]) :
dp... |
s102355855 | p04015 | u879870653 | 1561398881 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 62576 | 505 | N,A = map(int,input().split())
X = list(map(int,input().split()))
ma = max(X)
dp = [[[0 for s in range(ma*N+1)] for k in range(N+1)] for i in range(N+1)]
dp[0][0][0] = 1
for i in range(1,N+1) :
for k in range(i+1) :
for s in range(ma*N+1) :
if (k >= 1) and (s >= X[i-1]) :
dp... |
s799649835 | p04015 | u879870653 | 1561396521 | Python | PyPy3 (2.4.0) | py | Runtime Error | 468 | 96476 | 566 | N,A = map(int,input().split())
X = list(map(int,input().split()))
ma = max(X)
dp = [[[0 for s in range(N*ma+1)] for k in range(N+1)] for j in range(N+1)]
dp[0][0][0] = 1
for j in range(1,N+1) :
for k in range(N+1) :
for s in range(N*ma+1) :
if s < X[j-1] :
dp[j][k][s] = dp[j-... |
s740304520 | p04015 | u879870653 | 1561396407 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 58488 | 594 | N,A = map(int,input().split())
X = list(map(int,input().split()))
ma = max(X)
dp = [[[0 for s in range(N*ma+1)] for k in range(N+1)] for j in range(N+1)]
dp[0][0][0] = 1
for j in range(1,N+1) :
for k in range(N+1) :
for s in range(N*ma+1) :
if (j >= 1) and (s < X[j-1]) :
dp[j... |
s303402867 | p04015 | u777923818 | 1560840814 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 682 | from math import sqrt, factorial
from sys import setrecursionlimit
setrecursionlimit(10000000)
def inpl(): return list(map(int, input().split()))
N = int(input())
S = int(input())
RN = int(sqrt(N)) + 1
RN += ((RN+1)**2 == N)
def func(b, N):
if b <= 1:
return -1
tmp = 0
while N:
N, d = div... |
s117310057 | p04015 | u864197622 | 1558548390 | Python | Python (3.4.3) | py | Runtime Error | 49 | 3064 | 429 | N, A = map(int, input().split())
X = [int(a) for a in input().split()]
PO = [x-A for x in X if x > A]
NE = [A-x for x in X if x < A]
ZE = N - len(PO) - len(NE)
Y = [1] + [0] * 3000
Z = [1] + [0] * 3000
for i in PO:
for j in range(len(Y) - A)[::-1]:
Y[i+j] += Y[j]
for i in NE:
for j in range(len(Z) - A... |
s606024154 | p04015 | u864197622 | 1558548350 | Python | Python (3.4.3) | py | Runtime Error | 43 | 3064 | 433 | N, A = map(int, input().split())
X = [int(a) for a in input().split()]
PO = [x-A for x in X if x > A]
NE = [A-x for x in X if x < A]
ZE = N - len(PO) - len(NE)
Y = [1] + [0] * (N*50)
Z = [1] + [0] * (N*50)
for i in PO:
for j in range(len(Y) - A)[::-1]:
Y[i+j] += Y[j]
for i in NE:
for j in range(len(Z)... |
s792306931 | p04015 | u172386990 | 1557445467 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 779 | import itertools
import pandas as pd
N, A = map(int, input().rstrip().split())
X = list(map(int, input().rstrip().split()))
def isA_erase(X):
"""
erase A in X and count items
input
X: input list
output
X: erased list
count: erase item num
"""
erase_count = 0
while A in X:
... |
s367172623 | p04015 | u969190727 | 1557112800 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 61532 | 366 | import numpy as np
n,a=map(int,input().split())
X=[int(i) for i in input().split()]
tot,m=sum(X),max(X)
DP=np.zeros((n+1,n+1,tot+1),dtype=int)
DP[0][0][0]=1
for i in range(1,n+1):
for j in range(i+1):
lim=min(j*m,tot)+1
for s in range(lim):
DP[i][j][s]=DP[i-1][j][s]+DP[i-1][j-1][s-X[i-1]]
ans=0
for j in... |
s076517470 | p04015 | u969190727 | 1557112231 | Python | PyPy3 (2.4.0) | py | Runtime Error | 174 | 38896 | 328 | import numpy as np
n,a=map(int,input().split())
X=[int(i) for i in input().split()]
DP=np.zeros((n+1,n+1,50*n+1),dtype=int)
DP[0][0][0]=1
for i in range(1,n+1):
for j in range(i+1):
for s in range(50*j+1):
DP[i][j][s]=DP[i-1][j][s]+DP[i-1][j-1][s-X[i-1]]
ans=0
for j in range(1,n+1):
ans+=DP[n][j][j*a]
pri... |
s228798421 | p04015 | u310678820 | 1556909883 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3060 | 261 | def dp(k, value):
if k==n:
if value==0:
return 1
else:
return 0
if memo[k][value]>=0:
return memo[k][value]
memo[k][value]=dp(k+1, value+x[k])+dp(k+1, value)
return memo[k][value]
print(dp(0, 0)-1) |
s791794132 | p04015 | u310678820 | 1556909657 | Python | Python (3.4.3) | py | Runtime Error | 26 | 3116 | 380 | n, a =map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
memo=[[-1]*110 for i in range(60)]
def dp(k, value):
if k==n:
if value==0:
return 1
else:
return 0
if memo[k][value]>0:
return memo[k][value]
memo[k][value]=dp(k+1, value+x[k]... |
s636476171 | p04015 | u310678820 | 1556909632 | Python | Python (3.4.3) | py | Runtime Error | 48 | 3764 | 416 | n, a =map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
memo=[[-1]*110 for i in range(60)]
def dp(k, value):
if k==n:
if value==0:
return 1
else:
return 0
if memo[k][value]>0:
return memo[k][value]
memo[k][value]=dp(k+1, value+x[k]... |
s852695538 | p04015 | u649373416 | 1556857129 | Python | Python (3.4.3) | py | Runtime Error | 17 | 2940 | 268 | import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = [int(it) for it in input().split()]
li = [int(it) for it in input().split()]
for i in li:
hi_ = hi.copy()
hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
s+=hi[(i+1)*a,i+1]
print (s)
|
s878284718 | p04015 | u649373416 | 1556857083 | Python | PyPy3 (2.4.0) | py | Runtime Error | 163 | 38256 | 268 | import numpy as np
hi = np.zeros((5000,60),np.int64)
hi[0,0]=1
n,a = [int(it) for it in input().split()]
li = [int(it) for it in input().split()]
for i in li:
hi_ = hi.copy()
hi[i:-1,1:]+=hi_[:-1-i,:-1]
s = 0
for i in range(n):
s+=hi[(i+1)*a,i+1]
print (s)
|
s819380432 | p04015 | u794543767 | 1555053380 | Python | Python (3.4.3) | py | Runtime Error | 19 | 3064 | 755 | import itertools
import math
n,s = [int(input()) for _ in range(2)]
def n_base_sum(n,b):
if(int(n/b)):
return n_base_sum(int(n/b),b)+n%b
else:
return n%b
def search_p(n,s):
for p in range(math.ceil(math.sqrt(n))+1,0,-1):
b = (n-s)//p + 1
q = n - p*b
if p+q ==s and... |
s516427249 | p04015 | u371467115 | 1554508192 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 192 | n,a=map(int, input().split())
x=list(map(int, input().split()))
x=[i-a for i in x]
d={0:1}
for i in x:
for j,k in list(d.items()):
d[i+.j]=d.get(i+j,0)+k
print(d[0]-1)
#sample code |
s914954286 | p04015 | u001024152 | 1554153744 | Python | Python (3.4.3) | py | Runtime Error | 328 | 3064 | 325 | N,A = map(int, input().split())
x = list(map(int, input().split()))
assert(1<=N<=16)
ans = 0
for i in range(2**N):
# print(bin(i))
s = 0
cnt = 0
for keta in range(N):
if (i>>keta)%2==1:
s += x[keta]
cnt += 1
if cnt==0: continue
if s/cnt==A:
ans += 1
print... |
s207934036 | p04015 | u932465688 | 1553745313 | Python | PyPy3 (2.4.0) | py | Runtime Error | 434 | 93660 | 645 | N,A = map(int,input().split())
X = [0]+list(map(int,input().split()))
dp = []
for i in range(N+1):
K = []
for j in range(N+1):
J = [0]*(N*max(X)+1)
K.append(J)
dp.append(K)
for j in range(N+1):
for k in range(N+1):
for s in range(N*max(X)+1):
if j >= 1:
if s < X[j]:
dp[j][k][... |
s236313319 | p04015 | u932465688 | 1553745092 | Python | PyPy3 (2.4.0) | py | Runtime Error | 444 | 93660 | 641 | N,A = map(int,input().split())
X = [0]+list(map(int,input().split()))
dp = []
for i in range(N+1):
K = []
for j in range(N+1):
J = [0]*(N*max(X)+1)
K.append(J)
dp.append(K)
for j in range(N+1):
for k in range(N+1):
for s in range(N*max(X)+1):
if j >= 1:
if s < X[j]:
dp[j][k][... |
s173703969 | p04015 | u089032001 | 1550460907 | Python | Python (3.4.3) | py | Runtime Error | 2106 | 38504 | 773 | from collections import Counter
def inpl():
return list(map(int, input().split()))
N, A = inpl()
X = inpl()
cX = Counter(X)
dp = [[[0 for _ in range(N * max(X) + 1)] for j in range(i + 1)]
for i in range(N + 1)]
dp[0][0][0] = 1
for i in range(1, N + 1):
x = X[i - 1]
for j in range(i + 1):
... |
s113674820 | p04015 | u368780724 | 1545134877 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 611 | def inpl(): return [int(i) for i in input().split()]
def hmd(a, b):
ctr = -1
while H[ctr+1][a] < b:
ctr += 1
vn = H[ctr][a]
if (vn == b and ctr == 0) or ctr == -1:
return 1
return 2**ctr + hmd(vn,b)
N = int(input())
x = inpl() + [10**10]
L = int(input())
H = []
G = [N-1]*N
b = 0
for ... |
s024734626 | p04015 | u785989355 | 1541749203 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 70900 | 627 |
N,A = list(map(int,input().split()))
x = list(map(int,input().split()))
dp = [[[0 for i in range(N+1)] for j in range(N)] for k in range(N*A+1)]
dp[0][0][0] = 1
dp[x[0]][0][1] = 1
for i in range(N-1):
for j in range(N*A+1):
if j-x[i+1]>=0:
for k in range(0,N+1):
if k!=0:
... |
s564947666 | p04015 | u516291518 | 1539843654 | Python | Python (3.4.3) | py | Runtime Error | 18 | 3064 | 538 | def digit_sum(n, s):
if s > n:
return -1
if s == n:
return n + 1
b = 2
while b**2 < n:
if f(b, n) == s:
return b
b += 1
p = int(n * 0.5)
while p > 1:
b = (n - s) // p + 1
if b > 1 and f(b, n) == s:
return b
... |
s339405170 | p04015 | u516291518 | 1539842918 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 558 | def digit_sum(n, s):
if s > n:
return -1
if s == n:
return n + 1
b = 2
while b**2 < n:
if f(b, n) == s:
return b
b += 1
p = 1
while p**2 < n:
b = (n - s) // p + 1
if b <= 1:
break
if f(b, n) == s:
ret... |
s796739602 | p04015 | u099918199 | 1539422189 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 56052 | 565 | n,a = map(int, input().split())
list_x = list(map(int, input().split()))
dp = [ [[0] * (sum(list_x) + 1) for i in range(n+1)] for j in range(n+1)]
for j in range(n+1):
for k in range(n+1):
for s in range(sum(list_x) + 1):
if j == 0 and k == 0 and s == 0:
dp[j][k][s] = 1
elif j >= 1 and s < list_x[j - 1]:
... |
s672133769 | p04015 | u099918199 | 1539421937 | Python | Python (3.4.3) | py | Runtime Error | 154 | 11636 | 551 | n,a = map(int, input().split())
list_x = list(map(int, input().split()))
dp = [ [[0] * 100 for i in range(100)] for j in range(100)]
for j in range(n+1):
for k in range(n+1):
for s in range(sum(list_x) + 1):
if j == 0 and k == 0 and s == 0:
dp[j][k][s] = 1
elif j >= 1 and s < list_x[j - 1]:
dp[j][k][s]... |
s491476587 | p04015 | u333945892 | 1537649736 | Python | PyPy3 (2.4.0) | py | Runtime Error | 224 | 48108 | 911 | from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,datetime
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
def inpl(): return list(map(int, input().split()))
def inpls(): return list(input().split())
N = int(input())
xx = inpl()
L = int(input())
K = N.bit_leng... |
s206690921 | p04015 | u498486375 | 1535242562 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 402 | N,A=map(int,input().split())
a=list(map(int, input().split()))
def hiku(kazu):
return kazu-A
b=[]
for i in range(N):
b.append(hiku(a[i]))
X=max(a)
def hai(s,t):
if s==0 and t==NX:
return 1
elif s>=1 and (t-b[s]<0 or t-b[s]>2NX):
return hai(s-1,t)
elif s>=1 and (0<=t-b[s]<=2NX):
... |
s175099770 | p04015 | u403301154 | 1531981130 | Python | PyPy3 (2.4.0) | py | Runtime Error | 468 | 96988 | 447 | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [[[0 for _ in range(n*max(x)+1)] for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for j in range(1, n+1):
for k in range(n+1):
for s in range(n*max(x)+1):
if s<x[j-1]:
dp[j][k][s] = dp[j-1][k][s]
elif k>=... |
s588088250 | p04015 | u403301154 | 1531979589 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 56820 | 447 | n, a = list(map(int, input().split()))
x = list(map(int, input().split()))
dp = [[[0 for _ in range(n*max(x)+1)] for _ in range(n+1)] for _ in range(n+1)]
dp[0][0][0] = 1
for j in range(1, n+1):
for k in range(n+1):
for s in range(n*max(x)+1):
if s<x[j-1]:
dp[j][k][s] = dp[j-1][k][s]
elif k>=... |
s798233782 | p04015 | u858136677 | 1519492728 | Python | Python (3.4.3) | py | Runtime Error | 2107 | 65108 | 513 | n,a = map(int,input().split())
x = list(map(int,input().split()))
x.insert(0,0)
xmax = max(x)
table = [[[0 for s in range(n*xmax+1)]for k in range(n+1)]for j in range(n+1)]
table[0][0][0] = 1
for s in range(n*xmax+1):
for k in range(n+1):
for j in range(1,n+1):
if s < x[j]:
table[j][k][s] = table[j-1][k][s]
... |
s110988379 | p04015 | u858136677 | 1519492555 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 65108 | 511 | n,a = map(int,input().split())
x = list(map(int,input().split()))
x.insert(0,0)
xmax = max(x)
table = [[[0 for s in range(n*xmax+1)]for k in range(n+1)]for j in range(n+1)]
table[0][0][0] = 1
for s in range(n*xmax+1):
for k in range(n+1):
for j in range(1,n+1):
if s < x[j]:
table[j][k][s] = table[j-1][k][s]
... |
s869032778 | p04015 | u667084803 | 1511607072 | Python | PyPy3 (2.4.0) | py | Runtime Error | 511 | 96124 | 379 | N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0 for i in range(50*50)] for j in range(N+1) ]for k in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
for j in range(N+1):
for k in range(50*50):
dp[i][j][k]=dp[i-1][j][k]
if x[i-1]<= k and j>0: dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]]
a... |
s624300571 | p04015 | u667084803 | 1511606965 | Python | PyPy3 (2.4.0) | py | Runtime Error | 511 | 96348 | 379 | N,A=map(int,input().split())
x=list(map(int,input().split()))
dp=[[[0 for i in range(50*50)] for j in range(N+1) ]for k in range(N+1)]
dp[0][0][0]=1
for i in range(1,N+1):
for j in range(N+1):
for k in range(50*50):
dp[i][j][k]=dp[i-1][j][k]
if x[i-1]<= k and j>0: dp[i][j][k]+=dp[i-1][j-1][k-x[i-1]]
a... |
s292690375 | p04015 | u145790740 | 1478381675 | Python | Python (2.7.6) | py | Runtime Error | 16 | 2568 | 424 | n = int(raw_input())
s = int(raw_input())
if n < s:
print -1
elif s == 1:
print n
else:
ans_list = []
for i in xrange(n/2, 1, -1):
tmp_n = n
total = 0
while tmp_n / i > 0:
total += tmp_n % i
tmp_n /= i
total += tmp_n
print i, total
... |
s776358735 | p04015 | u862517767 | 1472649376 | Python | Python (3.4.3) | py | Runtime Error | 44 | 3136 | 334 | n,a=map(int,input().split())
x=[0]+[i-a for i in map(int,input().split())]
d={}
def f(i):
if i==n+1:
return c([0])
if i in d:
return d[i]
d[i]={}
for j in range(i+1,n+2):
for k,v in f(j).items():
d[i].setdefault(x[i]+k,0)
d[i][x[i]+k]+=v
return d[i]
pr... |
s719583575 | p04015 | u195451595 | 1472437008 | Python | PyPy2 (5.6.0) | py | Runtime Error | 73 | 9072 | 1545 | n = int(raw_input())
har = map(int , raw_input().split())
L = int(raw_input())
q = int(raw_input())
from collections import deque
def bfs(g, start):
queue, enqueued = deque([(None, start)]), set([start])
while queue:
parent, n = queue.popleft()
yield parent, n
new = set(g[n]) - enqueue... |
s105955655 | p04015 | u601018334 | 1472435025 | Python | Python (3.4.3) | py | Runtime Error | 41 | 3064 | 260 | import itertools
N, K = list(map(int, input().split()))
x = list(map(int, input().split()))
count = 0
for i in range(N):
p = itertools.combinations(x,i+1)
p_ave = [sum(j)/i for j in p]
count += len(list(filter(lambda n:n==K, p_ave)))
print(count)
|
s256184376 | p04015 | u379305729 | 1472434791 | Python | Python (3.4.3) | py | Runtime Error | 333 | 3316 | 655 |
line1=input().split()
n=int(line1[0])
a=int(line1[1])
nums=input().split()
for i in range(n):
nums[i]=int(nums[i])-a
works={}
print (works)
s=0
for x in nums:
if x>=0:
for i in range(50*n,-50*n, -1):
try:
works[i]+=works[i-x]
except:
try:
... |
s356927959 | p04015 | u509661905 | 1472434073 | Python | PyPy3 (2.4.0) | py | Runtime Error | 535 | 48732 | 550 | #!/usr/bin/env pypy3
EPS = 1e-9
MAX_N = 16
def isclose(x, y, tol=EPS):
return abs(x - y) <= EPS
def mean(xs):
n = len(xs)
return sum(xs) / n
def count_combinations(n, a, xs):
ans = 0
for s in range(1, 1 << n):
m = mean([xs[i] for i in range(n) if s & (1 << i)])
if isclose(a, m... |
s137630237 | p04015 | u509661905 | 1472433762 | Python | Python (3.4.3) | py | Runtime Error | 91 | 5892 | 498 | #!/usr/bin/env python3
import array
import math
import statistics
MAX_N = 16
def count_combinations(n, a, xs):
ans = 0
for s in range(1, 1 << n):
m = statistics.mean(xs[i] for i in range(n) if s & (1 << i))
if math.isclose(a, m):
ans += 1
return ans
def main():
n, a = ... |
s055757851 | p04015 | u478870821 | 1472432931 | Python | Python (3.4.3) | py | Runtime Error | 856 | 3188 | 317 | from sys import exit
def reads():
return [int(x) for x in input().split()]
(N, A) = reads()
x = reads()
assert(N <= 16)
count = 0
for b in range(1, 1<<N):
bits = [bool(b&(1 << i)) for i in range(N)]
if sum(x[i] for i in range(N) if bits[i]) == A * sum(bits):
count += 1
# print(bits)
print(count)
|
s784876841 | p04016 | u021548497 | 1600357172 | Python | Python (3.8.2) | py | Runtime Error | 2206 | 9360 | 648 | import sys
input = sys.stdin.readline
def digit_sum(n, b):
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(input())
s = int(input())
ans = -1
if n == s:
ans = n + 1
else:
for b in range(2, int(n**0.5) + 1):
if di... |
s357490570 | p04016 | u021548497 | 1600353903 | Python | PyPy3 (7.3.0) | py | Runtime Error | 2209 | 116652 | 1646 | import sys
input = sys.stdin.readline
def digit_sum(n, b):
if b == 1:
return n
res = 0
while n > 0:
res += n % b
n //= b
return res
def main():
n = int(input())
s = int(input())
ans = -1
if n < s:
ans = -1
elif n == s:
ans = n + 1
else:
... |
s385647200 | p04016 | u021548497 | 1600353248 | Python | PyPy3 (7.3.0) | py | Runtime Error | 183 | 124792 | 1457 | import sys
input = sys.stdin.readline
def digit_sum(n, b):
if n < b:
return n
res = n % b + digit_sum(n // b, b)
return res
def main():
n = int(input())
s = int(input())
if n < s:
ans = -1
elif n == s:
ans = n + 1
else:
key = []
start, first = n,... |
s856024886 | p04016 | u490642448 | 1595750964 | Python | PyPy3 (7.3.0) | py | Runtime Error | 139 | 74944 | 565 | n = int(input())
s = int(input())
if(n<s):
print(-1)
exit()
elif(n==s):
print(n+1)
exit()
elif(s==1):
print(n+1)
exit()
lim = 10**6
for i in range(2,lim+1):
tmp = 0
x = n
while(x > 0):
tmp += x%i
x //= i
if(tmp==s):
print(i)
exit()
#2桁
ns = n-s
i... |
s835378324 | p04016 | u630941334 | 1589226928 | Python | PyPy3 (2.4.0) | py | Runtime Error | 677 | 246300 | 767 | import sys
MAX = 1000000
def digit_sum(n, b):
if n == 0:
return 0
else:
return digit_sum(n // b, b) + n % b
def main():
n = int(input())
s = int(input())
if n < s:
print(-1)
sys.exit()
ans = -1
for b in range(2, min(n + 1, MAX) + 1):
sm = digit... |
s216534131 | p04016 | u630941334 | 1589226809 | Python | PyPy3 (2.4.0) | py | Runtime Error | 423 | 55024 | 766 | import sys
MAX = 1000000
def digit_sum(n, b):
if n == 0:
return 0
else:
return digit_sum(n // b, b) + n % b
def main():
n = int(input())
s = int(input())
if n < s:
print(-1)
sys.exit()
ans = -1
for b in range(2, min(n + 1, MAX) + 1):
sm = digit... |
s984428295 | p04016 | u964299793 | 1585999745 | Python | Python (3.4.3) | py | Runtime Error | 402 | 3064 | 620 | n=int(input())
s=int(input())
import math
#first solve assuming b<=sqrt(n)
sq=int(math.sqrt(n))
for b in range(2,sq+2):
num=n
su=0
while num>=b:
su+=num%b
num//=b
su+=num
if su==s:
print(b)
exit()
#answer not found yet so check in the divisors of n-s
b=1
nn=n-s
if nn... |
s039184825 | p04016 | u606045429 | 1581138588 | Python | Python (3.4.3) | py | Runtime Error | 1496 | 689896 | 444 | import sys
sys.setrecursionlimit(1000000)
def f(b, n):
return n if n < b else n % b + f(b, n // b)
def solve():
N, S = map(int, open(0))
if N == S:
return N + 1
sqr = int(N ** 0.5)
for b in range(2, sqr + 1):
if f(b, N) == S:
return b
M = N - S
for p in reve... |
s729753332 | p04016 | u606045429 | 1581138442 | Python | Python (3.4.3) | py | Runtime Error | 439 | 3940 | 401 | def f(b, n):
return n if n < b else n % b + f(b, n // b)
def solve():
N, S = map(int, open(0))
if N == S:
return N + 1
sqr = int(N ** 0.5)
for b in range(2, sqr + 1):
if f(b, N) == S:
return b
M = N - S
for p in reversed(range(1, sqr + 1)):
b = M // p... |
s676892214 | p04016 | u992875223 | 1578174629 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3064 | 411 | N = int(input())
S = int(input())
def f(B, N):
X, res = N, 0
while 0 < X:
res += X % B
X //= B
return res
if N == S:
print(N + 1)
exit()
for i in range(2, N):
if N < i * i: break
if f(i, N) == S:
print(i)
exit()
for i in range(1, N):
if N < i * i: bre... |
s719252230 | p04016 | u794173881 | 1575945087 | Python | PyPy3 (2.4.0) | py | Runtime Error | 364 | 52720 | 435 | def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
n = int(input())
s = int(input())
for i in range(2, int(n**0.5) + 3):
if f(i, n) == s:
print(i)
exit()
ans = 10**12
for k in range(1, int(n**0.5) + 3):
if (n-s) % k != 0 or n-s < 0:
continue
b ... |
s681960919 | p04016 | u892251744 | 1569858927 | Python | PyPy3 (2.4.0) | py | Runtime Error | 238 | 40812 | 620 | import math
n = int(input())
s = int(input())
if n == 1:
if s == 1:
print(2)
else:
print(-1)
exit()
if n == s:
print(n + 1)
exit()
if n < s:
print(-1)
exit()
def ds(N, b):
ret = 0
while True:
N, mod = divmod(N, b)
ret += mod
if N == 0:
... |
s537778833 | p04016 | u892251744 | 1569858710 | Python | PyPy3 (2.4.0) | py | Runtime Error | 244 | 40812 | 584 | import math
n = int(input())
s = int(input())
if n == 1:
if s == 1:
print(2)
else:
print(-1)
exit()
if n == s:
print(n + 1)
exit()
def ds(N, b):
ret = 0
while True:
N, mod = divmod(N, b)
ret += mod
if N == 0:
return ret
for i in rang... |
s449177735 | p04016 | u677523557 | 1569771962 | Python | Python (3.4.3) | py | Runtime Error | 17 | 3064 | 497 | import math
N = int(input())
S = int(input())
L = N-S
def search(b, n=N):
ans = 0
while n >= b:
ans += n%b
n //= b
ans += n
return ans
s
if L < 0:
print(-1)
elif L == 0:
print(1)
else:
P = []
for l in range(1, int(math.sqrt(L))+1):
if L%l == 0:
P.app... |
s999063394 | p04016 | u392319141 | 1569545227 | Python | Python (3.4.3) | py | Runtime Error | 474 | 3944 | 470 | N = int(input())
S = int(input())
if N == S:
print(N + 1)
exit()
if S == 1:
print(N)
exit()
if S > N:
print(-1)
exit()
def f(b, n):
if n < b:
return n
return f(b, n // b) + n % b
ans = float('inf')
for b in range(2, int(N**0.5) + 10):
if f(b, N) == S:
ans = min(... |
s849317443 | p04016 | u777923818 | 1560839701 | Python | Python (3.4.3) | py | Runtime Error | 347 | 3188 | 625 | from math import sqrt, factorial
from sys import setrecursionlimit
setrecursionlimit(100000)
def inpl(): return list(map(int, input().split()))
N = int(input())
S = int(input())
RN = int(sqrt(N))
RN += ((RN+1)**2 == N)
def func(b, N):
tmp = 0
while N:
N, d = divmod(N, b)
tmp += d
return t... |
s193340103 | p04016 | u497046426 | 1560226118 | Python | Python (3.4.3) | py | Runtime Error | 1616 | 689908 | 595 | import sys
sys.setrecursionlimit(10**9)
def f(b, n):
if n < b:
return n
else:
q, r = divmod(n, b)
return f(b, q) + r
n = int(input())
s = int(input())
if n == s:
print(n+1)
else:
b = 2
while b*b <= n:
if f(b, n) == s:
print(b)
break
... |
s839903864 | p04016 | u497046426 | 1560225997 | Python | Python (3.4.3) | py | Runtime Error | 649 | 12256 | 595 | import sys
sys.setrecursionlimit(10000)
def f(b, n):
if n < b:
return n
else:
q, r = divmod(n, b)
return f(b, q) + r
n = int(input())
s = int(input())
if n == s:
print(n+1)
else:
b = 2
while b*b <= n:
if f(b, n) == s:
print(b)
break
... |
s632650992 | p04016 | u497046426 | 1560225899 | Python | Python (3.4.3) | py | Runtime Error | 602 | 3952 | 553 | def f(b, n):
if n < b:
return n
else:
q, r = divmod(n, b)
return f(b, q) + r
n = int(input())
s = int(input())
if n == s:
print(n+1)
else:
b = 2
while b*b <= n:
if f(b, n) == s:
print(b)
break
b += 1
else:
p = 1
ans... |
s278142455 | p04016 | u409064224 | 1560213707 | Python | Python (3.4.3) | py | Runtime Error | 18 | 2940 | 518 | def f(b, n):
return n if n<b else f(b,n//b)+(n%b)
n = int(input())
s = int(input())
l = []
if n == 1:
print(-1)
exit()
else if s == 1:
print(n)
exit()
else if n == s:
print(1)
exit()
for i in range(1,11):
l.append(f(10**i,n))
# print(l)
lf,ri = 0,0
for i in range(9):
if l[i] <= s ... |
s132432149 | p04016 | u879309973 | 1555685454 | Python | Python (3.4.3) | py | Runtime Error | 150 | 12508 | 611 | import numpy as np
def f(b, n):
s = 0
while n > 0:
s += n % b
n //= b
return s
INF = int("inf")
def solve(n, s):
if n < s:
return -1
if n == s:
return n+1
m = int(np.sqrt(n)) + 1
for b in range(2, m+1):
if f(b, n) == s:
return b
best =... |
s305411931 | p04016 | u879309973 | 1555682083 | Python | Python (3.4.3) | py | Runtime Error | 416 | 14516 | 573 | import numpy as np
def f(b, n):
if n < b:
return n
else:
n2 = n // b
if n2 == n:
return -1
else:
return f(b, n2) + (n % b)
def solve(n, s):
if s == n:
return n + 1
m = int(np.sqrt(n)) + 1
for b in range(2, m):
if f(b, n) == s:
... |
s152997547 | p04016 | u794543767 | 1555053831 | Python | Python (3.4.3) | py | Runtime Error | 478 | 3064 | 732 | import itertools
import math
n,s = [int(input()) for _ in range(2)]
def n_base_sum(n,b):
if(int(n/b)):
return n_base_sum(int(n/b),b)+n%b
else:
return n%b
def search_p(n,s):
for p in range(math.ceil(math.sqrt(n))+1,0,-1):
b = n //p
q = n % b
if p+q ==s:
... |
s791525984 | p04016 | u794543767 | 1555052909 | Python | Python (3.4.3) | py | Runtime Error | 499 | 3064 | 743 | import itertools
import math
n,s = [int(input()) for _ in range(2)]
def n_base_sum(n,b):
if(int(n/b)):
return n_base_sum(int(n/b),b)+n%b
else:
return n%b
def search_p(n,s):
for p in range(math.ceil(math.sqrt(n))+1,0,-1):
b = (n-s)//p + 1
q = n % b
if p+q ==s:
... |
s038482960 | p04016 | u794543767 | 1555049153 | Python | Python (3.4.3) | py | Runtime Error | 398 | 3064 | 661 | import itertools
import math
n,s = [int(input()) for _ in range(2)]
def calc_s(b,n):
i = 0
s = 0
while(1):
s+= n %b
n = math.floor(n/b)
i+=1
if n ==0:
break
return s
def search_p(n,s):
for p in range(1,math.ceil(math.sqrt(n))+1):
b = n//p
... |
s524511468 | p04016 | u619819312 | 1554947103 | Python | Python (3.4.3) | py | Runtime Error | 443 | 3064 | 478 | n=int(input());s=int(input())
def f(s,t):
c=0
while s!=0:
c+=s%t
s//=t
return c
for i in range(2,int(n**0.5)+1):
if n%(i-1)==s%(i-1):
if f(n,i)==s:
print(i)
break
else:
for i in range(int(n**0.5)+1,0,-1):
if (n-s)%i==0:
b=(n-s)//i+1... |
s371447286 | p04016 | u619819312 | 1554946973 | Python | Python (3.4.3) | py | Runtime Error | 444 | 3188 | 420 | n=int(input());s=int(input())
def f(s,t):
c=0
while s!=0:
c+=s%t
s//=t
return c
for i in range(2,int(n**0.5)+1):
if n%(i-1)==s%(i-1):
if f(n,i)==s:
print(i)
break
else:
for i in range(int(n**0.5)+1,0,-1):
if (n-s)%i==0:
b=(n-s)//i+1... |
s939949902 | p04016 | u619819312 | 1554946777 | Python | Python (3.4.3) | py | Runtime Error | 446 | 3064 | 399 | n=int(input());s=int(input())
def f(s,t):
c=0
while s!=0:
c+=s%t
s//=t
return c
for i in range(2,int(n**0.5)+1):
if n%(i-1)==s%(i-1):
if f(n,i)==s:
print(i)
break
else:
for i in range(int(n**0.5)+1,0,-1):
if (n-s)%i==0:
b=(n-s)//i+1... |
s995831502 | p04016 | u923279197 | 1552762301 | Python | PyPy3 (2.4.0) | py | Runtime Error | 326 | 52208 | 573 | #入力
def f(n, b):
if n < b:
return n
else:
return f(n//b, b) + n % b
n = int(input())
s = int(input())
ans = 0
if s == n:
ans = n + 1
else:
for b in range(2, int(n**(1/2)) + 2):
if f(n, b) == s:
ans = b
break
if ans == 0:
for p in range(1, int... |
s563332006 | p04016 | u923279197 | 1552762220 | Python | PyPy3 (2.4.0) | py | Runtime Error | 316 | 50928 | 589 | #入力
def f(n, b):
if n < b:
return n
else:
return f(n//b, b) + n % b
n = int(input())
s = int(input())
ans = 0
if s == n:
ans = n + 1
else:
for b in range(2, int(n**(1/2)) + 2):
if f(n, b) == s:
ans = b
break
if ans == 0:
for p in range(1,... |
s804886977 | p04016 | u923279197 | 1552747100 | Python | PyPy3 (2.4.0) | py | Runtime Error | 175 | 38384 | 223 | #入力
n = int(input())
s = int(input())
def f(b, n):
if n < b:
return n
else:
return f(b, n//b) + n % b
for i in range(2,n**(0.5)):
if f(i, n) == s:
print(i)
exit()
print(-1) |
s445637505 | p04016 | u218843509 | 1549914723 | Python | Python (3.4.3) | py | Runtime Error | 74 | 3188 | 413 | from math import sqrt
import sys
sys.setrecursionlimit(10**6)
def f(b, n):
if n < b:
return n
else:
return f(b, n // b) + n % b
n = int(input())
s = int(input())
if n < s:
print(-1)
divs = []
for i in range(1, int(sqrt(n-s))+1):
if (n-s)%i == 0:
if i>2:
divs.append(i)
if i != (n-s)//i:
divs.append((... |
s425323079 | p04016 | u559823804 | 1548992867 | Python | Python (3.4.3) | py | Runtime Error | 780 | 3952 | 488 | from math import floor
from math import sqrt
def f(bb,nn):
if(nn<bb): return nn
else: return f(bb,floor(nn/bb))+(nn%bb)
n=int(input())
s=int(input())
if n==s:
print(n+1)
exit()
elif n<s:
print(-1)
exit()
for i in range(2,int(sqrt(n))):
if s==f(i,n):
print(i)
exit... |
s479769546 | p04016 | u785989355 | 1541746952 | Python | Python (3.4.3) | py | Runtime Error | 2108 | 20240 | 622 | import numpy as np
n = int(input())
s = int(input())
flag=False
for i in range(2,int(np.sqrt(n))+1):
score = 0
n1=n
while n1!=0:
score+=(n1%i)
n1=int(n1/i)
if score==s:
flag=True
break
if flag:
print(i)
else:
for i in range(1,int(np.sqrt(n))+1):
b = (n-s... |
s512592900 | p04016 | u562016607 | 1541370913 | Python | Python (3.4.3) | py | Runtime Error | 461 | 3964 | 399 | import math
def f(b,n):
if n<b:
return n
else:
return f(b,n//b)+(n%b)
N=int(input())
S=int(input())
if N==S:
print(N+1)
else:
for b in range(2,int(math.sqrt(N))+2):
if f(b,N)==S:
print(b)
exit()
for p in range(int(math.sqrt(N))+2):
b=(N-S)//(p+... |
s759025854 | p04016 | u620868411 | 1540988765 | Python | Python (3.4.3) | py | Runtime Error | 2104 | 3188 | 391 | # -*- coding: utf-8 -*-
n = int(input())
s = int(input())
if s==n:
print(n+1)
exit()
def f(b,n):
ret = 0
while n>=b:
ret += n%b
n = n//b
return ret+n
b = 2
while b*b<n:
if f(b,n)==s:
print(b)
exit()
b += 1
p = 1
while p*p<n:
q = s - p
b = (n-q)//p
... |
s151537949 | p04016 | u516291518 | 1539840436 | Python | Python (3.4.3) | py | Runtime Error | 601 | 3940 | 520 | def digit_sum(n, s):
if s > n:
return -1
if s == n:
return n + 1
b = 2
while b**2 < n:
if f(b, n) == s:
return b
b += 1
p = 1
while p**2 < n:
b = (n - s) // p + 1
if f(b, n) == s:
return b
p += 1
ret... |
s612614179 | p04016 | u761989513 | 1539123929 | Python | Python (3.4.3) | py | Runtime Error | 629 | 3940 | 424 | def f(b, n):
if n < b:
return n
return f(b, n // b) + n % b
n = int(input())
s = int(input())
if n == s:
print(n + 1)
elif s == 1:
print(n)
else:
for i in range(2, int(n ** .5) + 1):
if f(i, n) == s:
print(i)
exit()
for p in range(2, int(n ** .5) + 1):
... |
s019795200 | p04016 | u858748695 | 1514237446 | Python | Python (3.4.3) | py | Runtime Error | 503 | 3948 | 525 | #!/usr/bin/env python3
import math
def f(b, n):
return n if (n < b) else f(b, n // b) + n % b
n = int(input())
s = int(input())
ans = -1
if n == s:
ans = n + 1
else:
for b in range(2, math.floor(n ** 0.5) + 1):
if f(b, n) == s:
ans = b
break
else:
for p in rang... |
s645387576 | p04016 | u858748695 | 1514235797 | Python | Python (3.4.3) | py | Runtime Error | 291 | 3896 | 508 | #!/usr/bin/env python3
def f(b, n):
return n if (n < b) else f(b, n // b) + n % b
n = int(input())
s = int(input())
sqrt_n = int(n ** 0.5)
ans = -1
if n == s:
ans = n + 1
else:
for b in range(2, sqrt_n + 1):
if f(b, n) == s:
ans = b
break
else:
for p in range(1... |
s699108876 | p04016 | u443010331 | 1473171591 | Python | Python (2.7.6) | py | Runtime Error | 457 | 12676 | 469 | import math
def f(b, n):
if n < b:
return n
return f(b, n/b)+(n%b)
n = input()
s = input()
ans = 1e18
if n == s:
print n+1
sys.exit()
if n < s:
print -1
sys.exit()
for i in range(2,int(math.sqrt(n))+1):
if f(i, n) == s:
ans = min(ans, i);
for p in range(1,int(math.sqrt(n))+... |
s017599546 | p04017 | u306950978 | 1600826036 | Python | Python (3.8.2) | py | Runtime Error | 170 | 41860 | 913 | def main():
import sys
sys.setrecursionlimit(10 ** 6)
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = n.bit_length()
kprv = [[10**10 for i in range(t+1)] for j in range(n)]
for i in range(t):
for j in range(n):
if j + pow... |
s660079122 | p04017 | u306950978 | 1600825608 | Python | PyPy3 (7.3.0) | py | Runtime Error | 3311 | 123336 | 901 | import sys
sys.setrecursionlimit(10 ** 6) # 変更
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
L = int(input())
t = n.bit_length()
prv = [n-1] * n
for i in range(n):
prv[i] = bisect(x,x[i]+L) - 1
kprv = [prv]
S = prv
for i in range(t-1):
kar = [n-1] * n
for j in r... |
s359080295 | p04017 | u306950978 | 1600817177 | Python | PyPy3 (7.3.0) | py | Runtime Error | 3311 | 111700 | 778 | import sys
sys.setrecursionlimit(10 ** 6) # 変更
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[10**10 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + pow(2,i) > n-1:
break
kpr... |
s764113866 | p04017 | u306950978 | 1600816911 | Python | PyPy3 (7.3.0) | py | Runtime Error | 3311 | 109936 | 772 | import sys
sys.setrecursionlimit(10 ** 6) # 変更
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[10**10 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + 2**i > n-1:
break
kprv[j]... |
s657392709 | p04017 | u306950978 | 1600816882 | Python | Python (3.8.2) | py | Runtime Error | 3310 | 91996 | 772 | import sys
sys.setrecursionlimit(10 ** 6) # 変更
from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[10**10 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + 2**i > n-1:
break
kprv[j]... |
s758352276 | p04017 | u306950978 | 1600816499 | Python | Python (3.8.2) | py | Runtime Error | 3311 | 91192 | 719 | from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[10**10 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + 2**i > n-1:
break
kprv[j][i] = x[j+2**i] - x[j]
L = int(input())
q = int(... |
s771718494 | p04017 | u306950978 | 1600816464 | Python | PyPy3 (7.3.0) | py | Runtime Error | 3311 | 112936 | 719 | from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[10**10 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + 2**i > n-1:
break
kprv[j][i] = x[j+2**i] - x[j]
L = int(input())
q = int(... |
s407269049 | p04017 | u306950978 | 1600816371 | Python | PyPy3 (7.3.0) | py | Runtime Error | 3311 | 113096 | 717 | from bisect import bisect_left,bisect
n = int(input())
x = list(map(int,input().split()))
t = (n-1).bit_length()
kprv = [[1000 for i in range(t)] for j in range(n-1)]
for i in range(t):
for j in range(n):
if j + 2**i > n-1:
break
kprv[j][i] = x[j+2**i] - x[j]
L = int(input())
q = int(in... |
s358633750 | p04017 | u535803878 | 1595649918 | Python | PyPy3 (7.3.0) | py | Runtime Error | 144 | 102408 | 1293 | import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")
n = int(input())
x = list(map(int, input().split()))
l = int(input())
q = int(input())
ps = [None]*n
# ps2 = [None]*n
j = 0
for i in range(n):
if j<i:
j = i
whil... |
s733147340 | p04017 | u703950586 | 1592069964 | Python | PyPy3 (2.4.0) | py | Runtime Error | 556 | 82972 | 1027 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline()... |
s422322403 | p04017 | u703950586 | 1592063737 | Python | PyPy3 (2.4.0) | py | Runtime Error | 563 | 79132 | 974 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline()... |
s744891259 | p04017 | u703950586 | 1592063669 | Python | PyPy3 (2.4.0) | py | Runtime Error | 536 | 78876 | 946 | import sys,queue,math,copy,itertools,bisect,collections,heapq
def main():
sys.setrecursionlimit(10**7)
INF = 10**18
MOD = 10**9 + 7
LI = lambda : [int(x) for x in sys.stdin.readline().split()]
_LI = lambda : [int(x)-1 for x in sys.stdin.readline().split()]
NI = lambda : int(sys.stdin.readline()... |
s125458018 | p04017 | u585482323 | 1585538804 | Python | PyPy3 (2.4.0) | py | Runtime Error | 3161 | 101304 | 1353 | #!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return... |
s408312846 | p04017 | u141610915 | 1584207547 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1021 | 98584 | 803 | import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
L = int(input())
k = 0
while a[-1] // (L * pow(2, k)): k += 1
e = [[0] * k for _ in range(N)]
for i in range(N):
t = L + a[i]
ok = i
ng = N
while ng - ok > 1:
m = (ok + ng) // 2
if a[m] <= t: ok = m
else: ng =... |
s192611350 | p04017 | u141610915 | 1584206720 | Python | PyPy3 (2.4.0) | py | Runtime Error | 1137 | 106392 | 796 | import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
L = int(input())
k = 0
while a[-1] // (L * pow(2, k)): k += 1
e = [[0] * k for _ in range(N)]
for i in range(N):
t = L + a[i]
ok = i
ng = N
while ng - ok > 1:
m = (ok + ng) // 2
... |
s018969502 | p04017 | u141610915 | 1584206307 | Python | PyPy3 (2.4.0) | py | Runtime Error | 440 | 79128 | 757 | import sys
from bisect import bisect_left as bl
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
L = int(input())
k = 0
while a[-1] // (L * pow(2, k)): k += 1
e = [[0] * k for _ in range(N)]
for i in range(N):
t = L + a[i]
ok = i
ng = N
while ng - ok > 1:
m = (ok + ng) // 2
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.