description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
f = input
for _ in range(t):
n, k = map(int, f().split())
x = sorted(map(int, f().split()))
f()
r = [0] * n
c = n - 1
for i in range(n - 1, -1, -1):
while x[c] > x[i] + k:
c -= 1
r[i] = c
m = [0] * n
c = 0
for i in range(n - 1, -1, -1):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR N... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for p in range(t):
arr = [int(i) for i in input().split()]
n = arr[0]
k = arr[1]
x_list = [int(i) for i in input().split()]
y_list = [int(i) for i in input().split()]
coordinates = []
for i in range(n):
coordinates.append([x_list[i], y_list[i]])
coordinates = sor... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = list(map(int, input().split()))
xcor = list(map(int, input().split()))
ycor = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append([xcor[i], ycor[i]])
arr.sort()
dp = [(0) for i in range(n)]
dp[n - 1] = 1
for i in range(n... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
pts = list(zip(xs, ys))
pts.sort(key=lambda p: p[0])
dp = []
rp = 0
for i in range(n):
while rp < n and pts[rp][0] - pts[i][0] <= k:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def arr(A, k):
n = len(A)
pre = [0] * n
l = 0
r = 0
while r < n:
if abs(A[r] - A[l]) <= k:
r += 1
else:
while l < r and abs(A[r] - A[l]) > k:
l += 1
r += 1
pre[r - 1] = r - l
return pre
def answer(n, k, A):
if n ==... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER WHILE VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR RETURN VAR FUNC_DEF IF... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def solve():
n, k = map(int, input().split())
a = [int(i) for i in input().split()]
input()
dp = [0] * (n + 10)
ma = [0] * (n + 10)
r = -1
a.sort()
for i in range(n):
r = max(r, i)
for j in range(r, n):
if a[j] <= a[i] + k:
r = j
el... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CAL... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = list(map(int, input().split()))
nums, _ = sorted(map(int, input().split())), list(map(int, input().split()))
if 2 * k >= nums[-1] - nums[0]:
print(len(nums))
continue
f = [0] * (n + 1)
l = ans = 0
for r, v in enumerate(nums):
while v -... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUN... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | T = int(input())
for case in range(T):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
suf = [(0) for i in range(n + 2)]
ans = [(0) for i in range(n + 2)]
x.sort()
j = 0
for i in range(n):
while j < n and x[j] <= x[i] + k:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def solve(coords, k):
left = 0
right = 0
dp = [0]
result = 0
while True:
while right < len(coords) and coords[right] - coords[left] <= k:
right += 1
dp.append(max(dp[right - 1], right - left))
result = max(result, dp[left] + right - left)
if right == l... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER WHILE NUMBER WHILE VAR FUNC_CALL VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR IF VAR FUNC_CALL VAR VAR V... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for i in range(t):
params = input()
n, k = int(params.split()[0]), int(params.split()[1])
coordinates = input()
something = input()
numbers = list(map(int, coordinates.split()))
numbers.sort()
if numbers[-1] - numbers[0] <= 2 * k or len(numbers) == 1:
print(n)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR IF BIN_OP VAR NUMBE... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def ans(n, k, x, y):
x.sort()
l = [0] * len(x)
r = [0] * len(x)
i = 0
j = 0
temp = 0
while i < len(x) and j < len(x):
temp = i - j + 1
if i == j:
l[i] = temp
i += 1
elif x[i] - x[j] <= k:
l[i] = temp
i += 1
else:... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR NUMBER IF BIN_OP V... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
arr = list(map(int, input().split()))
y = list(map(int, input().split()))
arr.sort()
i = j = 0
end = [0] * n
start = [0] * n
while j < n:
if arr[j] - arr[i] <= k:
if j:
end[j] = max(end[j -... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSI... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin, stdout
def find(N, K, X):
X.sort()
arrA = [0]
j = 0
r = 0
for i in range(N):
r += 1
if i < N - 1 and X[i] == X[i + 1]:
continue
while X[i] - X[j] > K:
j += 1
r -= 1
arrA.append(r)
X.reverse()
arrB = ... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASS... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = map(int, input().split())
x.sort()
start = 0
p = [0] * n
p[0] = 1
for i in range(1, n):
if x[i] - x[start] <= k:
p[i] = i - start + 1
else:
while... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMB... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin, stdout
input = stdin.buffer.readline
for _ in range(int(input())):
n, k = map(int, input().split())
(*x,) = map(int, input().split())
(*y,) = map(int, input().split())
a = [[x[i], y[i]] for i in range(n)]
b = [0] * n
c = [0] * (n + 1)
dp = [0] * (n + 1)
a.sort()
... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSI... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def run():
n, k = map(int, input().split())
xS = list(map(int, input().split()))
yS = list(map(int, input().split()))
lMax, rMax = [0] * n, [0] * n
xS.sort()
j = n - 1
for i in range(n - 1, -1, -1):
while xS[j] - xS[i] > k:
j -= 1
rMax[i] = j - i + 1
if i ... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUN... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for test in range(t):
n, k = map(int, input().split())
points = []
x = list(map(int, input().split()))
y = list(map(int, input().split()))
for i in range(n):
points.append([x[i], y[i]])
points.sort()
l, r = 0, 0
lrs = []
while l < n:
r = max(r, l)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIS... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | T = int(input())
while T > 0:
n, k = map(int, input().split())
xs = list(map(int, input().split()))
ys = list(map(int, input().split()))
xs.sort()
dp1 = [0] * n
start = 0
for i in range(n):
while xs[i] - xs[start] > k:
start += 1
dp1[i] = max(dp1[i - 1], i - start... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FO... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
LI = lambda: list(map(int, sys.stdin.readline().strip("\n").split()))
MI = lambda: map(int, sys.stdin.readline().strip("\n").split())
SI = lambda: sys.stdin.readline().strip("\n")
II = lambda: int(sys.stdin.readline().strip("\n"))
for _ in range(II()):
n, k = MI()
a = sorted(MI())
b = MI()
l... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin
class Input:
def readline(self):
return stdin.readline().strip()
def read_int(self):
return int(self.readline())
def read_list(self):
return self.readline().split()
def test_cases(self):
cases = self.read_int()
for case in range(cases):... | CLASS_DEF FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR VAR CLASS_DEF FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = input()
x.sort()
L = [(0) for _ in range(n)]
R = [(0) for _ in range(n)]
prev = 0
L[0] = 1
for i in range(1, n):
L[i] = L[i - 1] + 1
while x[i] - x[prev] > k:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input().strip())
for _ in range(t):
n, k = map(int, input().split())
arr = [int(i) for i in input().split()]
xx = input()
if n == 1:
print(1)
else:
arr.sort()
cnt = [(0) for i in range(n)]
left = arr[0]
right = left + k
for i in range(n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
plat1 = [0] * n
plat2 = [0] * n
p_left = 0
for i in range(n):
if x[i] > x[p_left] + k:
p_left += 1
plat1[i] = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def solve():
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
l = [0] * len(x)
r = [0] * len(x)
st = 0
for i in range(len(x)):
while x[i] - k > x[st]:
st += 1
l[i] = i - st + 1
if i > 0:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIG... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | (T,) = map(int, input().split())
for _ in range(T):
N, k = map(int, input().split())
X = list(sorted(list(map(int, input().split())))) + [10**18]
Y = list(map(int, input().split())) + [10**18]
yi = 0
Z = [0] * N
V = [1] * N
for i in range(N):
while X[yi + 1] <= X[i] + k:
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR LIST BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_C... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def solution(n, k, x, y):
x.sort()
l, r, a, b, c = [], [], 0, 0, 1
while b < n:
if c <= n - 1:
while x[c] - x[b] <= k:
c += 1
if c == n:
break
while x[b] - x[a] > k:
a += 1
r.append(c - b)
l.append(b ... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR LIST LIST NUMBER NUMBER NUMBER WHILE VAR VAR IF VAR BIN_OP VAR NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER IF VAR VAR WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER FOR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
stdin = sys.stdin
stdout = sys.stdout
def binSearch(arr, num, start, end):
while start != end:
mid = (start + end) // 2
if arr[mid] >= num:
end = mid
else:
start = mid + 1
return start
test = int(stdin.readline())
for t in range(test):
n, k = [... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys as _sys
def main():
t = int(input())
for i in range(t):
n, k = _read_ints()
xs = tuple(_read_ints())
ys = tuple(_read_ints())
result = find_max_points_can_save_n(xs, ys, platform_size=k)
print(result)
def _read_ints():
return map(int, _sys.stdin.readlin... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DE... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
t = int(input())
for _ in range(t):
[n, k] = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
input()
j = n - 1
r = [0] * n
for i in range(n - 1, -1, -1):
while x[j] - x[i] > k:
j -= 1
r[i] = j - i + 1
j = 0
l = [0] * n
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
n, k = map(int, input().split())
x = [int(i) for i in input().split()]
y = [int(i) for i in input().split()]
x.sort()
i, j = 0, 0
ans, tmp = 0, 1
end, start = 0, 0
store = []
while j < n:
if x[j] - x[... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
x, y = [int(i) for i in input().split()], [int(i) for i in input().split()]
x.sort()
x.append(9999999999999999999)
t, ans, arr, r = 0, 0, [0] * (n + 5), 0
ll = 0
for i in range(n):
while x[r + 1] - x[i] <= k:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER NUMBER BIN_OP LIST NUMBER BIN_O... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
l = list(map(int, input().split()))
l2 = list(map(int, input().split()))
l.sort()
l3 = []
l4 = [0]
kk = 1
count = 0
c = 0
i = 0
j = 0
ans = 0
while i < n and j < n:
if l[j] - l[i] <= k and j >= i:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER ASSIGN VAR NUMBER ASS... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
input = sys.stdin.readline
t = int(input())
for rrr in range(t):
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
pl = []
i = 0
j = 0
tmp = []
for j in range(n):
if x[j] - x[i] > k:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for i in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
input()
a.sort()
dp = [0] * n
dp[0] = 1
i = 1
while i < n and a[i] - a[0] <= k:
dp[i] = i + 1
i += 1
l = i
t = 0
while i < n:
while a[i] - a[t] > k:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR VAR VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for i in range(t):
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
num = x[0]
for j in range(n):
x[j] -= num
j = 0
while j < n:
if x[j] <= k:
j += 1
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR F... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, p = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
b = input()
a.sort()
b = []
c = []
j = 0
k = 0
if n <= 2:
print(n)
continue
for i in range(n):
while a[i] - a[j] > p:
j += 1
wh... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR FOR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = [int(zz) for zz in input().split()]
x = [int(zz) for zz in input().split()]
y = [int(zz) for zz in input().split()]
x.sort()
l = x[0]
r = x[-1]
if k * 2 + 1 >= r - l:
print(n)
continue
else:
cnts = [(-1) for __ in range(l... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP BIN_OP ... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
l = [1]
r = [1]
left = 0
right = n - 1
for pos in range(1, n):
while x[left] < x[pos] - k:
left += 1
l.app... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin, stdout
def two_platforms(n, k, x_a):
x_a.sort()
la = [0] * n
ra = [0] * n
hi = 0
mx = 0
for i in range(n):
while hi < i and x_a[i] - x_a[hi] > k:
hi += 1
mx = max(mx, i - hi + 1)
la[i] = mx
tj = n - 1
mx = 0
for j in range(... | FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSI... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin, stdout
class SOLVE:
def bsearch(self, left, right, j, x, k, pos, cmd):
if left > right:
return pos
mid = (left + right) // 2
if cmd == "rpos":
if x[mid] <= x[j] + k:
pos = mid
return self.bsearch(mid + 1, right... | CLASS_DEF FUNC_DEF IF VAR VAR RETURN VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR STRING IF VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR VAR VAR VAR IF VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR VAR RETURN FU... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
x_coordinates = list(map(int, input().split()))
x_coordinates.sort()
input()
if n == 1:
print(1)
continue
L = 0
R = 0
length = 0
points = 0
platform_points = []
while True:
length = x_coord... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUM... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin
for _ in range(int(stdin.readline())):
n, k = map(int, stdin.readline().split())
arr_x = list(map(int, stdin.readline().split()))
arr_y = list(map(int, stdin.readline().split()))
arr_x.sort()
left = [0] * (n + 1)
i = 0
j = 0
while i < n:
while j <= i and ar... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR N... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for i in range(int(input())):
n, k = list(map(int, input().split()))
x = sorted(map(int, input().split()))
input()
a = []
j = 0
for i in range(n):
while j < n and x[j] - x[i] <= k:
j += 1
a.append(j - i)
c = a[:]
a1 = a[:]
for i in range(1, n):
a[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE VAR VAR BIN_OP VAR VAR VAR VAR VAR VAR NUMBER E... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
cnt = {}
for i in x:
cnt[i] = 0
for i in x:
cnt[i] += 1
keys, first, last, val = list(cnt.keys()), {}, {}, 0
for i in keys:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
a = list(map(int, input().split()))
y = input()
a.sort()
l = [0] * (n + 1)
r = [0] * (n + 1)
i = 0
for j in range(n):
while a[j] - a[i] > k:
i += 1
l[j + 1] = j - i + 1
l[j + 1] = max(l[j],... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for t in range(int(input())):
n, k = map(int, input().split())
lx = list(map(int, input().split()))
ly = list(map(int, input().split()))
lx = list(sorted(lx))
ll = [0]
pi = 0
for i in range(len(lx)):
while lx[i] > lx[pi] + k:
pi += 1
ll.append(i - pi + 1)
lr =... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER ASSIGN VAR NU... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin
input = stdin.readline
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
x = sorted(list(map(int, input().split())))
y = list(map(int, input().split()))
mostSaved = [0] * (n + 1)
savedFromStart = [0] * n
i, j = 0, 0
prevX = -1
while i < n:
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_O... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | h = int(input())
l = []
for i in range(h):
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
a = [None] * n
b = [None] * n
x.sort()
j = n - 1
for h in range(n - 1, -1, -1):
while x[j] - x[h] > k:
j -= 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR AS... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | TC = int(input())
for tc in range(TC):
N, K = map(int, input().split())
X = list(map(int, input().split()))
Y = list(map(int, input().split()))
if N < 3:
print(N)
continue
X.sort()
l = [(0) for _ in X]
r = [(0) for _ in X]
j = 0
for i, x in enumerate(X):
while... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN V... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def is_ok(X, K, i, mid):
if X[mid] - X[i] <= K:
return True
else:
return False
def binary_search(X, K, i):
ng = len(X)
ok = i
while abs(ok - ng) > 1:
mid = ng + (ok - ng) // 2
if is_ok(X, K, i, mid):
ok = mid
else:
ng = mid
return... | FUNC_DEF IF BIN_OP VAR VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR WHILE FUNC_CALL VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF IF VAR VAR BIN_OP VAR VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a.sort()
ret, ret2 = 1, 0
j, l = 1, 0
for i in range(1, n):
while a[i] - a[j] > k:
j += 1
while a[j - 1] - a[l] > k:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR N... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = [int(i) for i in input().split()]
a = [int(i) for i in input().split()]
a.sort()
input()
l = []
r = [0] * n
j = 0
for i in range(n):
while a[i] - a[j] > k:
j += 1
l.append(i - j + 1)
j = n - 1
for i in range(n - 1, ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR WHILE BIN_OP VAR VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin
def inp():
return stdin.buffer.readline().rstrip().decode("utf8")
def itg():
return int(stdin.buffer.readline())
def mpint():
return map(int, stdin.buffer.readline().split())
for __ in range(itg()):
n, k = mpint()
arr = list(mpint())
arr.sort()
inp()
left = ... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP L... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
class ETwoPlatforms:
def solve(self, tc=0):
for _ in range(int(input())):
n, k = [int(_) for _ in input().split()]
x = [int(_) for _ in input().split()]
y = [int(_) for _ in input().split()]
x.sort()
ans = 0
s, e = 0, 1
... | IMPORT CLASS_DEF FUNC_DEF NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUM... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | z = lambda: map(int, input().split())
r = range
p = print
for _ in r(int(input())):
n, k = z()
l = sorted(list(z()))
z()
if n < 3:
p(n)
continue
a = i = 0
b = m = e = o = 1
f = 2
c = [0, 1]
d = [1]
while a < n:
while b < n and l[b] <= l[a] + k:
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMB... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
for i in range(t):
n, k = map(int, input().split())
xs = map(int, input().split())
ys = map(int, input().split())
points_at_x = dict()
for x in xs:
points_at_x[x] = points_at_x.get(x, 0) + 1
points = sorted(points_at_x.keys())
m = len(points)
saved = [0] * m
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER A... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | tc = int(input())
for _ in range(tc):
n, k = map(int, input().split(" "))
x = sorted(list(map(int, input().split(" "))))
input()
left = [1] * n
l = 0
for r in range(1, n):
while x[r] - x[l] > k:
l += 1
left[r] = r - l + 1
left[r] = max(left[r], left[r - 1])
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | tc = int(input())
for _ in range(tc):
n, k = map(int, input().split())
x = list(map(int, input().split()))
input()
if n == 1:
print(1)
continue
x.sort()
j = 0
a = []
for i in range(n):
while j + 1 < n and x[j + 1] - x[i] <= k:
j += 1
a.append(j... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL V... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
input = sys.stdin.buffer.readline
def print(val):
sys.stdout.write(str(val) + "\n")
def prog():
for _ in range(int(input())):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
most_at_point = ... | IMPORT ASSIGN VAR VAR FUNC_DEF EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
x = sorted(map(int, input().split()))
input()
j = n - 1
r = [-1] * n
l = [-1] * n
for i in range(n - 1, -1, -1):
if x[j] - x[i] > k:
j = j - 1
r[i] = j - i + 1
if i < n - 1:
r[i] = ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP V... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | t = int(input())
while t > 0:
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
prefix = [0] * (n + 2)
suffix = [0] * (n + 2)
i = 1
j = 1
while i <= n and j <= n:
diff = x[j - 1] - x[i - 1]
if diff <= k:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | def solve(n, k, x, y):
x = sorted(x)
l = [0] * n
r = [0] * n
ptr = n - 1
for i in range(n - 1, -1, -1):
while x[ptr] - x[i] > k:
ptr -= 1
r[i] = ptr - i + 1
if i + 1 < n:
r[i] = max(r[i], r[i + 1])
ptr = 0
for i in range(n):
while x[i] ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER WHILE BIN_OP VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN VAR VAR FUN... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for t in range(int(input())):
n, k = map(int, input().split())
x = [int(i) for i in input().split()]
y = input()
x.sort()
mx = []
price = []
cur = 0
ptr = 0
for p, i in enumerate(x):
while ptr < len(x) and x[ptr] - i <= k:
cur += 1
ptr += 1
pri... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR WHILE VAR FUNC... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for _ in range(int(input())):
n, k = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
left, right = [0] * n, [0] * n
first = 0
for i in range(n):
while first < n and x[first] - x[i] <= k:
first += 1
right[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, k = list(map(int, input().split()))
x = list(map(int, input().split()))
y = list(map(int, input().split()))
x.sort()
take = n - 1
suffix = [0] * n
for i in range(n - 1, -1, -1):
while x[i] + k < x[take]:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | from sys import stdin, stdout
t = int(stdin.readline())
for _ in range(t):
n, k = map(int, stdin.readline().split())
x = list(map(int, stdin.readline().split()))
y = stdin.readline()
if n == 1:
print(1)
continue
endi = [1] * n
starti = [1] * n
x.sort()
curri = 0
i = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VA... |
There are $n$ points on a plane. The $i$-th point has coordinates $(x_i, y_i)$. You have two horizontal platforms, both of length $k$. Each platform can be placed anywhere on a plane but it should be placed horizontally (on the same $y$-coordinate) and have integer borders. If the left border of the platform is $(x, y)... | for t in range(int(input())):
n, k = map(int, input().split())
xs = sorted(list(map(int, input().split())))
input()
best = 0
i = j = 0
while j < n:
while j < n and xs[j] <= xs[i] + k:
j += 1
if best < j - i:
best = j - i
best_start = i
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER WHILE VAR VAR WHILE VAR VAR VAR VAR BIN_OP VAR VAR VAR VAR NUMBER IF VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
while t != 0:
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
one = []
two = []
for i in range(n):
if b[i] == 1:
one.append(a[i])
else:
two.append(a[i])
one.sort()
two.sort()... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMB... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | import sys
N = int(200000.0 + 5)
sys.setrecursionlimit(N)
def charming():
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(zip(a, b))
c.sort(key=lambda x: x[0] / x[1], reverse=True)
res = 0
last = 0
sum = 0
for i in ... | IMPORT ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR V... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
Q = sum(a) - m
if Q < 0:
print(-1)
else:
l1 = sorted([x for i, x in enumerate(a) if b[i] == 1])
l2 = sorted([x for i, x in enumerat... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR FUNC_... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def clean(apps, free, app_mem, points):
if sum(app_mem) < free:
return -1
elif sum(app_mem) == free:
return sum(points)
else:
s2, s1 = 0, 0
mem1, mem2 = [], []
for i in range(apps):
if points[i] == 1:
mem1.append(app_mem[i])
els... | FUNC_DEF IF FUNC_CALL VAR VAR VAR RETURN NUMBER IF FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FUNC_CALL VAR NUMBER ASSIGN VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
for _ in range(t):
n, m = map(int, input().rsplit())
gen_a = map(int, input().rsplit())
gen_b = map(int, input().rsplit())
a_1, a_2 = [0], [0]
total_m = 0
for i, j in zip(gen_a, gen_b):
if j == 1:
a_1.append(i)
else:
a_2.append(i)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST NUMBER LIST NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR I... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for _ in range(int(input())):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
for i in range(n):
if b[i] == 1:
x.append(a[i])
else:
y.append(a[i])
x.sort(reverse=True)
y.sort(re... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXP... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | from sys import stderr
def dbp(*args, **kwargs):
pass
def get_int_list():
return [int(i) for i in input().strip().split()]
def do_thing():
N, freeme = get_int_list()
mlist = get_int_list()
clist = get_int_list()
if sum(mlist) < freeme:
return -1
c1list = []
c2list = []
... | FUNC_DEF FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR RETURN NUMBER ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUNC_CALL VAR... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
c = []
ones = [0]
for i in range(n):
c.append((a[i] / b[i], b[i]))
if b[i] == 1:
one... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR V... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def search(arr, key):
l = 0
r = len(arr) - 1
while l <= r:
m = (l + r) // 2
if arr[m] >= key:
r = m - 1
else:
l = m + 1
return l
t = int(input())
while t > 0:
t -= 1
n, m = map(int, input().strip().split())
a = list(map(int, input().strip().s... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FU... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for _ in range(int(input())):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
a1 = [10000000000]
a2 = [10000000000]
for i in range(n):
if b[i] == 1:
a1.append(a[i])
else:
a2.append(a[i])
a1.sort(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | R = lambda: list(map(int, input().split()))
def bs(a, k):
l = 0
r = len(a) - 1
while l < r:
m = l + (r - l) // 2
if a[m] < k:
l = m + 1
else:
r = m
m = (l + r) // 2
return m
for _ in range(int(input())):
n, m = R()
a = R()
b = R()
i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER RETURN VAR FOR VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def solve():
inp = input().rstrip().split(" ")
n, m = int(inp[0]), int(inp[1])
a_arr = input().rstrip().split(" ")
b_arr = input().rstrip().split(" ")
sum_reg = 0
sum_imp = 0
reg_apps = []
imp_apps = []
for i in range(n):
if b_arr[i] == "1":
reg_apps.append(int(a_... | FUNC_DEF ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | from itertools import repeat
def line():
return map(int, input().split())
def num():
return int(input())
def nfunc(f, n, *args, **kwargs):
return (f(*args, **kwargs) for _ in repeat(None, n))
t = num()
for _ in repeat(None, t):
n, m = line()
mems = list(line())
uses = list(line())
no... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NONE VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NONE VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def dell(mlst, imp, m):
n = len(mlst)
cc = []
for i in range(n):
cc.append((mlst[i] / imp[i], i))
cc.sort()
sm = lose = 0
i = place2 = place = place1 = -1
for i in range(n - 1, -1, -1):
place = cc[i][1]
sm += mlst[place]
lose += imp[place]
if imp[place... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR NUMBER VAR VAR VAR VAR VAR VAR IF VAR VAR NUMBER A... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def bisect(b, m):
l, h, ind = 0, len(b) - 1, -1
while l <= h:
mid = (l + h) // 2
if b[mid] >= m:
ind = mid
h = mid - 1
else:
l = mid + 1
return ind
def answer(m):
c1, c2 = [0], []
for i in range(n):
if b[i] == 1:
c1.ap... | FUNC_DEF ASSIGN VAR VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR LIST NUMBER LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER EXPR FUN... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | from sys import stdin
input = stdin.buffer.readline
t = int(input())
for i in range(t):
n, m = map(int, input().split())
a = [int(x) for x in input().split()]
b = [int(x) for x in input().split()]
ones = []
twos = []
for i in range(n):
if b[i] == 1:
ones.append(a[i])
... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def readInt():
return int(input())
def readInts():
return [int(x) for x in input().split()]
def readBin():
return [int(x) for x in readString()]
def readString():
return input().rstrip()
def readCase():
return readString()
def solve(n, m, usage, convenience):
normal = []
high = []
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER FOR VAR ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for t in range(int(input())):
n, m = [int(i) for i in input().split()]
d = [int(i) for i in input().split()]
dff = [int(i) for i in input().split()]
if sum(d) < m:
print(-1)
continue
d1 = [d[i] for i in range(n) if dff[i] == 1]
d2 = [d[i] for i in range(n) if dff[i] == 2]
ld1... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | from sys import stdin
for _ in range(int(input())):
n, m = map(int, stdin.readline().strip().split())
a = list(map(int, stdin.readline().strip().split()))
b = list(map(int, stdin.readline().strip().split()))
s = sum(a)
sb = sum(b)
if s < m:
print(-1)
elif s == m:
print(sb)
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | class app:
a = 0
b = 0
def __init__(self, a, b):
self.a = a
self.b = b
def cmp(app):
return app.a
def solve():
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
arr = []
for i in range(n):
arr.append(... | CLASS_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for _ in range(int(input())):
n, m = map(int, input().split())
a, b = list(map(int, input().split())), list(map(int, input().split()))
imp = sorted([a[i] for i in range(n) if b[i] == 2])
not_imp = sorted([a[i] for i in range(n) if b[i] == 1])
res = 0
while (imp and not_imp) and m > 0:
if... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR FUNC_... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
for j in range(t):
n, m = tuple(map(int, input().split(" ")))
a = list(map(int, input().split(" ")))
b = list(map(int, input().split(" ")))
one = []
two = []
for i in range(n):
if b[i] == 1:
one.append(a[i])
else:
two.append(a[i])
two.... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LI... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | import sys
input = sys.stdin.readline
t = int(input())
for tests in range(t):
n, m = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
A1 = []
A2 = []
for i in range(n):
if B[i] == 1:
A1.append(A[i])
else:
A... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FU... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | cases = int(input())
for _ in range(cases):
n, m = [int(i) for i in input().strip().split()]
mem = [int(i) for i in input().strip().split()]
points = [int(i) for i in input().strip().split()]
ones = [(mem[i], points[i]) for i in range(n) if points[i] == 1]
twos = [(mem[i], points[i]) for i in range(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR V... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = []
y = []
for i in range(len(a)):
if b[i] == 1:
x.append(a[i])
else:
y.append(a[i])
x = sorted(x, reverse=T... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL ... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | rn = lambda: int(input())
rns = lambda: map(int, input().split())
rl = lambda: list(map(int, input().split()))
rs = lambda: input()
YN = lambda x: print("YES") if x else print("NO")
mod = lambda x: x % (10**9 + 7)
def d(a):
d = {}
for i in a:
if i not in d:
d[i] = 0
d[i] += 1
r... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR STRING FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR DI... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for _ in range(int(input())):
n, m = map(int, input().split())
memories = list(map(int, input().split()))
convenience = list(map(int, input().split()))
X, Y = [], []
for a, b in zip(memories, convenience):
if b == 1:
X.append(a)
else:
Y.append(a)
X.sort(re... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST LIST FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR NUMBER EXPR F... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | t = int(input())
for i in range(t):
n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
if sum(a) < m:
print(-1)
else:
one_arr = []
two_arr = []
for app, score in zip(a, b):
if score == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | in_length = int(input())
final_ouput = []
for i in range(in_length):
[num_apps, mem_needed] = input().split()
mem_used = [int(el) for el in input().split()]
conv_points = input().split()
big_num = 5000000000
out = big_num
low_apps = []
high_apps = []
for j in range(int(num_apps)):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VA... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | for t in range(int(input())):
n, m = [int(k) for k in input().split()]
a = [int(k) for k in input().split()]
b = [int(k) for k in input().split()]
if m > sum(a):
print(-1)
continue
imp = []
non = []
for i in range(n):
if b[i] == 2:
imp += [a[i]]
el... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | def solve():
n, m = input().split()
n = int(n)
m = int(m)
mem = input().split()
unit = input().split()
regular = []
important = []
for i in range(n):
mem[i] = int(mem[i])
unit[i] = int(unit[i])
if unit[i] == 1:
regular.append(mem[i])
else:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR N... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | import sys
input = sys.stdin.readline
def solution(n, m, a, b):
l_1 = []
l_2 = []
diff_memory = 0
sol = 10**10
sum_a = sum(a)
if sum_a < m:
print(-1)
return
l_1 = [ai for ai, bi in zip(a, b) if bi == 1]
l_2_slave = [ai for ai, bi in zip(a, b) if bi == 2]
l_1.sort(r... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUM... |
Polycarp often uses his smartphone. He has already installed $n$ applications on it. Application with number $i$ takes up $a_i$ units of memory.
Polycarp wants to free at least $m$ units of memory (by removing some applications).
Of course, some applications are more important to Polycarp than others. He came up with... | import sys
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
reg, imp = [], []
for i in range(n):
if b[i] == 1:
reg.append(a[i])
else:
imp.append(a[i])
reg.sort(rev... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR LIST LIST FOR VAR FUNC_CALL VAR VAR IF VAR... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.