description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | ttt = int(input())
for _ in range(ttt):
S = [(ord(c) - ord("0")) for c in input()]
x = int(input())
n = len(S)
anss = [1] * n
for i in range(n):
if S[i] == 0:
if 0 <= i - x:
anss[i - x] = 0
if i + x < n:
anss[i + x] = 0
T = [0] * n
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF NUMBER BIN_OP VAR VAR ASSIGN VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def multiple_input():
return map(int, input().split())
def list_input():
return list(map(int, input().split()))
for _ in range(int(input())):
s = input()
x = int(input())
n = len(s)
w = ["1"] * n
for i in range(n):
if s[i] == "0":
if i - x >= 0:
w[i - ... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
MOD = 10**9 + 7
INF = 10**9
PI = 3.141592653589793
def read_str():
return sys.stdin.readline().strip()
def read_int():
return int(sys.stdin.readline().strip())
def read_ints():
return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):
return map(lambda num: int(num) - ... | IMPORT ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
input = sys.stdin.readline
def print(val):
sys.stdout.write(str(val) + "\n")
def prog():
for _ in range(int(input())):
s = input().strip()
x = int(input())
place = [2] * len(s)
fail = False
for i in range(len(s)):
if i + x > len(s) - 1 and i - ... | 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | from sys import stdin
ip = stdin.readline
for _ in range(int(ip())):
a = ip().strip()
x = int(ip())
n = len(a)
ans = ["1"] * n
for i in range(n):
val = a[i]
if val == "0":
if i - x >= 0:
ans[i - x] = "0"
if i + x < n:
ans[i + x... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR STRING I... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def solve(s, x):
n = len(s)
need_0 = set()
for i in range(1, n + 1):
if s[i - 1] == "0":
if i - x > 0:
need_0.add(i - x)
if i + x <= n:
need_0.add(i + x)
w = ""
for j in range(1, n + 1):
if s[j - 1] == "1":
back_test... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER STRING IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBE... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def iin():
return int(input())
def lin():
return list(map(int, input().split()))
def main():
T = iin()
while T:
T -= 1
s = list(map(int, input()))
x = iin()
n = len(s)
w = [-1] * n
for i in range(n):
if not s[i]:
if i + x < ... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def stringslicing(string, index):
if index >= 0 and index < len(string):
return string[index]
else:
return "not defined"
t = int(input())
for _ in range(t):
string = input().strip()
s = int(input())
answer = {}
answer = answer.fromkeys(range(0, len(string)), "1")
for i in r... | FUNC_DEF IF VAR NUMBER VAR FUNC_CALL VAR VAR RETURN VAR VAR RETURN STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR STRING FOR VAR FUNC_CALL VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for t_index in range(t):
s, x = input(), int(input())
n = len(s)
w, wr = "", ["0" for i in range(n + 2 * x)]
for i in range(n):
if s[i] == "1":
wr[x + (i - x)] = wr[x + (i + x)] = "1"
for i in range(n):
if s[i] == "0":
wr[x + (i - x)] = wr[x +... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING STRING VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for i in range(t):
s = input()
s = list(s)
n = int(input())
s1 = []
s2 = []
for i in range(len(s)):
s1.append("1")
s2.append("1")
for i in range(len(s)):
if s[i] == "0":
if i - n >= 0:
s1[i - n] = "0"
if i + n <... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
a = list(input())
x = int(input())
ans = ["no" for i in range(len(a))]
n = len(a)
flag = 0
for i in range(n):
if a[i] == "0":
if i - x >= 0:
ans[i - x] = "0"
if i + x < n:
ans[i + x] = "0"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
s = [0] + list(map(int, input().strip()))
x = int(input())
n = len(s) - 1
ans = [(1) for _ in range(n + 1)]
for i in range(1, n + 1):
if s[i] == 0:
if i > x:
ans[i - x] = 0
if i + x <= n:
ans[i + x] =... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
input = lambda: sys.stdin.readline().strip()
t = int(input())
while t:
t -= 1
s = input()
n = len(s)
x = int(input())
w = [""] * n
for i in range(n):
if s[i] == "0":
if i - x >= 0:
w[i - x] = "0"
if i + x < n:
w[i + x] =... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def solution():
s = list(input())
x = int(input())
n = len(s)
flag = 0
l = ["2"] * n
for i in range(n):
p = i - x
q = i + x
if p < 0 and q > n - 1:
if s[i] == "1":
flag = 1
break
elif p < 0:
if s[i] == "1":
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER VAR BIN_OP VAR NUMBER IF VAR VAR STRING ASSIGN VAR NUMBER IF... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
l = list(input())
x = int(input())
l = l[:-1]
res = []
n = len(l)
ans1 = ["1"] * n
for i in range(n):
if l[i] == "0":
if i + x < n:
ans1[i + x] = "0"
if i - x >= 0:
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR VAR ASS... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = []
for x in input():
s.append(int(x))
n = int(input())
ans = [None] * len(s)
for i in range(len(s)):
if i - n >= 0 and i + n < len(s):
if s[i] == 0:
if ans[i - n] == 1:
ans = -1
brea... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR FUNC_CALL VAR VAR IF VAR VAR N... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
s = list(input())
x = int(input())
n = len(s)
a = ["1"] * n
tr = 1
for i in range(n):
if s[i] == "0":
if i + x < n and i - x >= 0:
a[i + x] = "0"
a[i - x] = "0"
elif i + x < n:
a[i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR VAR BIN_OP VAR VAR NUMBER ASSIGN V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
s = input()
n = len(s)
x = int(input())
res = [-1] * len(s)
for i in range(len(s)):
num = int(s[i])
if s[i] == "0":
if i - x < 0 and i + x >= n:
continue
elif i - x >= 0 and i + x >= n:
if res... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBE... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for qwerty in range(t):
s = input()
k = int(input())
n = len(s)
ans = ["1" for i in range(n)]
for i in range(n):
if s[i] == "0":
if i - k >= 0:
ans[i - k] = "0"
if i + k < n:
ans[i + k] = "0"
v = ""
for i in ran... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VAR VAR VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def string(arr, x):
for i in range(len(arr)):
arr[i] = int(arr[i])
lst = [1] * len(arr)
for i in range(len(arr)):
if arr[i] == 0:
if i - x >= 0:
lst[i - x] = 0
if i + x <= len(arr) - 1:
lst[i + x] = 0
if check(arr, lst, x) != -1:
... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
S = input()
s = []
for i in S:
s.append(int(i))
n = len(s)
x = int(input())
a = [0] * n
b = [False] * n
check = False
for i in range(min(x, n)):
if i + x < n:
b[i + x] = True
a[i + x] = s[i]
for i in range(n - ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | tc = int(input())
for t in range(tc):
s = input()
x = int(input())
n = len(s)
w = [(-1) for _ in range(len(s))]
later = []
pos = True
for i in range(len(s)):
if i + x >= n and i - x < 0:
if s[i] == "1":
pos = False
print(-1)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for t in range(int(input())):
s = list(input())
n = len(s)
d = ["1"] * n
x = int(input())
flag = False
for i, j in enumerate(s):
if j == "0":
if i + x < n:
d[i + x] = "0"
if i - x >= 0:
d[i - x] = "0"
for i, j in enumerate(s):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF VAR STRING IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
x = int(input())
a = ["?"] * len(s)
for i in range(len(s)):
if s[i] == "0":
if i + x < len(s):
a[i + x] = "0"
if i - x >= 0:
a[i - x] = "0"
temp = 0
for i in range(len(s)):
if s[i] =... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
s = input()
x = int(input())
n = len(s)
w = ["1"] * n
bad = False
ans = ""
for i in range(n):
if s[i] == "0":
if i - x >= 0:
w[i - x] = "0"
if i + x < n:
w[i + x] = "0"
for i in range(n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | from sys import stdin
for _ in range(int(stdin.readline())):
string = stdin.readline().strip()
x = int(stdin.readline())
build = ""
flag = True
array = [0] * len(string)
if x + x > len(string):
for i in range(len(string) - x):
array[i + x] = string[i]
for i in range(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | from sys import stdin
for _ in range(int(input())):
s = list(stdin.readline().rstrip())
x = int(input())
n = len(s)
w = ["1"] * n
test = ["0"] * n
for i in range(n):
if s[i] == "0":
if i >= x:
w[i - x] = "0"
if i + x <= n - 1:
w[i ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR BIN_OP VAR VAR STRI... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for idn in range(int(input())):
s = [int(symbol) for symbol in input()]
n = len(s)
x = int(input())
q = [(1) for i in range(n)]
for i in range(n):
if x <= i and s[i] == 0:
q[i - x] = 0
if i + x < n and s[i] == 0:
q[i + x] = 0
for i in range(min(x, n - x)):... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR VAR ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
flag = 0
x = int(input())
a = ["-1" for i in range(len(s))]
for i in range(len(s)):
if s[i] == "1":
if i - x >= 0 and a[i - x] != "0":
a[i - x] = "1"
elif i + x < len(s) and a[i + x] != "0":
a[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR STRING ASSIGN VAR BIN_OP VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for _ in range(t):
s = input()
n = len(s)
w = [(-1) for i in range(n)]
x = int(input())
possible = True
for i in range(n):
imx = i - x
ipx = i + x
if s[i] == "1":
if imx >= 0 and w[imx] == -1:
w[imx] = "1"
if ipx < ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR STRING IF VAR N... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def main():
t = int(input())
for _ in range(t):
s = input()
x = int(input())
n = len(s)
w = ["1"] * n
for i in range(n):
if i + x < n:
if s[i + x] == "0":
w[i] = "0"
if i - x >= 0:
if s[i - x] == ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR IF VAR BIN_OP VAR VAR STRING ASSIGN VAR VAR STRING IF BIN_OP VAR VAR NU... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def findStr(s, x, c):
enc = list(["0" if c == "1" else "1"] * len(s))
for i in range(len(s)):
if s[i] == c:
if i - x >= 0:
enc[i - x] = c
if i + x < len(s):
enc[i + x] = c
return enc
for _ in range(int(input())):
s = list(input())
x =... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP LIST VAR STRING STRING STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF BIN_OP VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CAL... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for i in range(t):
ar = [str(i) for i in input()]
n = len(ar)
f = int(input())
no = 0
b = ["1"] * n
for x in range(n):
if ar[x] == "0":
if x >= f:
b[x - f] = "0"
if x + f < n:
b[x + f] = "0"
for x in range(n):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
x = int(input())
w = [0] * len(s)
k = True
for i in range(len(s)):
if s[i] == "1":
h = False
if i - x >= 0:
if i - x - x >= 0:
if s[i - x - x] != "0":
w[i - x] = 1
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR VAR NUMBER IF ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
input = sys.stdin.buffer.readline
T = int(input())
for testcase in range(T):
s = list(input())
n = len(s) - 2
x = int(input())
w = ["1"] * n
for i in range(n):
if s[i] == 48:
if 0 <= i + x < n:
w[i + x] = "0"
if 0 <= i - x < n:
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF NUMBER BIN_OP VAR VAR VAR ASSIG... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | T = int(input())
for t in range(T):
s = input()
x = int(input())
n = len(s)
w = ["1"] * n
flag = 0
for i in range(n):
if s[i] == "0":
if i - x >= 0:
w[i - x] = "0"
if i + x < n:
w[i + x] = "0"
for i in range(n):
if s[i] ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_O... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | tc = int(input())
for t in range(tc):
inp = [int(i) for i in input()]
n = len(inp)
x = int(input())
res = [1] * n
ans = 0
for i in range(n):
if inp[i] == 0:
if i - x >= 0:
res[i - x] = 0
if i + x < n:
res[i + x] = 0
for i in ran... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | tc = int(input())
for _ in range(tc):
s = input()
x = int(input())
w = ["1"] * len(s)
for i in range(len(s)):
if s[i] == "0":
if i - x > -1:
w[i - x] = "0"
if i + x < len(s):
w[i + x] = "0"
s2 = ""
for i in range(len(s)):
if... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VAR VAR FUNC_CALL... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
s = stdin.readline()
s = s[:-1]
x = int(stdin.readline())
n = len(s)
w = [None] * n
flag = True
for i in range(n):
if s[i] == "0":
if i - x >= 0:
if w[i - x] == 1:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def get_int():
return int(input())
def get_ints():
return [int(x) for x in input().split()]
t = get_int()
for i in range(0, t):
s = input()
x = get_int()
w = "0" * x + "?" * len(s) + "0" * x
s = list(s)
w = list(w)
for j in range(0, len(s)):
if s[j] == "0":
w[j] =... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP STRING VAR BIN_OP STRING FUNC_CALL VAR VAR BIN_OP STRING VAR ASSIGN VAR FU... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for t in range(int(input())):
s = input()
x = int(input())
a = []
count = 0
for i in s:
a.append(int(i))
count += 1
b = [1] * count
for i in range(count):
if a[i] == 0:
if i - x >= 0:
b[i - x] = 0
if i + x < count:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | T = int(input())
for _ in range(T):
s = input()
x = int(input())
n = len(s)
w = [(-1) for i in range(n)]
flag = 0
for i in range(n):
if s[i] == "0":
if i - x >= 0:
if w[i - x] == 1:
flag = 1
break
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR VAR NUMBER ASSIGN... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
Ans = []
for k in range(t):
s = input()
s = [int(j) for j in s]
x = int(input())
w = [1] * len(s)
for i in range(len(s)):
if s[i] == 0:
if i + 1 > x:
w[i - x] = 0
if i + x + 1 <= len(s):
w[i + x] = 0
for i in range(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER IF BIN_OP VAR NUMBER VAR ASSIGN ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = list(input())
n = len(s)
x = int(input())
w = ["0"] * n
c = 1
for i in range(n):
if s[i] == "1":
if i - x >= 0:
w[i - x] = "1"
if i + x < n:
w[i + x] = "1"
for i in range(n):
if s[i] == ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
st = input()
x = int(input())
le = len(st)
li = [-1] * le
flag = True
for i in range(le):
if st[i] == "1":
if i - x >= 0 and li[i - x] == 1:
continue
elif i + x < le and li[i + x] == 1:
continue
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR VAR BIN_... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
x = int(input())
l = len(s)
ans = ["1"] * l
for i in range(l):
a = i - x >= 0
b = i + x < l
if s[i] == "0":
if a and b:
ans[i + x] = "0"
ans[i - x] = "0"
elif a:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR BIN_OP VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for i in range(0, int(input())):
s = list(input())
n = int(input())
w = []
for j in range(0, len(s)):
w.append(1)
for j in range(0, len(s)):
if s[j] == "0":
if j - n >= 0:
w[j - n] = 0
if j + n < len(s):
w[j + n] = 0
q = [0]... | FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR NUMBER ASSIGN... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def read_int():
return int(input().strip())
def read_ints():
return list(map(int, input().strip().split()))
def read_floats():
return list(map(float, input().strip().split()))
def read_str():
return input().strip()
def solve_t():
s = read_str()
x = read_int()
n = len(s)
w = list(... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASS... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
def rl(proc=None):
if proc is not None:
return proc(sys.stdin.readline())
else:
return sys.stdin.readline().rstrip()
def srl(proc=None):
if proc is not None:
return list(map(proc, rl().split()))
else:
return rl().split()
def solve(s, x):
n = len(s)
... | IMPORT FUNC_DEF NONE IF VAR NONE RETURN FUNC_CALL VAR FUNC_CALL VAR RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF NONE IF VAR NONE RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR VAR FUNC_CALL VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
lines = sys.stdin.read().splitlines()
lincnt = -1
def input():
global lincnt
lincnt += 1
return lines[lincnt]
for _ in range(int(input())):
s = input()
x = int(input())
r = ["1"] * len(s)
for i in range(len(s)):
if s[i] == "0":
if i >= x:
r... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF VAR NUMBER RETURN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VA... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
n = int(input())
y = len(s)
l = [1] * y
f = 0
for i in range(y):
if s[i] == "0":
if i + n < y:
l[i + n] = 0
if i - n >= 0:
l[i - n] = 0
x = 0
for i in range(y):
f = 0
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR NUMBER A... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
I = lambda: int(input())
RL = readline = lambda: sys.stdin.readline().strip("\n")
RM = readmap = lambda x=int: map(x, readline().split(" "))
for _ in range(I()):
s, x = RL(), I()
n = len(s)
w = ["1"] * n
for ind, i in enumerate(s):
if i == "0":
i1, i2 = ind - x, ind + x
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR VAR FUNC_C... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = input()
n = len(s)
x = int(input())
a = ["1" for x in range(len(s))]
for i, j in enumerate(s):
if s[i] == "0":
if i >= x:
a[i - x] = "0"
if i + x <= n - 1:
a[i + x] = "0"
for a_, b_, c_, d_ in zip([... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VAR VAR BIN_OP VAR NU... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | def controller(s, x):
n = len(s)
w = list("1" * n)
a = -x
b = x
for si in s:
if a >= 0 and si == "0":
w[a] = "0"
if b < n and si == "0":
w[b] = "0"
if a < 0 and b >= n and si == "1":
return "-1"
a += 1
b += 1
a = -x
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR VAR IF VAR NUMBER VAR STRING ASSIGN VAR VAR STRING IF VAR VAR VAR STRING ASSIGN VAR VAR STRING IF VAR NUMBER VAR VAR VAR STRING RETURN STRING VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FOR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for i in range(int(input())):
s = input()
n = len(s)
k = int(input())
w = [-1] * n
f = 0
for i in range(k):
if i + k < n:
w[i + k] = int(s[i])
elif i + k >= n and s[i] == "1":
print(-1)
f = 1
break
for i in range(k, n):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR FUNC_CALL VAR VAR VAR IF BIN_OP VAR VAR VAR VAR VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | tests = int(input())
for _ in range(tests):
string = list(input())
n = len(string)
x = int(input())
ans = list(n * "1")
for i in range(n):
if string[i] == "0":
if i + x < n:
ans[i + x] = "0"
if i - x >= 0:
ans[i - x] = "0"
check = [... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR STRING FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
INP = lambda: sys.stdin.readline().strip()
INT = lambda: int(INP())
MAP = lambda: map(int, INP().split())
ARR = lambda: [int(i) for i in INP().split()]
def JOIN(arr, x=" "):
return x.join([str(i) for i in arr])
def EXIT(x="NO"):
print(x)
exit()
def good(s2, s, n, x):
new = [0] * n
... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF STRING RETURN FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_DEF... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
def construct(A, x):
n = len(A)
B = [0] * n
for i in range(len(A)):
B.append(int(A[i]))
for i in range(n):
B.append(0)
C = [0] * n
for i in range(n):
C[i] = B[n + i - x] or B[n + i + x]
return C
for _ in range(t):
A = list(str(input()))
A ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR V... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for _ in range(int(input())):
s = "x" + input()
n = len(s)
x = int(input())
w = ["1"] * n
for i in range(1, n):
if s[i] == "0":
if i > x and i - x > 0 and i - x < n:
w[i - x] = "0"
if i + x < n:
w[i + x] = "0"
ans = "".join(w[1:])
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP STRING FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING IF VAR VAR BIN_OP VAR VAR NUMBER BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
s = input().strip()
n = len(s)
x = int(input())
outl = ["1"] * n
for i in range(n):
if s[i] == "0":
if i >= x:
outl[i - x] = "0"
if i + x < n:
outl[i + x] = "0"
... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_O... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | for t in range(int(input())):
s = input()
x = int(input())
l = ["1"] * len(s)
flag = 0
for i in range(len(s)):
if s[i] == "0":
if i + x < len(s):
l[i + x] = "0"
if i - x >= 0:
l[i - x] = "0"
l1 = []
a = ""
for i in range(len... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF BIN_OP VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR STRING IF BIN_OP VAR... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
def gift():
for _ in range(t):
string = input()
x = int(input())
n = len(string)
markpoint = []
Failed = False
for i in range(n):
if string[i] == "0":
markpoint.... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR DICT FOR VAR VAR IF BIN_O... |
Consider the following process. You have a binary string (a string where each character is either 0 or 1) $w$ of length $n$ and an integer $x$. You build a new binary string $s$ consisting of $n$ characters. The $i$-th character of $s$ is chosen as follows:
if the character $w_{i-x}$ exists and is equal to 1, then $... | t = int(input())
for i in range(t):
s = input().strip()
x = int(input())
n = len(s)
a = [-1] * n
for j in range(n):
if s[j] == "0":
q = 0
if j - x >= 0:
a[j - x] = 0
else:
q = q + 1
if j + x < n:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBE... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | import sys
n, k = map(int, input().split())
i = 0
cc = input()
while i < n and cc[i] == cc[0]:
i += 1
prefix = i
i = 0
while i < n - 1 and cc[-i - 1] == cc[-1]:
i += 1
suffix = i
if k + prefix >= n or k + suffix >= n or cc[0] == cc[-1] and k + prefix + suffix >= n:
print("tokitsukaze")
sys.exit(0)
cc0 ... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR VAR NUMB... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | n, k = map(int, input().split())
a = input()
A = 0
for i in range(n):
A += int(a[i])
s = 0
c = 0
W = False
L = False
D = False
for i in range(n):
s += int(a[i])
if i >= k:
s -= int(a[i - k])
c += int(a[i - k])
if i >= k - 1:
if s == A:
W = True
elif A - s + k ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR FUNC_CALL V... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | from sys import exit, stdin, stdout
n, k = map(int, stdin.readline().split())
s = stdin.readline().strip()
def z(winner):
return "tokitsukaze" if winner == 0 else "quailty"
ones = [i for i in range(n) if s[i] == "1"]
zeros = [i for i in range(n) if s[i] == "0"]
if not ones or not zeros:
print(z(0))
exi... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN VAR NUMBER STRING STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR STRING IF VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF BIN_OP BIN... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | n, k = map(int, input().split())
s = input()
def func(s):
num = 1
num2 = 1
for i in range(1, n):
if s[i] != s[i - 1]:
break
num += 1
for i in range(n - 1, 0, -1):
if s[i] != s[i - 1]:
break
num2 += 1
if k + num >= n or k + num2 >= n:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER IF BIN_OP VAR VAR ... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | n, k = map(int, input().strip().split())
t = input().strip()
l1 = t.rfind("1") - t.find("1") + 1
l2 = t.rfind("0") - t.find("0") + 1
if l1 <= k or l2 <= k:
print("tokitsukaze")
elif k < n // 2 or l1 > k + 1 or l2 > k + 1:
print("once again")
else:
print("quailty") | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING NUMBER ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR STRING FUNC_CALL VAR STRING NUMBER IF VAR VAR VAR VAR EXPR FUNC_CALL VAR STRING IF VAR BIN_OP VAR NUMBER ... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | import sys
def Check():
for j in [0, 1]:
if R[j][1] + L[j][n] + k >= n:
return 1
return 0
n, k = [int(i) for i in input().split()]
S = [int(i) for i in input()]
R = [[0] * (n + 2), [0] * (n + 2)]
L = [[0] * (n + 2), [0] * (n + 2)]
for j in [0, 1]:
L[S[0]][1] = 1
for i in range(1,... | IMPORT FUNC_DEF FOR VAR LIST NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR VAR VAR RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR ASSIGN VAR LIST BIN_OP LIST NUMBER BIN_OP VAR NUMBER BIN_OP LIST NUMBER BIN_OP VAR NUMBER... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | n = list(map(int, input().split()))
st = input()
i = 0
mas = []
while i < len(st):
mas.insert(i, int(st[i]))
i = i + 1
i = 0
cnt = 0
while i < n[0]:
if mas[i] == 1:
cnt = cnt + 1
i = i + 1
i = 0
cnt2 = 0
while i < n[1]:
if mas[i] == 1:
cnt2 = cnt2 + 1
i = i + 1
ans = 0
mn = cnt2
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST WHILE VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR BIN_OP... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | def win1():
if n == k or r[k + 1] == n or l[n - k] == 1:
return True
for i in range(2, n - k + 1):
if l[i - 1] == 1 and r[i + k] == n and a[i - 1] == a[i + k]:
return True
return False
def win2():
if 2 * k < n:
return False
for i in range(2, n - k + 1):
... | FUNC_DEF IF VAR VAR VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER IF VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF IF BIN_OP NUMBER VAR VAR RETURN NUMBER FOR ... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | n, k = map(int, input().split())
s = input()
fir0 = -1
last0 = -1
fir1 = -1
last1 = -1
for i in range(n):
if s[i] == "0":
if fir0 == -1:
fir0 = i
last0 = i
else:
if fir1 == -1:
fir1 = i
last1 = i
d0 = last0 - fir0
d1 = last1 - fir1
if min(d0, d1) < k:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN V... |
"Duel!"
Betting on the lovely princess Claris, the duel between Tokitsukaze and Quailty has started.
There are $n$ cards in a row. Each card has two sides, one of which has color. At first, some of these cards are with color sides facing up and others are with color sides facing down. Then they take turns flipping ca... | import sys
def sum_range(l, r):
if r < l:
return 0
if l == 0:
return sum[r]
return sum[r] - sum[l - 1]
n, k = map(int, input().split())
cards = input()
sum = [0] * n
sum[0] = 1 if cards[0] == "1" else 0
for i in range(1, n):
sum[i] += sum[i - 1]
if cards[i] == "1":
sum[i]... | IMPORT FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR NUMBER RETURN VAR VAR RETURN BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER STRING NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | def solve(i):
a = i * u
b = i * v
if k <= -a:
return 0
if k <= b:
return a + k
return a + b + 2 * (k - b)
for _ in range(int(input())):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
u = max(l1, l2) - min(r1, r... | FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR RETURN NUMBER IF VAR VAR RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR BIN_OP NUMBER BIN_OP 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 VAR FUNC_CALL VAR VAR FUN... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | for i in " " * int(input()):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l1 > l2:
l1, r1, l2, r2 = l2, r2, l1, r1
meeting = 0
if r1 > l2:
meeting = (min(r1, r2) - l2) * n
if meeting >= k:
print(0)
c... | FOR VAR BIN_OP STRING 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP BI... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
intersect_length = min(r1, r2) - max(l1, l2)
length = max(r1, r2) - min(l1, l2)
ans = 0
cost = 0
if intersect_... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
input = sys.stdin.readline
def intersection(a, b):
if a[0] >= b[0] and a[1] <= b[1]:
return -(a[1] - a[0])
if b[0] > a[1]:
return b[0] - a[1]
elif b[1] < a[0]:
return a[0] - b[1]
if a[1] < b[1]:
return b[0] - a[1]
return a[0] - b[1]
def check(a, b):
... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR NUMBE... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | 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())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l1 > l2:
p1 = l1
... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR V... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | T = int(input())
for _ in range(T):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
ans = 0
if k <= 0:
print(0)
elif l1 >= l2 and r1 <= r2:
k -= (r1 - l1) * n
if k <= 0:
print(0)
else:
... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR VAR BIN... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | for _ in range(int(input())):
ans = 1e18
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if min(r1, r2) >= max(l1, l2):
rem = max(0, k - n * (min(r1, r2) - max(l1, l2)))
poss = n * (abs(l1 - l2) + abs(r1 - r2))
ans = min(... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BI... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | for _ in range(int(input())):
n, k = map(int, input().split())
a, b = map(int, input().split())
c, d = map(int, input().split())
if d < b:
a, b, c, d = c, d, a, b
if a <= c <= b:
cur = (b - c) * n
(
print(max(k - cur, 0))
if (d - a) * n > 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR V... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | t = int(input())
for _ in range(0, t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if max(l1, l2) <= min(r1, r2):
cur_inter = n * (min(r1, r2) - max(l1, l2))
can_inter = n * (max(r1, r2) - min(l1, l2))
if k <= cur_inter:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP F... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | def anss1(stp, numneed, stc):
ans1 = stp
if stc >= numneed:
ans1 += numneed
else:
ans1 += stc
numneed -= stc
ans1 += 2 * numneed
return ans1
def anss2(stp, numneed, stc):
ans2 = 0
for i in range(n):
if i > 0 and numneed < stp:
ans2 += 2 * num... | FUNC_DEF ASSIGN VAR VAR IF VAR VAR VAR VAR VAR VAR VAR VAR VAR BIN_OP NUMBER VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR VAR VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER VAR VAR IF VAR VAR VAR VAR ASSIGN VAR NUMBER VAR VAR VAR VAR IF VAR NUMBER VAR BIN_OP NUMBER VAR RETURN VAR FOR V... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | T = int(input())
for _ in range(T):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l2 < l1:
l1, l2, r1, r2 = l2, l1, r2, r1
d = max(r1, r2) - min(l1, l2)
res = 0
if r1 < l2:
sd = l2 - r1
if k <= d * n:
... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VA... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | def solve():
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l1 > l2:
l1, r1, l2, r2 = l2, r2, l1, r1
gap = l2 - r1
if gap >= 0:
u = r1 - l1
v = r2 - l2
if u > v:
u, v = v, u
if k <= 0:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VA... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | def get_value(l, r, x, y):
return abs(l - x) + abs(r - y)
t = int(input())
for _ in range(t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
lmin, rmax = min(l1, l2), max(r1, r2)
ma = rmax - lmin
if ma * n <= k:
res = (
... | FUNC_DEF RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASS... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | from sys import stdin
for _ in range(int(stdin.readline())):
n, k = map(int, stdin.readline().split())
l1, r1 = map(int, stdin.readline().split())
l2, r2 = map(int, stdin.readline().split())
curr = max(0, min(r1, r2) - max(l1, l2)) * n
if curr > k:
print(0)
else:
sin_inc = min(a... | 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR IF VA... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | for tc in range(int(input())):
n, k = input().split(" ")
al, ar = input().split(" ")
bl, br = input().split(" ")
n, k, al, ar, bl, br = int(n), int(k), int(al), int(ar), int(bl), int(br)
if al > bl:
al, ar, bl, br = bl, br, al, ar
if ar < bl:
blank = bl - ar
get = br - al... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_CALL V... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l2 >= r1 or l1 >= r2:
if l1 >= r2:
l1, r1, l2, r2 = l2, r2, l1, r1
d = l2 - r1
ans = d
while n > 0:
n -= 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
input = sys.stdin.readline
def solve():
n, k = map(int, input().split())
avail = 0
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
if l2 < l1:
l1, l2 = l2, l1
r1, r2 = r2, r1
avail = max(r2, r1) - min(l1, l2)
if l2 <= r1:
overlap = ... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR FUN... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | from sys import stdin
tt = int(stdin.readline())
for loop in range(tt):
n, k = map(int, stdin.readline().split())
l1, r1 = map(int, stdin.readline().split())
l2, r2 = map(int, stdin.readline().split())
if l1 >= r2 or l2 >= r1:
ans = float("inf")
for usenum in range(1, n + 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER BIN_... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | t = int(input())
for _ in range(t):
n, k = list(map(int, input().split()))
l1, r1 = list(map(int, input().split()))
l2, r2 = list(map(int, input().split()))
if r1 > r2:
l1, r1, l2, r2 = l2, r2, l1, r1
overlap = max(0, r1 - max(l1, l2))
k -= overlap * n
if k <= 0:
print(0)
... | 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 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 IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR ... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | for _ in range(int(input())):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
ans = 0
if max(l1, l2) <= min(r1, r2):
k -= (min(r1, r2) - max(l1, l2)) * n
if k <= 0:
print(0)
else:
add = max(r1, r2)... | 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 FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR VAR BIN_OP BIN_OP FUNC_CALL VAR VA... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
readline = sys.stdin.buffer.readline
def even(n):
return 1 if n % 2 == 0 else 0
def main():
n, k = map(int, readline().split())
a = list(map(int, readline().split()))
b = list(map(int, readline().split()))
if a[0] > b[0]:
a, b = b, a
score = 0
cost = 0
score_init ... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN BIN_OP VAR NUMBER NUMBER NUMBER NUMBER 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 IF VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
input = sys.stdin.readline
t = int(input())
for ii in range(t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
inter, diff = 0, 0
left, right = max(l1, l2), min(r1, r2)
left1, right1 = min(l1, l2), max(r1, r2)
maxpos = right... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR ... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
l1, r1 = map(int, input().split())
l2, r2 = map(int, input().split())
mr = max(r1, r2) - min(l1, l2)
step = 2 * mr - (r1 - l1) - (r2 - l2)
over = max(0, min(r1, r2) - max(l1, l2))
dis = max(l1, l2) - min(r1, r2) if over == ... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
a, b = map(int, input().split())
c, d = map(int, input().split())
if c < a:
a, b, c, d = c, d, a, b
elif c == a and b < d:
a, b, c, d = c, d, a, b
count = 0
if b > c:
if d > b:
k -= (b - ... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR VAR VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR ... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
sys.setrecursionlimit(10**5)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def II():
return int(sys.stdin.readline())
def MI():
return map(int, sys.stdin.readline().split())
def LI():
return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number):
return [... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC... |
You are given two lists of segments $[al_1, ar_1], [al_2, ar_2], \dots, [al_n, ar_n]$ and $[bl_1, br_1], [bl_2, br_2], \dots, [bl_n, br_n]$.
Initially, all segments $[al_i, ar_i]$ are equal to $[l_1, r_1]$ and all segments $[bl_i, br_i]$ are equal to $[l_2, r_2]$.
In one step, you can choose one segment (either from ... | import sys
readline = sys.stdin.readline
def solve():
N, K = map(int, readline().split())
L1, R1 = map(int, readline().split())
L2, R2 = map(int, readline().split())
if L1 > L2:
L1, L2 = L2, L1
R1, R2 = R2, R1
if R1 < L2:
gap = L2 - R1
union = R2 - L1
ans =... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VA... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.