description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) def solve(): n = int(input()) arr = map(int, input().split()) s = x = 0 for i in arr: s += i x ^= i if s & 1 == 1: print(3) x ^= 1 s += 1 print(1, x, s + x) else: print(2) print(x, s + x) for _ in range(t): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR BIN_OP VAR VAR EXPR FUNC...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
r = lambda: map(int, input().split()) I = lambda: int(input()) for _ in range(I()): n = I() summ, xorr = 0, 0 for i in r(): summ += i xorr ^= i diff = summ - xorr * 2 if abs(diff) % 2: a = 10**16 + 1 summ += a xorr ^= a b = c = xorr - summ // 2 els...
ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER IF BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
import sys INF = 10**10 T = int(input()) for ti in range(T): n = int(input()) A = input().split() A = [int(k) for k in A] x, s = 0, 0 for ai in A: s += ai x ^= ai print(2) print(str(x) + " " + str(s + x))
IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
q = int(input()) for _ in range(q): n = int(input()) a = [int(x) for x in input().split()] b = 0 for x in a: b = b ^ x c = sum(a) + b print("2") print(b, c)
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR VAR
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for x in range(int(input())): n = int(input()) ls = list(map(int, input().split())) sum = 0 xorSum = 0 for y in ls: sum += y xorSum ^= y app = [] if sum == xorSum << 1: print("0\n") continue app.append((1 << sum.bit_length() + 1) - sum) sum += app[0] ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR ASSIGN VAR LIST IF VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP BIN_OP ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) while t != 0: n = int(input()) list1 = list(map(int, input().split())) s, x = 0, 0 for i in range(n): x = x ^ list1[i] s = s + list1[i] print(2) print(x, x + s) t -= 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def xsum(a): result = 0 for aa in a: result ^= aa return result def solve(): n = int(input()) a = list(map(int, input().split())) x, y = sum(a), xsum(a) print(2) print(y, x + y) def main(): t = int(input()) for _ in range(t): solve() main()
FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) total = sum(a) ans = a[0] for i in range(1, n): ans = ans ^ a[i] if total == 2 * ans: print(0) print("") continue x = ans if total % 2 == 1: nums = [3] ans =...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
import sys input = sys.stdin.readline t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) s = a[0] + 0 xs = a[0] + 0 for i in range(n - 1): s += a[i + 1] xs ^= a[i + 1] if s == 2 * xs: print(0) print() else: res = ...
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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR BIN_OP ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for _ in range(int(input())): a = int(input()) s1 = list(map(int, input().split())) xx = 0 for i in range(a): xx ^= s1[i] ss = sum(s1) if 2 * xx == ss: print("0") print() elif xx == 0: print("1") print(ss) else: print("2") print(xx,...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR IF VAR NU...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
q = int(input()) while q: n = int(input()) a = list(map(int, input().split())) xorr = 0 summ = 0 for i in range(n): xorr = xorr ^ a[i] summ += a[i] if 2 * xorr == summ: print(0) print() elif 2 * xorr > summ: if (2 * xorr - summ) % 2 == 0: p...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def xor(l): s = 0 for i in range(len(l)): s ^= l[i] return s for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) x = xor(l) s = sum(l) if 2 * x == s: print(0) print() else: print(2) print(x, s + x)
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR RETURN 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for i in range(0, t): n = int(input()) b = input().split(" ") s = 0 x = 0 numeros = [] for j in range(0, n): b[j] = int(b[j]) s += b[j] x = x ^ b[j] if s == x * 2: pass elif s % 2 == 0 and s <= x * 2: numeros.append(int((2 * x - s)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR IF ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for _ in range(t): n = int(input()) a = list(input().split()) a = [int(x) for x in a] s = sum(a) xor = 0 for x in a: xor ^= x if s == 2 * xor: print(0) print() elif s % 2 == 0 and s < 2 * xor: print(2) print(int((2 * xor - s) / 2),...
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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
q = int(input()) for _ in range(q): n = int(input()) sum = 0 a = list(map(int, input().split())) for i in range(0, n): sum += a[i] x = a[0] for i in range(1, n): x ^= a[i] print("2") sum += x print(x, sum)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR EXPR FUNC_CALL VAR ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) while t: t -= 1 n = int(input()) a = list(map(int, input().split())) s = sum(a) x = 0 for i in a: x ^= i if x * 2 == s: print(0) print() continue print(2) f = x se = s + x print(f, se)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for _ in range(t): input() arr = tuple(map(int, input().split())) xor = 0 for ele in arr: xor = xor ^ ele print(2) print(xor, xor + sum(arr))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR FUNC_CALL VAR VAR
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def xor_of_array(n): res = 0 for i in n: res = res ^ i return res for _ in [0] * int(input()): lens = int(input()) arrs = [int(x) for x in input().split()] sum_arrs = sum(arrs) xor_arrs = xor_of_array(arrs) print(2) print(xor_arrs, xor_arrs + sum_arrs)
FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR RETURN VAR FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) while t > 0: n = int(input()) list = [int(i) for i in input().split()] som = 0 xor = 0 for i in range(n): xor ^= list[i] som += list[i] if som == 2 * xor: print(0) print() else: print(2) print(xor, som + xor) t -= 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for _ in range(int(input())): n = int(input()) l = [*map(int, input().split())] total = sum(l) xor = 0 for i in l: xor ^= i if total == 2 * xor: print(0) print() elif xor == 0: print(3) print(total + 2, 1, 1) else: print(2) print(xo...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUM...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) a_sum = 0 a_xor = 0 for x in a: a_sum += x a_xor ^= x if a_sum == 2 * a_xor: print(0) print() else: b1 = a_xor a_sum += b1 a_xor ^= b1 asse...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
h = int(input()) while h > 0: n = int(input()) h -= 1 s = 0 x = 0 k = list(map(int, input().split())) for l in k: s += l x = x ^ l print(2) print(x, s + x)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) while t: t -= 1 n = int(input()) a = list(map(int, input().strip().split(" "))) y = sum(a) x = a[0] for i in a[1:]: x ^= i if y == 2 * x: print(0) print() elif x == 0: print(1) print(y) else: print(2) print(x, y...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR VAR VAR NUMBER VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUN...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) ans = [] val = 0 for i in a: val ^= i if val > 0: ans.append(val) ans.append(sum(a) + val) else: ans.append(sum(a)) print(len(ans)) print(*ans)
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR FUNC_C...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) LARGE = 2 << 55 for _ in range(t): n = int(input()) l = list(map(int, input().split())) l.append(LARGE) s = sum(l) if s % 2: s += 1 l[-1] += 1 x = 0 for v in l: x ^= v assert s < 2 * x diff = 2 * x - s print(3) print(l[-1], diff // 2, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR NUMB...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for _ in range(int(input())): n = int(input()) l = [int(i) for i in input().split(" ", n - 1)] s = 0 x = 0 for i in range(len(l)): s += l[i] x = x ^ l[i] print(2) print(x, s + x)
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 VAR FUNC_CALL FUNC_CALL VAR STRING BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
N = int(input()) for _ in range(N): n = int(input()) k = 0 seq = list(map(int, input().split())) s = sum(seq) for i in seq: k ^= i if k * 2 == s: print(0) print() continue ans = [] if k: ans.append(k) s += k ans.append(s) print(len(ans)...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR L...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def stats(a): x, s = 0, 0 for v in a: x ^= v s += v return x, s for _ in range(int(input())): n = int(input()) a = list(map(int, input().split())) x, s = stats(a) print(2) print(x, s + x)
FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR VAR VAR VAR VAR RETURN 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR B...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for _ in range(t): n = int(input()) a = [int(x) for x in input().split()] actXor = 0 for i in a: actXor ^= i suma = sum(a) if suma == 2 * actXor: print(0) print("") else: print(2) print(actXor, suma + actXor)
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
T = int(input()) def solve(): N = int(input()) A = list(map(int, input().split())) xor = 0 sm = 0 for a in A: xor ^= a sm += a print(2) print(xor, sm + xor) for _ in range(T): solve()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def main(): def solve(): n = int(input()) aa = [int(a) for a in input().split()] sum = 0 xor = 0 for a in aa: sum += a xor ^= a print(2) print(xor, xor + sum) q = int(input()) for _ in range(q): solve() main()
FUNC_DEF FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CAL...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for q in range(t): n = int(input()) a = list(map(int, input().split())) ans1 = 0 ans2 = 0 for i in range(len(a)): ans1 += a[i] ans2 = ans2 ^ a[i] v = 2 print(3) if ans1 % 2 == 1: c2 = ans2 c1 = ans1 c1 += 2**55 + 1 c2 = c2 ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR NUMBER EXPR FUNC_CAL...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) for i in range(t): n = int(input()) a = list(map(int, input().split())) res = 0 sa = 0 for i in a: res ^= i sa += i if sa % 2: mnum = (1 << 59) - 1 else: mnum = 1 << 59 res = (mnum ^ res) * 2 snum = (res - sa - mnum) // 2 print(3) ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP ...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
def solve(arr): xor = 0 for i in arr: xor ^= i return [xor, sum(arr) + xor] T = int(input()) for i in range(T): _ = int(input()) arr = list(map(int, input().split())) print(len(solve(arr))) print(" ".join(map(str, solve(arr))))
FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN LIST VAR BIN_OP FUNC_CALL VAR 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR EXPR F...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
for tc in [0] * int(input()): n = int(input()) l = list(map(int, input().split())) x = l[0] for i in l[1:]: x = x ^ i xx = sum(l) if 2 * x == xx: print(0) print() else: print(2) print(x, xx + x)
FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CA...
Let's call an array $a_1, a_2, \dots, a_m$ of nonnegative integer numbers good if $a_1 + a_2 + \dots + a_m = 2\cdot(a_1 \oplus a_2 \oplus \dots \oplus a_m)$, where $\oplus$ denotes the bitwise XOR operation. For example, array $[1, 2, 3, 6]$ is good, as $1 + 2 + 3 + 6 = 12 = 2\cdot 6 = 2\cdot (1\oplus 2 \oplus 3 \oplu...
t = int(input()) z = [] k = [] for i in range(t): x = [] n = int(input()) a = list(map(int, input().split())) sum1 = sum(a) xor = 0 for j in range(len(a)): xor = xor ^ a[j] if sum1 == 2 * xor: z.append(0) else: x.append(xor + sum1) x.append(xor) k....
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN...
Xorq has invented an encryption algorithm which uses bitwise XOR operations extensively. This encryption algorithm uses a sequence of non-negative integers $x=[x[1],x[2]\cdots x[n]]$ as its key. To implement this algorithm efficiently, Xorq needs to find maximum value of $(a\oplus x_j)$ for given integers $\class{ML__b...
for _ in range(int(input())): N, Q = map(int, input().split()) x = list(map(int, input().split())) assert len(x) == N queries = [] for j in range(Q): a, p, q = map(int, input().split()) assert 1 <= p <= q <= N queries.append((q - 1, p - 1, a, j)) assert len(queries) == Q ...
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 FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER VAR VAR VAR EX...
Xorq has invented an encryption algorithm which uses bitwise XOR operations extensively. This encryption algorithm uses a sequence of non-negative integers $x=[x[1],x[2]\cdots x[n]]$ as its key. To implement this algorithm efficiently, Xorq needs to find maximum value of $(a\oplus x_j)$ for given integers $\class{ML__b...
def build_trie(sequence): root = [None, None, [], []] for idx, item in enumerate(sequence): current = root for shift in range(14, -1, -1): bit = item >> shift & 1 if current[bit] is None: current[bit] = [None, None, [], []] current[bit + 2].app...
FUNC_DEF ASSIGN VAR LIST NONE NONE LIST LIST FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR NONE ASSIGN VAR VAR LIST NONE NONE LIST LIST EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR ...
Xorq has invented an encryption algorithm which uses bitwise XOR operations extensively. This encryption algorithm uses a sequence of non-negative integers $x=[x[1],x[2]\cdots x[n]]$ as its key. To implement this algorithm efficiently, Xorq needs to find maximum value of $(a\oplus x_j)$ for given integers $\class{ML__b...
def normalized_bin(x): x = [int(t) for t in bin(x)[2:]] return [0] * (15 - len(x)) + x def add_list(data, L, f, t, p): if L[f][1] & p: data[1] = {"w": data["w"] if "w" in data else sorted(i for i, v in L[f:t])} if p > 1: add_list(data[1], L, f, t, p >> 1) return if ...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR NUMBER RETURN BIN_OP BIN_OP LIST NUMBER BIN_OP NUMBER FUNC_CALL VAR VAR VAR FUNC_DEF IF BIN_OP VAR VAR NUMBER VAR ASSIGN VAR NUMBER DICT STRING STRING VAR VAR STRING FUNC_CALL VAR VAR VAR VAR VAR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER VAR VAR VAR ...
Xorq has invented an encryption algorithm which uses bitwise XOR operations extensively. This encryption algorithm uses a sequence of non-negative integers $x=[x[1],x[2]\cdots x[n]]$ as its key. To implement this algorithm efficiently, Xorq needs to find maximum value of $(a\oplus x_j)$ for given integers $\class{ML__b...
from sys import stderr MAXBITS = 15 def main(): ncases = int(input()) for case in range(ncases): arrsize, nqueries = readints() arr = readints() assert arrsize == len(arr) finder = XORkeyfinder(arr) for query in range(nqueries): a, start, stop = readints() ...
ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR FUNC_...
Given two arrays A and B each of length N. Find the value \sum_{i=1}^N\sum_{j=1}^N \max(A_{i}\oplus B_{j},A_{i}\& B_{j}). Here \oplus and \& denote the [bitwise XOR operation] and [bitwise AND operation] respectively. ------ Input Format ------ - The first line of input contains a single integer T - the number...
import sys input = sys.stdin.readline for t in range(int(input())): n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) setbit = [(0) for i in range(20)] msbbit = [(0) for i in range(20)] mat = [[(0) for i in range(20)] for j in range(20)] tot = 0 fo...
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 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 ASSIGN VAR NUMBER VAR FUNC_CALL ...
Given two arrays A and B each of length N. Find the value \sum_{i=1}^N\sum_{j=1}^N \max(A_{i}\oplus B_{j},A_{i}\& B_{j}). Here \oplus and \& denote the [bitwise XOR operation] and [bitwise AND operation] respectively. ------ Input Format ------ - The first line of input contains a single integer T - the number...
def get_msb(n): ans = -1 for j in range(21): if 1 << j & n: ans = j return ans for _ in range(int(input())): N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) msb = [0] * 21 bits = [0] * 21 bit_table = [([0] * 21) for j in ...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR VAR RETURN 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CA...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for i in range(t): n, ki = map(int, input().split()) a = list(map(int, input().split())) l = [] for j in range(n): l.append(bin(a[j]).replace("0b", "")) for b in range(n): l[b] = int(l[b]) ans = 0 m = [ 0, 0, 0, 0, 0, ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR VAR STRING STRING FOR VAR FUNC_CALL VAR VA...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
no_of_cases = int(input()) for i in range(0, no_of_cases): lenght, operation = map(int, input().split()) arr = list(map(int, input().split())) steps = 0 for k in range(0, 32): count = 0 for index in range(0, lenght): if arr[index] % 2 == 0: arr[index] = arr[in...
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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR N...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
we = int(input()) for i in range(we): n, k = map(int, input().split()) l = list(map(int, input().split())) c = 0 g = [] for i in l: d = str(bin(i)) d = d[2:] g.append([d, len(d)]) if len(d) > c: c = len(d) r = [] for i in g: y = [] ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER EXPR FUNC_CALL VAR L...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
try: for i in range(int(input())): n, k = map(int, input().split()) arr = list(map(int, input().split())) binary = [] for i in range(0, 31): binary.append(0) for j in range(n): if arr[j] % 2 != 0: binary[i] += 1 ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR NUMBER NUMBER VAR VAR NU...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) while t > 0: n, k = map(int, input().split()) l = list(map(int, input().split())) bit = [(0) for i in range(32)] for i in l: for x in range(0, 32): val = i & 1 << x if val != 0: bit[x] += 1 ans = 0 for i in bit: if i % k ==...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR NU...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
def gcd(a, b): if b == 0: return a return gcd(b, a % b) t = int(input()) while t: t -= 1 a, b = input().split() a, b = int(a), int(b) lis = list(map(int, input().split())) bit = [(0) for _ in range(32)] for i in range(32): for j in lis: if j & 1 << i: ...
FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CA...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
test_case = int(input()) for i in range(test_case): n, k = map(int, input().split()) lst = tuple(map(int, input().split())) binary_cnt = [0] * 32 for j in lst: count = 0 while j > 0: if j & 1 == 1: binary_cnt[count] += 1 j = j // 2 coun...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER ASSI...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
def decimalToBinary(n): return bin(n).replace("0b", "") def count(A, K): A_bin = [] p = len(str(decimalToBinary(max(A)))) for i in A: A_bin.append(str(decimalToBinary(i)).rjust(p, "0")) ans = 0 for i in range(p): count = 0 for j in A_bin: if j[i] == "1": ...
FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING FUNC_DEF ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR V...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
n = int(input()) for i in range(n): N, P = map(int, input().split()) l = list(map(int, input().split())) a = 0 q = [] for i in range(N): p = bin(l[i]) p = p[2:] W = len(p) q.append((32 - W) * "0" + p) for i in range(32): c = 0 for j in range(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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for t in range(int(input())): N, k = map(int, input().split()) l = list(map(int, input().split())) data = {} for x in l: b = str(bin(x)) w = b[2:][::-1] q = 0 for i in w: if i == "1": try: data[q] += 1 except...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VA...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for _ in range(t): inn = input() n, k = map(int, inn.split(" ")) inn = input() arr = list(map(int, inn.split(" "))) total = 0 res = 0 for i in range(0, 32): total = 0 for j in range(0, len(arr)): if arr[j] & 1: total += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMB...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) while t: t -= 1 ans = 0 N, K = input().split() n = int(N) k = int(K) arr = [int(i) for i in input().split()] for i in range(32): count = 0 for j in range(n): if arr[j] != 0: if arr[j] & 1: count += 1 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMB...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) while t: t -= 1 l = [int(i) for i in input().split(" ")] n = l[0] k = l[1] a = [int(i) for i in input().split(" ")] sm = 0 for _ in range(32): count = 0 for i in range(n): if a[i] != 0: count += a[i] & 1 a[i] = a[i] >> ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR V...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for _ in range(int(input())): n, k = map(int, input().split(" ")) arr = list(map(int, input().split(" "))) carr = [(0) for i in range(32)] for i in arr: bnum = bin(i)[2:][::-1] for j in range(len(bnum)): carr[j] += int(bnum[j]) ans = 0 for i in carr: ans += (i...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VA...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) s = [(0) for i in range(32)] for i in a: temp = bin(i).replace("b", "0") l = 0 for i in range(len(temp) - 1, -1, -1): s[31 - l] += int(temp[i]) l += 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR NUMBER FOR V...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
T = int(input()) while T: n, k = map(int, input().split(" ")) arr = map(int, input().split(" ")) ans = 0 d = {} for i in arr: bn = bin(i).replace("0b", "")[::-1] for j in range(len(bn)): if bn[j] == "0": continue if j in d: d[j]...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR DICT FOR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR I...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for _ in range(int(input())): n, k = map(int, input().split()) a = [*map(int, input().split())] q = [0] * 32 for i in a: p = 0 while i: q[p] += i & 1 i >>= 1 p += 1 print(sum((i + k - 1) // k for i in q))
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 LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL V...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for _ in range(int(input())): n, k = map(int, input().split()) a = list(map(int, input().split())) bin = [0] * 32 for y in range(32): for j in a: if j & 1 << y: bin[y] += 1 res = 0 for i in bin: if i % k == 0: res += i // k else: ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER FOR...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) while t > 0: t -= 1 n, k = map(int, input().split()) arr = list(map(int, input().split())) lst = [0] * 32 for x in arr: i = 0 while x: lst[i] += x & 1 x >>= 1 i += 1 ans = 0 for x in lst: ans += (x + k - 1) // k ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER ASSI...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for i in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) op_num = 0 p = 0 while p != -1: ones_to_change = 0 for j in range(n): if a[j]: ones_to_change += a[j] % 2 a[j] //= 2 op_num += ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR BIN_OP VAR VAR NUMB...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for i in range(t): x = input().split() n, k = tuple(map(int, x)) x = input().split() a = list(map(int, x)) ele = [] for j in range(0, 31): ele.append(0) for p in range(0, n): if a[p] % 2 != 0: ele[j] += 1 a[p] = int(a[p] / ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR F...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for _ in range(int(input())): N, K = map(int, input().split()) cnt = [0] * 30 A = [*map(int, input().split())] for x in A: for j in range(30): if x >> j & 1: cnt[j] += 1 print(sum((x + K - 1) // K for x in cnt))
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 BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL V...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) final = [] for _ in range(t): n, k = map(int, input().split()) a = list(map(int, input().split())) max_len = len(bin(max(a))[2:]) for x in range(n): a[x] = bin(a[x])[2:] for x in range(n): if len(a[x]) < max_len: p = max_len - len(a[x]) a[x] =...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL ...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for _ in range(t): n, k = input().split() n = int(n) k = int(k) arr = list(map(int, input().split())) count_arr = [(0) for _ in range(32)] for v in arr: for i in range(32): if v & 1 << i: count_arr[i] += 1 ans = 0 for i in range(32): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
t = int(input()) for _ in range(t): n, k = map(int, input().split()) l = [int(i) for i in input().split()] binary = [] for i in l: binary.append(bin(i).replace("0b", "")) res = [(0) for i in range(32)] for i in range(n): tmp = binary[i] c = 31 for i in range(len(t...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR F...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
for _ in range(int(input())): n, k = map(int, input().split()) x = list(map(int, input().split())) xd = {} for i in range(n): if x[i] > 0: temp = bin(x[i])[2:] for j in range(len(temp) - 1, -1, -1): if temp[j] == "1": xd[len(temp) - 1 -...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR VAR IF VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR...
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well. Given an array A_{1}, A_{2} \ldots A_{N}, find the minimum number of operations (possibly zero) required to convert all integers in A to 0. In one operation, you choose a non-negative integer p (p β‰₯ 0), select at most K ind...
import sys for i in range(int(input())): n, k = map(int, input().split()) a = list(map(int, sys.stdin.readline().split())) m = max(a) if m == 0: print(0) continue m = len("{0:b}".format(m)) for x in range(n): a[x] = "{0:b}".format(a[x]) a[x] = "0" * (m - len(a[x]...
IMPORT FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR FOR VAR FUNC_CALL VAR VA...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) for _ in range(t): n = int(input()) bl = list(map(int, input().split())) agg = 0 flag = True for i in range(n - 1): if bl[i] ^ bl[i + 1] > bl[i + 1]: flag = False break temp = "{0:b}".format(bl[i]) agg += temp.count("1") if flag: ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR ...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
import sys T = int(sys.stdin.readline()) for _ in range(T): N = int(sys.stdin.readline()) B = list(map(int, sys.stdin.readline().split())) k = 0 for i in range(len(B) - 1): if bin(B[i] & ~B[i + 1]).count("1") > 0: k = -1 break k += bin(B[i] & B[i + 1]).count("1")...
IMPORT 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF FUNC_CALL FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER STRING...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def check(n): c = 0 while n != 0: c += 1 n = n & n - 1 return pow(2, c) for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) m = 1 mod = 1000000007 f = 0 f1 = 0 for i in range(n - 1): if l[i] & l[i + 1] != l[i]: ...
FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN FUNC_CALL VAR NUMBER 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER A...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
m = pow(10, 9) + 7 t = int(input()) while t > 0: n = int(input()) a = list(map(int, input().split())) c = 1 f = a[0] for i in range(1, n): p = f q = a[i] g = p & q if g != p: c = 0 break f = a[i] c = c * pow(2, bin(g)[2:].count(...
ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR ASSIGN VAR VAR VA...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
for _ in range(int(input())): n = int(input()) x = list(map(int, input().split())) k = 0 p = int(1000000000.0 + 7) for i in range(n - 1): if bin(x[i] & ~x[i + 1]).count("1") > 0: k = -1 break else: k += bin(x[i]).count("1") if k == -1: ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF FUNC_CALL FUNC_CALL VAR BIN_OP VAR VAR VAR BIN_OP VAR NUM...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def no_of_ones(x): exp = 0 for ele in bin(x)[2:]: if ele == "1": exp += 1 return exp for i in range(int(input())): size = int(input()) arr = [int(i) for i in input().split()] result = 0 ans = 1 for i in range(size - 1): result += no_of_ones(arr[i]) poss ...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING VAR NUMBER RETURN 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VA...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def solve(n, b): for i in range(n - 1): if b[i] & b[i + 1] != b[i]: print(0) return x = 0 for i in range(n - 1): x += bin(b[i]).count("1") ans = 1 while x: if x > 30: ans *= twopow[30] ans %= mod x -= 30 else...
FUNC_DEF FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FUNC_CALL FUNC_CALL VAR VAR VAR STRING ASSIGN VAR NUMBER WHILE VAR IF VAR NUMBER VAR VAR NUMBER VAR VAR VAR NUMBER VAR VAR VAR V...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) for _ in range(t): n = int(input()) str1 = input().split(" ") a = [int(num) for num in str1] sum1 = 1 M = 1000000007 count = 0 for i in range(0, len(a) - 1, 1): if bin(a[i] & ~a[i + 1]).count("1") > 0: count = -1 break count += bin(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 FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER IF FUNC_CALL FU...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) while t: t -= 1 n = int(input()) d = [int(i) for i in input().split()] a = [bin(i) for i in d] count = 1 mod = 10**9 + 7 for i in range(1, n): c = a[i - 1].count("1") count *= pow(2, c, mod) count = count % mod flag = 0 for i in range(1, n): ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_O...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) while t: n = int(input()) bArr = [int(x) for x in input().split()] valid = True for i in range(1, len(bArr)): if bArr[i] & bArr[i - 1] != bArr[i - 1]: valid = False if not valid: print(0) t -= 1 continue mod = 10**9 + 7 total_ways ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR EXPR FUNC_CALL VAR NUMB...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def power(x, y, p): res = 1 x = x % p while y > 0: if y & 1 == 1: res = res * x % p y = y >> 1 x = x * x % p return res def countSetBits(n): count = 0 while n: count += n & 1 n >>= 1 return count t = int(input()) while t: t -= 1 ...
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FU...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
m = 10**9 + 7 def cs(n, count): while n: count += n & 1 n >>= 1 return count for _ in range(int(input())): n, b, a = int(input()), list(map(int, input().split())), 1 for i in range(1, n): if b[i] & b[i - 1] == b[i - 1]: a = a * int(pow(2, cs(b[i - 1], 0))) % m ...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR ...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
from sys import stdin, stdout def result(arr): M = 10**9 + 7 for i in range(n - 1): if arr[i] & arr[i + 1] != arr[i]: return 0 c = 0 for i in range(n): c += bin(arr[i]).count("1") c -= bin(arr[-1]).count("1") ans = 2 ** (c % M) % M return ans for _ in range(in...
FUNC_DEF ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR STRING VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER STRING ASSIGN VAR BIN_OP BIN_OP NUMBE...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
M = 10**9 + 7 t = int(input()) for _ in range(t): n = int(input()) l = list(map(int, input().split())) count = 0 f = 0 for i in range(1, n): if l[i] < l[i - 1]: f = 1 break x = bin(l[i] & l[i - 1]) count = count + x.count("1") if f: print("...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER A...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
mod = 1000000007 tc = int(input()) for _ in range(tc): n = int(input()) b = list(map(int, input().split())) count = 0 for i in range(1, n): if b[i - 1] & b[i] == b[i - 1]: count += bin(b[i - 1]).count("1") else: print(0) break else: ans = 2...
ASSIGN VAR NUMBER 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL FUNC...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def solve(lis, n): cnt = 0 for i in range(1, n): val = lis[i] & lis[i - 1] if val != lis[i - 1]: return -1 for i in range(32): if 1 << i & val > 0: cnt += 1 return 2**cnt % mod for t in range(int(input())): n = int(input()) lis = list...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP VAR NUMBER RETURN NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSI...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) while t > 0: n = int(input()) b = list(map(int, input().split())) ans = 1 for i in range(n - 1): if b[i] > b[i + 1]: ans = 0 break ans = ans * (1 << bin(b[i]).count("1")) % (10**9 + 7) print(ans % (10**9 + 7)) t = t - 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP NUMBER FUNC_C...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def c(s): r = 0 while s > 0: if s & 1 == 1: r += 1 s >>= 1 return r b = [1] * 40 for i in range(1, 40): b[i] = b[i - 1] * 2 % 1000000007 t = int(input()) for _ in range(t): n = int(input()) a = list(map(int, input().split())) s = a[0] p = 1 for i in rang...
FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR F...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) def bitcount(n): count = 0 while n > 0: count = count + 1 n = n & n - 1 return count def exponent(a, b, modi): if b == 0: return 1 elif b == 1: return a % modi else: r = exponent(a, b // 2, modi) if b % 2 == 0: retu...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER RETUR...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
from sys import stdin def power(b, p, m): if p == 0: return 1 else: x = power(b, p // 2, m) % m x = x * x % m if p % 2 == 0: return x % m else: return x * b % m for _ in range(int(stdin.readline())): n = int(stdin.readline()) arr = list...
FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR F...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
for _ in range(int(input())): N = int(input()) array = list(map(int, input().split())) ans = 1 Binary = [bin(array[0]).count("1")] for i in range(1, N): T = array[i] a = array[i - 1] Binary.append(bin(array[i]).count("1")) test = bin(T & a).count("1") if Binar...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FUNC_CALL FUNC_CALL VAR VAR NUMBER STRING FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER EXP...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
for i in range(int(input())): n = int(input()) sum1 = 1 l = list(map(int, input().split())) for i in range(1, n): z = l[i] & l[i - 1] str1 = bin(z).replace("0b", "") cnt1 = str1.count("1") if l[i] | l[i - 1] > l[i]: sum1 = 0 break sum1 = su...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR F...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
for _ in range(int(input())): n = int(input()) b = list(map(int, input().split())) count = 0 flag = 0 for i in range(1, n): if b[i] < b[i - 1]: flag = 1 break x = bin(b[i] & b[i - 1]) count = count + x.count("1") if flag == 1: print("0") ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR ...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def bi(n): count = 0 while n: count += 1 n = n & n - 1 return count t = int(input()) for q in range(t): n = int(input()) b = list(map(int, input().split())) ans = 1 mod = 10**9 + 7 end = 0 for i in range(1, n): if b[i] | b[i - 1] != b[i]: end = 1...
FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER RETURN 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER ...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def setbit(n): cnt = 0 for i in range(32): if n & 1 << i: cnt += 1 return cnt def power(n): res = 1 a = 2 while n > 0: if n & 1: res = res * a % 1000000007 a = a * a % 1000000007 n >>= 1 return res for _ in range(int(input())): ...
FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUN...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
for _ in range(int(input())): n = int(input()) l = list(map(int, input().split())) c = 0 a = 1 for i in range(1, n): p = l[i - 1] & l[i] if p != l[i - 1]: a = 0 break else: c += bin(p).count("1") if a == 0: print(0) else: ...
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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR IF VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
t = int(input()) for _ in range(t): n = int(input()) falg = 1 s = [int(x) for x in input().split()] sum = 0 for i in range(1, len(s)): if s[i - 1] & s[i] != s[i - 1]: falg = 0 break else: sum += bin(s[i - 1] & s[i]).count("1") if falg != 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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUM...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
mod = 10**9 + 7 def check_0(a, b): if a > b: return False else: a = bin(a)[2:] b = bin(b)[2:] a = "0" * (len(b) - len(a)) + a b1 = True for x in range(len(b)): if b[x] == "0": if a[x] == "1": b1 = False ...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR VAR ST...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
def countSetBits(N): count = 0 while N: N &= N - 1 count += 1 return count def main(): T = int(input()) mod = int(1000000000.0 + 7) for _ in range(T): N = int(input()) B = list(map(int, input().split())) ans = 1 for i in range(N): if ...
FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NU...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
mod = 10**9 + 7 for _ in range(int(input())): N = int(input()) arr = list(map(int, input().split())) setb = lambda x: bin(x).count("1") ans = 1 mult = [] for i in range(1, N): if arr[i] & arr[i - 1] != arr[i - 1]: mult.clear() break mult.append(setb(arr[i]...
ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR IF BI...
Chef has invited Alice for his birthday party. Now, Alice is thinking about what to give Chef as a present. She should obviously choose a sequence ― what could possibly be a better birthday gift than a sequence! After some thinking, Alice chose a sequence of integers $A_1, A_2, \ldots, A_N$. However, she does not want ...
import sys m = 1000000000.0 + 7 def countSetBits(n): count = 0 while n: n &= n - 1 count += 1 return count t = int(input()) for _ in range(t): n = int(input()) nums = list(map(int, input().split())) ans = 1 flag = 0 for i in range(n - 1): if nums[i] > nums[i ...
IMPORT ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR ...