description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
arra = [([0] * 31) for i in range(n + 1)]
for num in range(n):
tempStr = bin(a[num])[2:][::-1]
for i in range(31):
arra[num + 1][i] = arra[num][i]
for i in range(len(tempStr)):
arra[num + 1][i] += int(tempStr[i])
... | 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 BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBE... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | from itertools import accumulate, repeat
R = lambda: map(int, input().split())
bits = lambda x: [(x >> i & 1) for i in range(31)]
add = lambda a, b: [sum(x) for x in zip(a, b)]
n, q = R()
s = [repeat(0)] + list(accumulate(map(bits, R()), add))
for _ in range(q):
l, r = R()
l -= 1
x = 0
for i, (sl, sr) ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FU... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | l = list(map(int, input().split()))
n = l[0]
q = l[1]
l1 = input().split()
for i in range(0, n):
l1[i] = "{:031b}".format(int(l1[i]))
matrix_count = list()
n1 = 0
while n1 < n:
count = [0] * 31
x = 0
matrix_count.append(count)
while x < 31:
if len(matrix_count) == 1:
if l1[n1][x]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP LIST NUMBER ... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | A = list(map(int, input().split()))
N = A[0]
Q = A[1]
A = list(map(int, input().split()))
bits = []
for i in range(N):
num = A[i]
bi = bin(num)
p = 33 - len(bi)
r = bi[:2] + p * "0" + bi[2:]
bits.append(r)
counts = []
for i in range(31):
sc = []
c = 0
for j in range(N):
if bits[j... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VA... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | def onesComp(s):
a = list(s)
for i in range(len(a)):
if a[i] == "1":
a[i] = "0"
else:
a[i] = "1"
return "".join(a)
def add(a, b):
s = [0] * len(a)
for i in range(len(a)):
s[i] = a[i] + b[i]
return s
n, q = list(map(int, input().split()))
a = li... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR VAR STRING ASSIGN VAR VAR STRING RETURN FUNC_CALL STRING VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR VAR RETURN VAR ASSIGN... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | def add_array(A, B):
return [(A[i] + B[i]) for i in range(len(A))]
def subtract_array(A, B):
return [(A[i] - B[i]) for i in range(len(A))]
values, queries = [int(i) for i in input().split()]
row = [0] * 31
cum_bit_counter = [list(row)]
for value in input().split():
counter = 0
value = int(value)
... | FUNC_DEF RETURN BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP VAR VAR VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FUNC_CALL VAR VAR FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | import sys
n, q = map(int, sys.stdin.readline().split())
a = list(map(int, sys.stdin.readline().split()))
v = [[0] * 31]
for i in range(n):
v.append(list("{0:031b}".format(a[i])))
for i in range(1, n + 1):
for j in range(31):
v[i][j] = int(v[i - 1][j]) + int(v[i][j])
for i in range(q):
ans = [0] * ... | IMPORT 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 LIST BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CAL... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | def prefix_sums(A):
res = []
for bit in range(31):
res_bit = []
cumsum = 0
for a in A:
cumsum += (a & 1 << bit) >> bit
res_bit.append(cumsum)
res.append(res_bit)
return res
def main():
N, Q = (int(_) for _ in input().split())
A = [0] + [int(x... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR BIN_OP BIN_OP VAR BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR V... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = map(int, input().split())
a = list(map(int, input().split()))
arr = [[(0) for i in range(31)] for j in range(n + 1)]
flag = False
for i in range(1, n + 1):
j = 0
for j in range(0, 31):
p = a[i - 1] % 2
arr[i][j] = arr[i - 1][j] + p
a[i - 1] >>= 1
j += 1
for i in range(q):
... | 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 NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBE... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | N, Q = map(int, input().split())
W = list(map(int, input().split()))
M = []
X = bin(W[0])
X = (33 - len(X)) * "0" + X[2:]
V = []
for C in range(31):
V.append(int(X[C]))
M.append(V)
for I in range(1, N):
X = bin(W[I])
X = (33 - len(X)) * "0" + X[2:]
K = []
for J in range(31):
K.append(M[I - 1... | 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 LIST ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR STRING VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | def build(arr, n, size=31):
dp = [[(0) for i in range(31)] for i in range(n + 1)]
for i, e in enumerate(arr, 1):
j = 0
for j in range(31):
dp[i][j] = dp[i - 1][j] + (e & 1)
e >>= 1
return dp
n, q = map(int, input().split())
arr = tuple(map(int, input().split()))
dp ... | FUNC_DEF NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_C... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = map(int, input().split())
a = [int(x) for x in input().split()]
bit_pref = [{i: (0) for i in range(31)} for j in range(n)]
for i in range(n):
num = a[i]
j = 0
for j in range(31):
if num & 1 << j:
if i == 0:
bit_pref[i][j] = 1
else:
bit_p... | 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 VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR IF VAR NUMBER... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = map(int, input().split())
arr = list(map(int, input().split()))
pres = [([0] * 31) for _ in range(n + 1)]
for i in range(1, n + 1):
j = bin(arr[i - 1])[2:]
j = j[::-1]
for k in range(len(j)):
pres[i][k] = int(j[k])
for i in range(1, n + 1):
for k in range(31):
pres[i][k] += pres[i... | 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 BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER ... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | a, b = map(int, input().split())
c = list(map(int, input().split()))
d = []
x = bin(c[0])
x = (33 - len(x)) * "0" + x[2:]
k = []
for i in range(31):
if x[i] == "0":
k.append(0)
else:
k.append(1)
d.append(k)
for i in range(1, a):
x = bin(c[i])
x = (33 - len(x)) * "0" + x[2:]
k = []
... | 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 LIST ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR STRING VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR STRING EXPR F... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = [int(__) for __ in input().strip().split()]
arr = [int(__) for __ in input().strip().split()]
le = len(bin(max(arr))) - 2
for i in range(len(arr)):
arr[i] = bin(arr[i])[2:].zfill(le)
dic = {}
for i in range(le):
x = arr[0][i]
pre = [1 if arr[0][i] == "1" else 0]
for j in range(1, n):
if a... | 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 BIN_OP FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER VAR ASSIGN VAR DI... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = map(int, input().split())
a = list(map(int, input().split()))
a1 = []
l1 = []
val = [0] * 31
a1.append(val[:])
for x in a:
w = "{0:b}".format(x)
w = w[::-1]
l1.append(len(w))
for i in range(len(w)):
if w[i] == "1":
val[i] += 1
a1.append(val[:])
for i in range(q):
l, r ... | 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 LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER NUMBER EXPR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR F... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | def count_bits(n: int) -> list:
count = [0] * 62
str2int = {"0": 0, "1": 31}
for i, b in enumerate(f"{n:031b}"):
count[i + str2int[b]] = 1
return count
def count_sum(c1: list, c2: list) -> list:
return [(i + j) for i, j in zip(c1, c2)]
def count_diff(c1: list, c2: list) -> list:
retu... | FUNC_DEF VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR DICT STRING STRING NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP VAR VAR VAR NUMBER RETURN VAR VAR FUNC_DEF VAR VAR RETURN BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR FUNC_DEF VAR VAR RETURN BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | n, q = [int(x) for x in input().split()]
a = [int(x) for x in input().split()]
binary = []
for x in a:
temp = "{0:b}".format(x)
temp = "0" * (31 - len(temp)) + temp
binary.append(temp)
binary = [list(map(int, p)) for p in binary]
t = []
for i in range(31):
t.append(0)
final = []
final.append(t)
for i in... | 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 LIST FOR VAR VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP NUMBER FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ... |
Read problems statements in Mandarin chinese, Russian and Vietnamese as well.
You are given a sequence A_{1}, A_{2}, ..., A_{N} and Q queries. In each query, you are given two parameters L and R; you have to find the smallest integer X such that 0 β€ X < 2^{31} and the value of (A_{L} xor X) + (A_{L+1} xor X) + ... + ... | import sys
x = 2
x = [int(x) for x in sys.stdin.readline().split()]
n = x[0]
q = x[1]
l = [int(n) for n in sys.stdin.readline().split()]
b = []
M = 0
for i in range(n):
t = []
drain = [int(x) for x in list(bin(l[i])[2:])]
for i in range(32 - len(drain)):
t.append(0)
t += drain[:]
if M < len... | IMPORT ASSIGN VAR NUMBER 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 LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
prefix = [0] * n
prefix[0] = arr[0]
for i in range(1, n):
prefix[i] = prefix[i - 1] ^ arr[i]
ans = 0
for i in range(n - 1):
for j in range(i + 1, n):
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_C... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
if len(arr) < 2:
return 0
xors = [i for i in arr]
for i in range(1, len(xors)):
xors[i] ^= xors[i - 1]
ans = 0
for j in range(1, len(xors)):
cnt = Counter([(xors[j - 1] ^ xors... | CLASS_DEF FUNC_DEF VAR VAR IF FUNC_CALL VAR VAR NUMBER RETURN NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR FUNC_C... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
preXor = [0] * (len(arr) + 1)
preXor[0] = arr[0]
for i in range(1, len(arr)):
preXor[i] = preXor[i - 1] ^ arr[i]
ret = 0
for i in range(len(arr) - 1):
l = preXor[i - 1]
for k ... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBE... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
res = 0
for i in range(len(arr) - 1):
accu = arr[i]
for k in range(i + 1, len(arr)):
accu ^= arr[k]
if not accu:
res += k - i
return res | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR BIN_OP VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
xor = arr.copy()
for i in range(1, len(xor)):
xor[i] ^= xor[i - 1]
print([bin(z) for z in arr])
print([bin(z) for z in xor])
count = 0
for i in range(len(arr) - 1):
for j in range... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
cum = [0]
for n in arr:
cum.append(cum[-1] ^ n)
ans = 0
for i in range(0, len(arr) - 1):
for k in range(i + 1, len(arr)):
for j in range(i + 1, k + 1):
if cum[... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
c = 0
xor = 0
for i in range(n - 1):
xor = arr[i]
for j in range(i + 1, n):
xor ^= arr[j]
if xor == 0:
c += j - i
return c | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR IF VAR NUMBER VAR BIN_OP VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
s = [0] * (len(arr) + 1)
for i in range(1, len(arr) + 1):
s[i] = s[i - 1] ^ arr[i - 1]
ans = 0
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
for k in range(j, len(arr... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_C... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
preXor = [0] * (len(arr) + 1)
for i, element in enumerate(arr):
preXor[i + 1] = preXor[i] ^ element
count = 0
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
for k in r... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
store = [0]
n = len(arr)
for i in range(n):
store.append(arr[i] ^ store[i])
ans = 0
print(store)
for i in range(1, n):
for k in range(i + 1, n + 1):
if store[i - 1... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
ans = 0
for i in range(n):
p1 = [0] * (n + 1)
p1[i] = arr[i]
for j in range(i + 1, n):
p1[j] = p1[j - 1] ^ arr[j]
p2 = [0] * (n + 1)
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | from itertools import accumulate
class Solution:
def countTriplets(self, nums: List[int]) -> int:
n, x = len(nums), list(accumulate(nums, lambda x, y: x ^ y, initial=0))
count = 0
for i in range(1, n + 1 - 1):
for j in range(i + 1, n + 1):
for k in range(j + 0,... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
ans = 0
print(len(arr[:-1]))
for key1 in range(len(arr[:-1])):
a = 0
for key2, j in enumerate(arr[key1:]):
a ^= j
b = 0
for k in arr[key2 + key1 + 1 :]:
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR IF VAR VAR VAR NUMBER RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
d = defaultdict(set)
s = 0
d[0].add(-1)
for i, x in enumerate(arr):
s ^= x
d[s].add(i)
return sum([(abs(a - b) - 1) for k in d for a, b in combinations(d[k], 2)]) | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CALL VAR NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR VAR VAR FUNC_CALL VAR VAR VAR NUMBER VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def allPrefixXor(self, arr: List[int]) -> List[int]:
prefix_xor: List[int] = [0] * len(arr)
prefix_xor[0] = arr[0]
for i in range(1, len(arr)):
prefix_xor[i] = prefix_xor[i - 1] ^ arr[i]
return prefix_xor
def allSegmentXor(self, arr: List[int]) -> Li... | CLASS_DEF FUNC_DEF VAR VAR VAR VAR VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR RETURN VAR VAR VAR FUNC_DEF VAR VAR VAR VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR BIN_OP LIST NUMBER FUNC_CALL VAR V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
arr = [0] + arr
res = 0
for k in range(1, len(arr)):
arr[k] ^= arr[k - 1]
for j in range(1, k + 1):
for i in range(1, j):
b = arr[k] ^ arr[j - 1]
a... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUM... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
count = 0
for j in range(1, n):
right_xor = collections.defaultdict(int)
curr_xor = 0
for k in range(j, n):
curr_xor ^= arr[k]
right_xor[curr_xor]... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR VAR IF VAR VAR VAR VAR VAR RE... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
prefix_xor = [arr[0]]
answer = 0
for i in range(1, len(arr)):
prefix_xor.append(prefix_xor[i - 1] ^ arr[i])
for i in range(len(arr)):
for j in range(i + 1, len(arr)):
a = prefix_x... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR NUMBER ASSIGN VAR BIN... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
xors = [arr[0]]
for i in range(1, len(arr)):
xors.append(xors[-1] ^ arr[i])
print(xors)
n = len(arr)
count = 0
for i in range(n - 1):
for j in range(i + 1, n):
tem... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR I... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
triplets = 0
for i, a in enumerate(arr):
subrange = []
for j, b in enumerate(arr[i:]):
j_absolute = i + j
if j_absolute == i:
subrange.append(b)
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF VAR NUMBER NUMBER VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
start = arr[0]
res = 0
for i in range(1, len(arr)):
start ^= arr[i]
arr[i] = start
arr = [0] + arr
for i in range(1, len(arr)):
for j in range(i + 1, len(arr)):
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUM... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
prefix = [arr[0]]
for i in range(1, len(arr)):
prefix.append(prefix[-1] ^ arr[i])
ans = 0
for i in range(1, len(prefix)):
for j in range(i + 1, len(prefix)):
if prefix[i - 1] ^ pr... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER VAR ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
res = 0
dp = [[(0) for i in range(len(arr))] for j in range(len(arr))]
for i in range(len(arr)):
for j in range(i, len(arr)):
a = 0
if j == i:
a = arr[i]
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR A... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
prefixes = [arr[0]]
result = 0
for i in range(1, n):
prefixes.append(arr[i] ^ prefixes[-1])
for i in range(n - 1):
for k in range(i + 1, n):
sub_array_xor = p... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR NUMBER VAR VAR BIN_OP VAR VAR VAR BIN_OP V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
prefix = [0] * (len(arr) + 1)
prefix[1] = arr[0]
res = 0
for i in range(1, len(arr)):
prefix[i + 1] = prefix[i] ^ arr[i]
print(prefix)
for i in range(len(arr) - 1):
for j in range... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
def xor(arr):
xor = 0
for a in arr:
xor ^= a
return xor
result = 0
for i in range(0, len(arr)):
for j in range(i + 1, len(arr)):
if xor(arr[i : j... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
ans, n = 0, len(arr)
xors = [0] * (n + 1)
for i in range(1, n + 1):
xors[i] = xors[i - 1] ^ arr[i - 1]
for i in range(n):
for k in range(i + 1, n):
if xors[k + 1] ^ xors[i] != 0:
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR BIN_OP V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
values = {}
for i in range(len(arr)):
val = 0
for j in range(i, len(arr)):
val ^= arr[j]
if val not in values:
values[val] = {"start": {}, "end": {}}
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR VAR VAR IF VAR VAR ASSIGN VAR VAR DICT STRING STRING DICT DICT IF VAR VAR VAR STRING ASSIGN VAR VAR STRING VAR NUMBER VAR VAR STRING VAR NUMBER IF VAR VAR VAR STRING ASSIG... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
ans = 0
for i in range(1, n):
l = Counter()
a = 0
for j in range(i - 1, -1, -1):
a ^= arr[j]
l[a] += 1
a = 0
for j in rang... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
res = xors = 0
freq = collections.defaultdict(int, {(0): 1})
_sum = collections.defaultdict(int)
for i in range(n):
xors ^= arr[i]
res += freq[xors] * i - _sum[xors]
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR DICT NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR VAR VAR NUMBER VAR VAR BIN_OP VAR NUMBER RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
res = 0
n = len(arr)
for i in range(n - 1):
tmp = arr[i]
for j in range(i + 1, n):
tmp = tmp ^ arr[j]
if tmp == 0:
res += j - i
return res | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR NUMBER VAR BIN_OP VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
N = len(arr)
A, pre = [arr[0]], arr[0]
for ii in arr[1:]:
pre ^= ii
A.append(pre)
res = 0
for ii in range(N):
for kk in range(ii + 1, N):
a_i, a_k = A[ii - 1] ... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR LIST VAR NUMBER VAR NUMBER FOR VAR VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR VAR BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR VAR IF... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, a: List[int]) -> int:
p = [a[0]]
for i in range(1, len(a)):
p.append(p[-1] ^ a[i])
ans = 0
for i in range(len(a) - 1):
for j in range(i + 1, len(a)):
v = p[j] ^ p[i] ^ a[i]
for k in range... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
count = 0
n = len(arr)
for i in range(n - 1):
x = arr[i]
for j in range(i + 1, n):
y = 0
for k in range(j, n):
y = y ^ arr[k]
if x ... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR RETURN VAR VA... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
l = len(arr)
if l == 1:
return 0
mat = [[(0) for i in range(l)] for i in range(l)]
for i in range(l - 1):
mat[i][i + 1] = arr[i] ^ arr[i + 1]
for j in range(i + 2, l):
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR B... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, A: List[int]) -> int:
res = cur = 0
count = {(0): [1, 0]}
for i, a in enumerate(A):
cur ^= a
n, total = count.get(cur, [0, 0])
res += i * n - total
count[cur] = [n + 1, total + i + 1]
return res | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR DICT NUMBER LIST NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR LIST NUMBER NUMBER VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR VAR LIST BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
memo = [arr[:] for _ in range(len(arr))]
for i in range(len(arr)):
tmp = arr[i]
for j in range(i + 1, len(arr)):
tmp ^= arr[j]
memo[i][j] = tmp
return sum(
[
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
res = 0
xors = [0] * (n + 1)
for z in range(n):
xors[z] = xors[z - 1] ^ arr[z]
for i in range(n - 1):
for j in range(i + 1, n):
for k in range(j, n):
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR IF BIN... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
if not arr:
return 0
x = [0, arr[0]]
for i in range(1, len(arr)):
x.append(x[-1] ^ arr[i])
cnt = 0
for i in range(1, len(x)):
for j in range(i + 1, len(x)):
fo... | CLASS_DEF FUNC_DEF VAR VAR IF VAR RETURN NUMBER ASSIGN VAR LIST NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
dp = [([0] * n) for i in range(n)]
for i in range(n):
dp[i][i] = arr[i]
for i in range(n - 1, -1, -1):
for j in range(i + 1, n):
dp[i][j] = dp[i][j - 1] ^ arr[j]
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR V... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
a = []
n = len(arr)
for i in range(n):
if i == 0:
a.append(arr[i])
else:
a.append(arr[i] ^ a[-1])
ans = 0
for i in range(n):
for j in range(i +... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
ans = 0
pool = dict()
pool[0, 0] = 0
pool[1, 1] = 0
for i in range(len(arr) - 1):
for j in range(i + 1, len(arr)):
if (i, j) not in pool:
a = pool[i, j - 1] ^ arr[... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR ... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
@lru_cache(None)
def xor_reduce(i, j):
if j - i == 1:
return arr[i] ^ arr[j]
else:
return xor_reduce(i + 1, j) ^ arr[i]
ans = 0
N = len(arr)
for i in ran... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR VAR VAR VAR RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR FUNC_CALL VAR NONE ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR VAR IF... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
n = len(arr)
if n < 2:
return 0
out = 0
for i in range(n - 1):
a = arr[i]
for j in range(i + 1, n):
b = 0
for k in range(j, n):
b ^... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
xor = [([0] * len(arr)) for _ in range(len(arr))]
for i in range(len(arr)):
for j in range(i, len(arr)):
if j == i:
xor[i][j] = arr[j]
else:
xor[i][j] ... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR F... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
def get_triplets(nums):
n = len(nums)
triplets = 0
i = 0
while i < n - 1:
lsum = nums[i]
j = i + 1
while j < n:
k = j
... | CLASS_DEF FUNC_DEF VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR VAR WHILE VAR VAR IF VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR NUM... |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
d = defaultdict(list)
d[0].append(-1)
cur, rst = 0, 0
for i, a in enumerate(arr):
cur ^= a
if i > 0:
for j in d[cur]:
rst += i - j - 1
d[cur].appen... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR IF VAR NUMBER FOR VAR VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
N = len(arr)
ans = 0
for i in range(N - 1):
v = arr[i]
l = [v]
for k in range(i + 1, N):
v ^= arr[k]
for w in l:
if v ^ w == w:
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR LIST VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR VAR FOR VAR VAR IF BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR VAR |
Given an array ofΒ integers arr.
We want to select three indices i, j and k where (0 <= i < j <= k < arr.length).
Let's define a and b as follows:
a = arr[i] ^ arr[i + 1] ^ ... ^ arr[j - 1]
b = arr[j] ^ arr[j + 1] ^ ... ^ arr[k]
Note that ^ denotes the bitwise-xor operation.
Return the number of triplets (i, j and k) ... | class Solution:
def countTriplets(self, arr: List[int]) -> int:
count = 0
for i in range(1, len(arr)):
arr[i] ^= arr[i - 1]
for i in range(0, len(arr) - 1):
for j in range(i + 1, len(arr)):
target = arr[j - 1]
if i > 0:
... | CLASS_DEF FUNC_DEF VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER VAR VAR BIN_OP VAR NUMBER FOR VA... |
Read problems statements in Mandarin Chinese, Russian and Vietnamese as well.
You are given an array of N integers. You should support the following queries on this array.
0 L R : Find the minimum integer in the range A_{L}, A_{L+1}, ..., A_{R}.
1 L R X : You should apply the assignment A[i] = A[i] & X, for all ind... | n, q = map(int, input().split())
global segment_tree, arr
arr = list(map(int, input().split()))
segment_tree = [0] * (4 * n)
class Node:
def __init__(self):
self.xory = 0
self.min_val = 10**9
def build_tree(start, end, treenode=0):
global segment_tree, arr
if start == end:
node ... | 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 BIN_OP LIST NUMBER BIN_OP NUMBER VAR CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF NUMBER IF VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN V... |
You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | from sys import gettrace, stdin
if gettrace():
def inputi():
return input()
else:
def input():
return next(stdin)[:-1]
def inputi():
return stdin.buffer.readline()
def patterns(s):
if len(s) == 1:
return [s, "_"]
else:
tp = patterns(s[1:])
retur... | IF FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF IF FUNC_CALL VAR VAR NUMBER RETURN LIST VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP BIN_OP VAR NUMBER VAR VAR VAR BIN_OP STRING VAR VAR VAR FUNC_DEF ASSIGN VAR VAR VAR FUNC_CAL... |
You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | import sys
input = sys.stdin.readline
def topological_sorted(digraph):
n = len(digraph)
indegree = [0] * n
for v in range(n):
for nxt_v in digraph[v]:
indegree[nxt_v] += 1
tp_order = [i for i in range(n) if indegree[i] == 0]
stack = tp_order[:]
while stack:
v = sta... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR VAR VAR VAR NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR... |
You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | import sys
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
N, M, K = map(int, input().split())
P = [""]
for i in range(N):
p = input().rstrip("\n")
P.append(p)
p2i = {p: i for i, p in enumerate(P)}
adj = [set() for _ in range(N + 1)]
fo... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR F... |
You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | 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.buffer.readline())
def MI():
return map(int, sys.stdin.buffer.readline().split())
def LI():
return list(map(int, sys.stdin.buffer.readline().split()))
def LLI(rows_... | 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 n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | import sys
input = lambda: sys.stdin.readline().rstrip("\r\n")
N, M, K = map(int, input().split())
P = []
D_P = {}
for i in range(N):
S = input()
P.append(S)
D_P[S] = i
adj = [[] for _ in range(N)]
indeg = [0] * N
for _ in range(M):
S, mt = input().split()
mt = int(mt) - 1
fp = P[mt]
if any... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_... |
You are given n patterns p_1, p_2, ..., p_n and m strings s_1, s_2, ..., s_m. Each pattern p_i consists of k characters that are either lowercase Latin letters or wildcard characters (denoted by underscores). All patterns are pairwise distinct. Each string s_j consists of k lowercase Latin letters.
A string a matches ... | import sys
I = sys.stdin.readlines()
N, M, K = map(int, I[0].split())
S = [I[i + 1][:-1] for i in range(N)]
D = dict()
for i in range(N):
D[S[i]] = i
T = [I[i + N + 1].split() for i in range(M)]
for i in range(M):
T[i][1] = int(T[i][1]) - 1
G = [[] for i in range(N)]
C = [0] * N
for i in range(M):
for j in... | IMPORT ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL ... |
You are given $n$ permutations $a_1, a_2, \dots, a_n$, each of length $m$. Recall that a permutation of length $m$ is a sequence of $m$ distinct integers from $1$ to $m$.
Let the beauty of a permutation $p_1, p_2, \dots, p_m$ be the largest $k$ such that $p_1 = 1, p_2 = 2, \dots, p_k = k$. If $p_1 \neq 1$, then the be... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, m = map(int, input().split())
t = {}
y = []
for _ in range(n):
z = list(map(int, input().split()))
q = [0] * (m + 1)
for i in range(m):
q[z[i]] = i + 1
x = t
for num in q[1:]:
... | IMPORT 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 DICT ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL ... |
You are given $n$ permutations $a_1, a_2, \dots, a_n$, each of length $m$. Recall that a permutation of length $m$ is a sequence of $m$ distinct integers from $1$ to $m$.
Let the beauty of a permutation $p_1, p_2, \dots, p_m$ be the largest $k$ such that $p_1 = 1, p_2 = 2, \dots, p_k = k$. If $p_1 \neq 1$, then the be... | t = int(input())
for _ in range(t):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
all = set()
for i in range(n):
prefix = ""
for j in range(m):
prefix += str(a[i].index(j + 1) + 1)
all.add(prefix)
res = []
for i 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 VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL ... |
You are given $n$ permutations $a_1, a_2, \dots, a_n$, each of length $m$. Recall that a permutation of length $m$ is a sequence of $m$ distinct integers from $1$ to $m$.
Let the beauty of a permutation $p_1, p_2, \dots, p_m$ be the largest $k$ such that $p_1 = 1, p_2 = 2, \dots, p_k = k$. If $p_1 \neq 1$, then the be... | import sys
def make_empty_dict(size):
return {idx: None for idx in range(1, size + 1)}
def make_tree(rev):
m = len(rev[0])
root = make_empty_dict(size=m)
for perm in rev:
tmp = root
for el in perm:
if tmp[el] is None:
tmp[el] = make_empty_dict(size=m)
... | IMPORT FUNC_DEF RETURN VAR NONE VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR FOR VAR VAR IF VAR VAR NONE ASSIGN VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR VAR... |
You are given $n$ permutations $a_1, a_2, \dots, a_n$, each of length $m$. Recall that a permutation of length $m$ is a sequence of $m$ distinct integers from $1$ to $m$.
Let the beauty of a permutation $p_1, p_2, \dots, p_m$ be the largest $k$ such that $p_1 = 1, p_2 = 2, \dots, p_k = k$. If $p_1 \neq 1$, then the be... | for _ in range(int(input())):
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
b = [([0] * m) for _ in range(n)]
for i in range(n):
for j in range(m):
a[i][j] -= 1
b[i][a[i][j]] = j
c = [set() for _ in range(m)]
for i in ran... | 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 VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMB... |
You are given $n$ permutations $a_1, a_2, \dots, a_n$, each of length $m$. Recall that a permutation of length $m$ is a sequence of $m$ distinct integers from $1$ to $m$.
Let the beauty of a permutation $p_1, p_2, \dots, p_m$ be the largest $k$ such that $p_1 = 1, p_2 = 2, \dots, p_k = k$. If $p_1 \neq 1$, then the be... | import sys
input = sys.stdin.readline
class TrieNode:
def __init__(self, v=None):
self.children = {}
self.val = v
self.end = False
def readList():
return list(map(int, input().split()))
def readInt():
return int(input())
def readInts():
return map(int, input().split())
... | IMPORT ASSIGN VAR VAR CLASS_DEF FUNC_DEF NONE ASSIGN VAR DICT ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR 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 FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF AS... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
pass
count = 0
for i in range(64):
for j in range(i + 1, 64):
for k in range(j + 1, 64):
binary = 0
binary |= 1 << i
binary |= 1 << j
binary |= ... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
pass
i = 1
c = 0
while i < R:
j = i << 1
while j < R:
k = j << 1
while k < R:
tmp = i | j | k
if L <= tmp and tmp <= R:
c +=... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
def binarySearch(a, n, x):
l, r = 0, n - 1
while l <= r:
m = (l + r) // 2
if a[m] == x:
return m
elif a[m] > x:
r = m - 1
else:
... | CLASS_DEF FUNC_DEF FUNC_DEF ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR RETURN VAR IF VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR RETURN VAR VAR... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def __init__(self):
self.allnos = []
def solve(self, L, R):
ans = 0
for i in range(len(self.allnos)):
if self.allnos[i] >= L and self.allnos[i] <= R:
ans += 1
return ans
def precompute(self):
for i in range(63):
... | CLASS_DEF FUNC_DEF ASSIGN VAR LIST FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR BIN_OP NUMBER V... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
ans = 0
tempans = 0
pi = 1
for i in range(65):
tempans += pi
pj = pi * 2
for j in range(i + 1, 65, 1):
tempans += pj
pk = pj * 2
for k in range(j + 1, 65, 1):
... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR BIN_OP VAR VAR VAR VAR NUMBER... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
a = [0] * 64
s = 0
c = 0
for i in range(0, 64):
a[i] = pow(2, i)
for i in range(0, 64):
for j in range(i + 1, 64):
for k in range(j + 1, 64):
s = a[i] + a[j] + a[k]
... | CLASS_DEF FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | from itertools import combinations as com
def binatodeci(binary):
return sum(val * 2**idx for idx, val in enumerate(reversed(binary)))
def postobina(arr, n):
res = [(0) for i in range(n)]
for ele in arr:
res[ele] = 1
return res
class Solution:
def solve(self, L, R):
br = [int(... | FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR ASSIGN VAR VAR NUMBER RETURN VAR CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CA... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
answer = 0
my_range = 64
for i in range(my_range):
for j in range(i + 1, my_range):
for k in range(j + 1, my_range):
tmp_answer = (1 << i) + (1 << j) + (1 << k)
if tmp_answer >= L and ... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR BIN_OP NUMBER VAR BIN_OP NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def get_count(self, n):
binary = bin(n)
ind = 3
count = 0
l = len(binary)
for i in range(l):
if binary[i] == "1":
count += self.dp[l - i - 1][ind]
ind -= 1
if ind < 1:
count += 1
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VA... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
num1 = L
num2 = R
bin_num1 = format(num1, "b")
bin_num2 = format(num2, "b")
Km = len(bin_num1) - 1
Kn = len(bin_num2) - 1
res_num1, num1_second_pos, num1_third_pos = self.addBinaryDigits(bin_num1)
res_num2, num2_... | CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def linear_search(self, target):
for i in range(len(self.valid)):
if self.valid[i] >= target:
return i
def solve(self, L, R):
n = len(self.valid)
lower_ind = self.linear_search(L)
higher_ind = self.linear_search(R)
if self.val... | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR NUMBER RETURN BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_C... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def solve(self, L, R):
lb = self.to_bin(L)
rb = self.to_bin(R)
while len(lb) < len(rb):
lb.append(0)
lpos = [i for i, x in enumerate(lb) if x]
rpos = [i for i, x in enumerate(rb) if x]
return self.ranking(rpos, 3) - self.ranking(lpos, 3) +... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR VAR RETURN BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR ... |
Akku likes binary numbers and she likes playing with these numbers. Her teacher once gave her a question.For given value of L and R, Akku have to find the count of number X, which have only three-set bits in it's binary representation such that "L β€ X β€ R".Akku is genius, she solved the problem easily. Can you do it ?... | class Solution:
def __init__(self):
self.tsl = self.precompute()
def solve(self, L, R):
def bsf(arr, k):
n = len(arr)
l, h, idx = 0, n - 1, 0
while l <= h:
m = (l + h) // 2
if arr[m] > k:
h = m - 1
... | CLASS_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER BIN_OP VAR NUMBER 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 VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_... |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | def reVal(num):
if num >= 0 and num <= 9:
return chr(num + ord("0"))
else:
return chr(num - 10 + ord("A"))
class Solution:
def noofbits(self, inputNum, base):
index = 0
res = ""
count = 0
while inputNum > 0:
res += reVal(inputNum % base)
... | FUNC_DEF IF VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR STRING RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR STRING CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR NUMBER WHILE VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP ... |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def baseEquiv(self, n, m):
for i in range(2, 33):
if pow(i, m - 1) > n:
continue
if pow(i, m) > n:
return "Yes"
return "No" | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER IF FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR IF FUNC_CALL VAR VAR VAR VAR RETURN STRING RETURN STRING |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def baseEquiv(self, n, m):
for i in range(2, 33):
count = 0
temp = n
for j in range(m):
if not temp:
break
temp = int(temp / i)
count += 1
if temp == 0 and count == m:
... | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER VAR VAR RETURN STRING RETURN STRING |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def baseEquiv(self, n, m):
for base in range(2, 33):
if self.find_basevalue(n, base) == m:
return "Yes"
return "No"
def find_basevalue(self, n, base):
if n < base:
return 1
return self.find_basevalue(n // base, base) + 1 | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER IF FUNC_CALL VAR VAR VAR VAR RETURN STRING RETURN STRING FUNC_DEF IF VAR VAR RETURN NUMBER RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR VAR VAR NUMBER |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def baseEquiv(self, n, m):
for i in range(2, 32):
if i ** (m - 1) > n:
return "No"
elif i**m - 1 < n:
pass
else:
return "Yes"
return "No" | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER VAR RETURN STRING IF BIN_OP BIN_OP VAR VAR NUMBER VAR RETURN STRING RETURN STRING |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def cntbit(self, n, base):
cnt = 0
while n > 0:
cnt += 1
n = n // base
return cnt
def baseEquiv(self, n, m):
i = 2
j = 32
while i <= j:
mid = (i + j) // 2
bcnt = self.cntbit(n, mid)
if b... | CLASS_DEF FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN... |
Given a number (n) and no. of digits (m) to represent the number, we have to check if we can represent n using exactly m digits in any base from 2 to 32.
Example 1:
Input: n = 8, m = 2
Output: Yes
Explanation: Possible in base 3 as 8 in base 3 is 22.
Example 2:
Input: n = 8, m = 3
Output: No
Explanation: Not possibl... | class Solution:
def baseEquiv(self, n, m):
for i in range(2, 33):
count = m
val = n
while val > 0:
val = val // i
count -= 1
if count == 0:
return "Yes"
return "No" | CLASS_DEF FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER RETURN STRING RETURN STRING |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.