description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | P = 10**9 + 7
Q = P - 1
i2 = 1 + P >> 1
T = int(input())
for _ in range(T):
n, k = map(int, input().split())
if n % 2:
print(pow(pow(2, n - 1, P) + 1, k, P))
else:
i2n = pow(i2, n, P)
p2n1 = pow(2, n - 1, P) - 1
print(
(
pow(2, n * (k - 1) % Q, P)
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER 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 IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBE... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = 10**9 + 7
for _ in range(int(input())):
n, k = map(int, input().split())
total = pow(2, n, mod)
h = pow(2, n - 1, mod)
if k == 0:
print(1)
continue
if n % 2 == 0:
c = 0
t = 1
p = {}
prev = 1
for i in range(k + 1):
p[i] = prev
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIG... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | p = int(1000000000.0 + 7)
def sol(n, k):
o = n % 2
b = (1 << n - 1) % p
tn = (b << 1) % p
kn = 1
c = 1
for i in range(1, k + 1):
c = (c * b + c) % p if o else (c * b + kn - c) % p
kn = kn * tn % p
return c
for _ in range(int(input())):
n, k = map(int, input().split())... | ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR BIN_OP ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | def ksm(a, b, c=int(1000000000.0 + 7)):
if b == 0:
return 1
a = a % c
res = 1
while b:
if b % 2 == 1:
res = res * a % c
a = a * a % c
b = b // 2
return res
p = int(1000000000.0 + 7)
mi = [1]
for i in range(211111):
mi.append(mi[i] * 2 % p)
for _ in r... | FUNC_DEF FUNC_CALL VAR BIN_OP NUMBER NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
rem = 1000000007
for _ in range(int(input())):
n, k = map(int, input().split())
ans = 0
if k == 0:
print(1)
elif n % 2 == 0:
dp = [0] * k
dp[0] = pow(2, n - 1, rem)
xx = pow(2, n - 1, rem) - 1
yy = pow(2, n, rem)
for ... | IMPORT ASSIGN VAR VAR ASSIGN VAR NUMBER 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 NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUM... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | def powmod(b, e, n):
accum = 1
i = 0
bpow2 = b
while e >> i > 0:
if e >> i & 1:
accum = accum * bpow2 % n
bpow2 = bpow2 * bpow2 % n
i += 1
return accum
def memoize(function):
cache = {}
def decorated_function(*args):
try:
return cach... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR DICT FUNC_DEF RETURN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR RET... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = 10**9 + 7
powers = [1]
for i in range(1, 200000 + 1):
powers.append(powers[-1] * 2 % mod)
for nt in range(int(input())):
n, k = map(int, input().split())
add = [1]
for i in range(k):
add.append(add[-1] * powers[n] % mod)
if n % 2:
ans = pow(2, n * k, mod)
for i in range... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER 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 LIST NUMBER FOR VAR FUNC_CAL... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
MOD = 10**9 + 7
def main():
n, k = map(int, input().split())
if k == 0:
print(1)
return
if n == 1:
print(pow(2, k, MOD))
return
if n % 2 == 1:
print(pow(pow(2, n - 1, MOD) + 1, k, MOD))
else:
ans = pow(pow(2, n ... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR VAR RETURN IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FU... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
for i in range(t):
[n, k] = [int(x) for x in input().split()]
p = 10**9 + 7
pow2 = pow(2, n - 1, p)
prev = 1
if n % 2 == 0:
prev = pow2
else:
prev = pow2 + 1
z = 1
mu = 2 * pow2 % p
for h in range(2, k + 1):
z = z * mu % p
if n % 2 == ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN LIST VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = 10**9 + 7
def odd(k):
if k == 0:
return 1
else:
oddd = [(1) for _ in range(k + 1)]
for a in range(k, 0, -1):
if a == k:
oddd[a] = (tno + 1) % mod
else:
oddd[a] = (tno + 1) * oddd[a + 1] % mod
return oddd[1]
def eve... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR VAR BIN_OP BIN_OP BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER VAR RETURN VAR NUMB... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
modval = int(1000000000.0 + 7)
for _ in range(t):
n, k = [int(x) for x in input().split(" ")]
if not k:
print("1")
continue
dp = [(1) for _ in range(k + 1)]
ndigsequal = pow(2, n - 1, modval)
allopts = pow(2, n, modval)
st = 1
if n & 1:
isodd = True
... | 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 VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 10**9 + 7
for _ in range(int(input())):
n, k = map(int, input().split())
ans = 1
if n % 2:
ans = pow(1 + 2 ** (n - 1), k, MOD)
else:
for i in range(k):
ans = (pow(2, n - 1, MOD) - 1) * ans
ans %= MOD
ans += pow(pow(2, i, MOD), n, MOD)
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER BIN_OP NUMBER BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_O... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | real_ans = 0
def abc(x, n, k):
global real_ans
if len(x) == n:
a = x[0]
b = x[0]
for j in x[1:]:
a &= j
b ^= j
if a >= b:
real_ans += 1
return
for j in range(2**k):
abc(x + [j], n, k)
mod = 10**9 + 7
e = 2 * 10**5 + 1
fa... | ASSIGN VAR NUMBER FUNC_DEF IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR VAR NUMBER VAR VAR VAR VAR IF VAR VAR VAR NUMBER RETURN FOR VAR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR LIST VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NU... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | for _ in range(int(input())):
n, k = map(int, input().split())
m = 10**9 + 7
if k == 0:
print(1)
continue
if n % 2 == 0:
dp = [(0) for i in range(k)]
dp[0] = pow(2, n - 1, m)
c = pow(2, n, m)
for i in range(1, k):
dp[i] = (pow(c, i, m) + dp[i -... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VA... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = 10**9 + 7
def modDivide(a, b, m):
inv = pow(b, m - 2, m)
return inv * a % m
for _ in range(int(input())):
n, k = map(int, input().split())
if k == 0:
print(1)
continue
if n % 2 == 1:
print(pow(1 + pow(2, n - 1, mod), k, mod))
else:
t = pow(pow(2, n - 1, ... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR RETURN BIN_OP BIN_OP VAR 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR F... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = int(1000000000.0 + 7)
t = int(input())
for _ in range(t):
n, k = [int(i) for i in input().split()]
if n & 1:
print(pow(pow(2, n - 1) + 1, k, mod))
else:
equal = pow(pow(2, n - 1, mod) - 1, k, mod)
al = pow(2, n * k, mod) - equal
al *= pow(pow(2, n - 1, mod) + 1, mod - 2... | ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP F... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | M = 10**9 + 7
def mul(a, b):
a %= M
b %= M - 1
k = 1
s = bin(b)[2:]
for x in s:
k = k * k % M
if x == "1":
k = k * a % M
return k
def sex(n, k):
if k == 0:
return 1
p = mul(2, n - 1)
if n % 2 == 1:
return mul(p + 1, k)
x = [0] * (k ... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER B... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 1000000007
def power(a, n):
res = 1
while n > 0:
if n & 1:
res = res * a % MOD
a = a * a % MOD
n >>= 1
return res
for _ in range(int(input())):
n, k = map(int, input().split())
if k == 0:
print(1)
continue
poww = power(2, n - 1)
i... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR N... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | def func():
t = int(input().strip())
cases = []
for _ in range(t):
n, k = map(int, input().strip().split())
cases.append((n, k))
for case in cases:
n, k = case
print(and_xor(n, k))
def and_xor(n, k):
mod = 1000000007
if n % 2:
ans = pow(2, n - 1, mod) + ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR FOR VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
readline = sys.stdin.readline
M = 10**9 + 7
def bin_exp(num, k):
ans = 1
num %= M
while k > 0:
if k % 2 == 1:
ans *= num
ans %= M
num *= num
num %= M
k //= 2
return ans
t = int(readline())
for _ in range(t):
n, k = map(int, read... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER VAR VAR WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | KMAX, NMAX, MOD = 2 * 10**5, 2 * 10**5, 10**9 + 7
powers = [1] * (NMAX + 1)
for j in range(1, NMAX + 1):
powers[j] = 2 * powers[j - 1] % MOD
t = int(input())
for _ in range(t):
n, k = (int(x) for x in input().split())
if k:
npowers = [1] * (k + 1)
for j in range(1, k + 1):
npower... | ASSIGN VAR VAR VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER BIN_OP NUMBER BIN_OP NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 BIN_OP NUMBER VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | from sys import stdin, stdout
m = 1000000007
twotothe = [1]
facts = [1]
for i in range(1, 200001):
facts.append(facts[-1] * i % m)
twotothe.append(twotothe[-1] * 2 % m)
invnums = [0] * 200001
invfacts = [0] * 200001
invnums[0] = 1
invnums[1] = 1
for i in range(2, 200001):
invnums[i] = invnums[m % i] * (m -... | ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUM... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
def comb(n, r, mod):
if r < 0 or r > n:
return 0
return g1[n] * g2[r] * g2[n - r] % mod
mod = 10**9 + 7
N = 2 * 10**5 + 1
g1 = [1, 1]
g2 = [1, 1]
inv = [0, 1]
for i in range(2, N + 1):
g1.append(g1[-1] * i % mod)
inv.append(-inv[mod % i] * (mod // i) % ... | IMPORT ASSIGN VAR VAR FUNC_DEF IF VAR NUMBER VAR VAR RETURN NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR LIST NUMB... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = lambda: sys.stdin.readline().rstrip()
sys.setrecursionlimit(2 * 10**5 + 10)
write = lambda x: sys.stdout.write(x + "\n")
debug = lambda x: sys.stderr.write(x + "\n")
writef = lambda x: print("{:.12f}".format(x))
M = 10**9 + 7
N = 2 * 10**5 + 10
g1 = [0] * (N + 1)
g2 = [0] * (N + 1)
inverse = [0] * (... | IMPORT ASSIGN VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
pri = pow(10, 9) + 7
input = sys.stdin.readline
a = int(input())
for i in range(a):
n, k = map(int, input().split())
g1 = pow(2, n, pri)
g2 = pow(2, n, pri)
if k == 0:
print(1)
continue
ans = [(0) for i in range(k)]
if n % 2 == 0:
ways = pow(2, n - 1, pri)
... | IMPORT ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASS... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 10**9 + 7
def f(n, k):
good = n - 1 & 1
maybe = (pow(2, n - 1, MOD) + 1 - 2 * good) % MOD
all_ = pow(2, n, MOD)
return (
good
* (pow(all_, k, MOD) - pow(maybe, k, MOD))
* pow(all_ - maybe, MOD - 2, MOD)
+ pow(maybe, k, MOD)
) % MOD
t = int(input())
for _ in ... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER BIN_OP NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR RETURN BIN_OP BIN_OP BIN_OP BIN_OP VAR BIN_OP FUNC_CALL VAR VAR VAR VAR FUNC_C... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | p = 10**9 + 7
def power(x, y, p):
b = bin(y)[2:]
start = x % p
answer = 1
for i in range(len(b)):
if b[len(b) - 1 - i] == "1":
answer = answer * start % p
start = start * start % p
return answer
def invert(x, p):
return power(x, p - 2, p)
def process(n, k):
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR FUN... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | for s in [*open(0)][1:]:
M = 10**9 + 7
P = pow
n, k = map(int, s.split())
p = P(2, n - 1, M)
print(
[(P(2 * p, k, M) + p * P(~-p, k, M)) * P(p + 1, -1, M) % M, P(p + 1, k, M)][
n & 1
]
) | FOR VAR LIST FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR LIST BIN_OP BIN_OP BIN_OP FUNC_CALL VAR BIN_OP NUMBER VAR VAR VAR BIN_OP VAR FUNC_CALL VAR VAR VAR... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
mod = 1000000007
for i in range(t):
n, k = map(int, input().split())
K = pow(2, n - 1, mod)
if n & 1:
ans = pow(K + 1, k, mod)
else:
R = pow(K + 1, mod - 2, mod)
s = (pow(2, n * k, mod) - pow(K - 1, k, mod)) % mod * R % mod
s += pow(K - 1, k, mod)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
for _ in range(t):
n, k = map(int, input().split())
tmp1 = 2 ** (n - 1) % 1000000007
tmp2 = 1
ans = 0
if k == 0:
ans = 1
elif k >= 1:
if n % 2 == 0:
ans = 2 ** (n - 1) % 1000000007
else:
ans = (2 ** (n - 1) + 1) % 1000000007
fo... | 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 BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | T = int(input())
for _ in range(T):
n, k = map(int, input().split())
p = 10**9 + 7
if n & 1 == 1:
answer = pow(pow(2, n - 1, p) + 1, k, p)
else:
answer = 1
pow_ = 1
_2_n_1 = pow(2, n - 1, p)
for i in range(k):
answer = answer * (_2_n_1 - 1) % p
... | 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 BIN_OP BIN_OP NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBE... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 1000000007
def solve(n, k):
if n % 2:
ks = pow(2, n - 1, MOD) + 1
return pow(ks, k, MOD)
else:
ks = pow(2, n - 1, MOD) - 1
if k == 0:
return 1
else:
ans = 1 + ks
cg = pow(2, n, MOD)
binn = cg
for i in ran... | ASSIGN VAR NUMBER FUNC_DEF IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER RETURN FUNC_CALL VAR VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR ASSIGN... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | inf = float("inf")
mod = 10**9 + 7
def get_list():
return [int(i) for i in input().split()]
def yn(a):
print("YES" if a else "NO")
ceil = lambda a, b: (a + b - 1) // b
t = int(input())
for i in range(t):
n, k = [int(i) for i in input().split()]
dp = [(1) for i in range(k + 1)]
muleven = pow(2,... | ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUN... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
def solve():
n, k = map(int, input().split())
m = 10**9 + 7
val = pow(2, n - 1, m)
if n % 2:
val += 1
val %= m
return pow(val, k, m)
else:
R = pow(val + 1, m - 2, m)
ans = (pow(2, n * k, m) - pow(val - 1, k, m)) % m * R... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER VAR NUMBER VAR VAR RETURN FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBE... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
pow2 = [(1) for x in range(2 * 100000 + 1)]
mod = 10**9 + 7
for i in range(1, 200000 + 1):
pow2[i] = pow2[i - 1] * 2
pow2[i] %= mod
def solve(k, n):
if k == 0:
return 1
if dp[k] != -1:
return dp[k]
if n % 2 == 0:
ans = pow22[k - 1] - solve(k - 1, n)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER VAR VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR VAR NUM... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | t = int(input())
def tavan(a, b):
global div
nat = 1
for i in range(b):
nat = nat * a % div
return nat % div
for i in range(t):
n, k = list(map(int, input().split()))
div = 1000000007
two = pow(2, n - 1, div)
if n % 2 == 1:
print(pow(two + 1, k, div))
else:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN BIN_OP VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MODULO = 1000000007
def calc(n, k):
K = pow(2, n - 1, MODULO)
if n & 1:
return pow(K + 1, k, MODULO)
else:
R = pow(K + 1, MODULO - 2, MODULO)
s = (pow(2, n * k, MODULO) - pow(K - 1, k, MODULO)) % MODULO * R % MODULO
s += pow(K - 1, k, MODULO)
return s % MODULO
for... | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NU... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | mod = 1000000007
T = int(input())
fpow = pow
for i in range(T):
ans = 1
n, k = map(int, input().split())
if n % 2 != 0:
ans = fpow(2, n - 1, mod) + 1
ans = fpow(ans, k, mod)
else:
ans = 1
pow_ = 1
_2_n_1 = pow(2, n - 1, mod)
for i in range(k):
... | ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUM... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 10**9 + 7
for _ in range(int(input())):
n, k = map(int, input().split())
COEFF_WINS = 2**n % MOD
COEFF_Q = 2 ** (n - 1) % MOD
wins = 0
q = 1
for i in range(k):
wins *= COEFF_WINS
wins %= MOD
if n % 2 == 0:
wins += q
q *= COEFF_Q - 1
e... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 BIN_OP NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | M = 1000000007
def solve(n, k):
if k == 0:
return 1
p = pow(2, n - 1, M)
q = pow(2, n, M)
if n % 2 == 0:
p -= 1
d0 = 0
d1 = 0
for i in range(k):
if i == 0:
d0 = p
d1 = 1
else:
d1 = (d1 * q +... | ASSIGN VAR NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_O... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
INF = int(1000000000.0) + 7
def power(x, y):
if y == 0:
return 1
semi_result = power(x, y // 2) % INF
if y % 2 == 0:
return semi_result * semi_result % INF
else:
return x * semi_result * semi_result % INF
for _ in range(int(input())):
... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP BIN_OP VAR VAR VAR RETURN BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR AS... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
mod = 10**9 + 7
for _ in range(int(input())):
n, k = map(int, input().split())
ans = 0
x = pow(2, n - 1, mod)
if n % 2:
ans = pow(x + 1, k, mod)
print(ans)
else:
cur = 1
for i in range(k):
r = k - i - 1
an... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR E... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | MOD = 10**9 + 7
t = int(input())
for _ in range(t):
N, k = map(int, input().split())
x = pow(2, N - 1, MOD)
y = pow(2, N, MOD)
if N % 2 == 1:
print(pow(x + 1, k, MOD))
else:
res = pow(x - 1, k, MOD)
for i in range(k):
res = (res + pow(x - 1, i, MOD) * 1 * pow(y, k... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL V... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | def power(base, num):
bin_num = bin(num)[2:]
store = [base]
for _ in range(len(bin_num) - 1):
store.append(store[-1] ** 2 % (10**9 + 7))
curr = 1
for idx, ch in enumerate(bin_num[::-1]):
if ch == "1":
curr = curr * store[idx] % (10**9 + 7)
return curr
t = int(input(... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP BI... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, k = map(int, input().split())
m, ans = 10**9 + 7, 1
if n % 2:
ans = pow(pow(2, n - 1, m) + 1, k, m)
else:
for i in range(k):
ans = pow(pow(2, i, m), n, m) + (pow(2, n - 1, m) - 1) * ans
ans %=... | 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 VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR V... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
def main():
MOD = 10**9 + 7
t = int(input())
for _ in range(t):
N, K = [int(x) for x in input().split()]
ans = 0
if N % 2 == 1:
ans += pow(pow(2, N - 1, MOD) + 1, K, MOD)
print(ans)
continue
for i in... | IMPORT ASSIGN VAR VAR FUNC_DEF 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 VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR NUM... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for tc in range(int(input())):
n, x = map(int, input().split())
arr = list(map(int, input().split()))
globsame, globdiff = 0, 0
for i in range(1, n):
same = max(
globsame + (arr[i] ^ arr[i - 1]), globdiff + (arr[i] ^ arr[i - 1] + x)
)
diff = max(
globsame ... | 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 VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
a, b = map(int, input().split())
aa = [([0] * 2) for i in range(a)]
dp = list(map(int, input().split()))
for i in range(1, a):
aa[i][0] = max(
aa[i - 1][0] + (dp[i - 1] ^ dp[i]), aa[i - 1][1] + (dp[i - 1] + b ^ dp[i])
)
aa[i][1] = max(
... | 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 VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR BIN_OP ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for _ in range(T):
N, X = map(int, input().split())
flag = 200001
check = 1
bool = True
arr = list(map(int, input().split()))
Bool = False
dp = [[0, 0] for i in range(N)]
for i in range(1, N):
flag += check
check ^= flag
dp[i][0] = max(
... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def rec(i, A, X, N, prev):
if i == 0:
return 0
if i == N:
return max(rec(i - 1, A, X, N, 1), rec(i - 1, A, X, N, 0))
if prev == 1:
return max(
(A[i - 1] + X ^ A[i] + X) + rec(i - 1, A, X, N, 1),
(A[i - 1] ^ A[i] + X) + rec(i - 1, A, X, N, 0),
)
els... | FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR VAR RETURN FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER IF VAR NUMBER RETURN FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMB... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for t in range(0, T):
N, X = map(int, input().split())
arr = list(map(int, input().split()))
dp1 = [(0) for i in range(0, N)]
dp2 = [(0) for i in range(0, N)]
for i in range(1, N):
dp1[i] = max(
dp1[i - 1] + (arr[i - 1] ^ arr[i]), dp2[i - 1] + (arr[i - 1] + X ^ a... | 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 VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER V... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = map(int, input().split())
inputArray = list(map(int, input().split()))
dynamic = [[(0) for i in range(2)] for j in range(n)]
for i in range(1, n):
[prev0, prev1] = dynamic[i - 1]
p0, p1 = inputArray[i], inputArray[i - 1]
dynamic[i][1] = max(pr... | 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 NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN LIST VAR VAR VAR BIN_OP VAR NUMBER ASSIGN... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for tr in range(T):
N, X = map(int, input().split(" "))
A = list(map(int, input().split(" ")))
dp = [[-1, -1] for i in range(N)]
for i in range(N):
if i == 0:
dp[0][0] = 0
dp[0][1] = 0
else:
dp[i][1] = max(
int(A[i] + X... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR NUMBER NUMBER ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
if n > 1:
prevdp0 = prevdp1 = 0
for i in range(n - 1):
dp0 = max(prevdp0 + (a[i] ^ a[i + 1]), prevdp1 + (a[i] + x ^ a[i + 1]))
dp1 = max(
prevdp0 + (a[i]... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMB... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for t in range(T):
n, x = map(int, input().split())
l = list(map(int, input().split()))
l.insert(0, 0)
mat = []
for i in range(n + 1):
q = [0] * 2
mat.append(q)
for i in range(2, n + 1):
mat[i][0] = max(
mat[i - 1][0] + (l[i - 1] ^ l[i]), mat[... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER EXPR ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | maxx = 2 * 10**5
arr = [0] * maxx
arr2 = [([0] * 2) for i in range(maxx)]
for _ in range(int(input())):
n1, n2 = map(int, input().split())
l = list(map(int, input().split()))
for i in range(1, len(l) + 1):
arr[i] = l[i - 1]
for i in range(2, n1 + 1):
arr2[i][0] = max(
arr2[i ... | ASSIGN VAR BIN_OP NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | from sys import stdin
input = stdin.readline
for _ in range(int(input())):
n, x = map(int, input().split())
arr = [int(x) for x in input().split()]
arr1 = [(i + x) for i in arr]
dp = [[0, 0] for i in range(n)]
for i in range(1, n):
dp[i][0] = max(
dp[i - 1][0] + (arr[i - 1] ^ ar... | ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR NUMBER ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for t in range(int(input())):
n, x = list(map(int, input().split()))
arr = list(map(int, input().split()))
dp2 = [[0, 0], [0, 0]]
for i in range(2, n + 1):
dp2[0].append(
max(
dp2[0][i - 1] + (arr[i - 2] ^ arr[i - 1]),
dp2[1][i - 1] + (arr[i - 2] + x ^... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER FUNC_... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | import sys
sys.setrecursionlimit(10**6)
def sol(prev, i):
if i == N:
return 0
if (prev, i) in dp:
return dp[prev, i]
num1 = arr[i - 1]
if prev == 1:
num1 = arr[i - 1] + X
dp[prev, i] = max(
(arr[i] ^ num1) + sol(0, i + 1), (arr[i] + X ^ num1) + sol(1, i + 1)
)
... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR VAR RETURN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR ASSIGN VAR VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP BI... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for _ in range(T):
n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
dp = [[0, 0] for _ in range(n)]
for i in range(1, n):
cur_val = A[i]
prev_val = A[i - 1]
a1 = cur_val ^ prev_val + x
a2 = cur_val ^ prev_val
dp[i][0]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
while t > 0:
t -= 1
n, x = map(int, input().split())
a = list(map(int, input().split()))
if n == 1:
print(0)
continue
if n == 2:
print(max([a[0] ^ a[1], a[0] + x ^ a[1], a[0] ^ a[1] + x, a[0] + x ^ a[1] + x]))
continue
xors = [(a[i] ^ a[i + 1]) fo... | 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR LIST BIN_OP VAR NUMBER VAR NUMBER BIN_OP B... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = list(map(int, input().split()))
a = list(map(int, input().split()))
if n == 1:
print(0)
continue
incl = max(a[n - 2] + x ^ a[n - 1], a[n - 2] + x ^ a[n - 1] + x)
excl = max(a[n - 2] ^ a[n - 1], a[n - 2] ^ a[n - 1] + x)
for i in range(n - 3, -1... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR NUMBER BIN_O... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, k = map(int, input().split())
l = list(map(int, input().split()))
dp = [[(0) for i in range(n)] for i in range(2)]
dp[0][0] = 0
dp[1][0] = 0
for i in range(1, n):
cur = l[i]
prev = l[i - 1]
dp[0][i] = max((cur ^ prev) + dp[0][i - 1], (cur ... | 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 NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def gcd(a, b):
if b == 0:
return a
return gcd(a % b, a)
def swap(a, b):
a, b = b, a
return a, b
def fact(n):
if n == 1:
return 1
return n * fact(n - 1)
def cbits(n):
count = 0
while n:
n = n & n - 1
count += 1
return count
def solve(n, x, arr):... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN FUNC_CALL VAR BIN_OP VAR VAR VAR FUNC_DEF ASSIGN VAR VAR VAR VAR RETURN VAR VAR FUNC_DEF IF VAR NUMBER RETURN NUMBER RETURN BIN_OP VAR FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSI... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def sol(a, n, x):
r = 0
for i in range(n - 1):
r += a[i] ^ a[i + 1]
if x == 0:
return r
dp1 = [0] * (n + 1)
dp0 = [0] * (n + 1)
for i in range(2, n + 1):
dp0[i] = max(
dp1[i - 1] + (a[i - 1] ^ a[i - 2] + x), dp0[i - 1] + (a[i - 1] ^ a[i - 2])
)
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR BIN_... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
for k in range(t):
n, x = input().split()
n, x = int(n), int(x)
s = input().split()
if n == 1:
print(0)
continue
for i in range(n):
s[i] = int(s[i])
dp = []
for i in range(n):
dp.append([-1, -1])
dp[1] = [
max(s[0] ^ s[1], s[0] + x... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUN... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = map(int, input().split(" "))
arr = list(map(int, input().split(" ")))
s = 0
if n == 1:
print(0)
else:
change = 0
unchange = 0
for i in range(1, n):
temp1 = change
temp2 = unchange
change = max(
... | 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIG... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
N, X = map(int, input().split())
A = list(map(int, input().split()))
dp = [[[(0) for _ in range(2)] for _ in range(2)] for _ in range(N)]
for i in range(N - 1):
for j in range(2):
for k in range(2):
for l in range(2):
... | 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 NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CAL... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
for _ in range(t):
n, x = map(int, input().split())
a = list(map(int, input().split()))
dp = [[(0) for i in range(n)] for j in range(2)]
dp[0][0] = 0
dp[1][0] = 0
for i in range(1, n):
val1 = dp[0][i - 1] + (a[i] ^ a[i - 1])
val2 = dp[1][i - 1] + (a[i] ^ a[i - 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 VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FO... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
for _ in range(t):
n, x = map(int, input().split())
a = [int(s) for s in input().split()]
dp = []
for _ in range(n):
dp.append([0, 0])
for i in range(1, n):
dp1 = dp[i - 1][0] + (a[i - 1] ^ a[i])
dp2 = dp[i - 1][1] + (a[i - 1] + x ^ a[i])
dp[i][0] = m... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
for _ in range(t):
n, x = map(int, input().split())
arr = list(map(int, input().split()))
if n == 1:
print(0)
continue
dp = [[0, 0] for i in range(n + 1)]
for i in range(n - 1, -1, -1):
if i == n - 1:
dp[i][0] = 0
dp[i][1] = 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 IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
res = []
for _ in range(t):
n, X = [int(x) for x in input().split()]
nums = [int(x) for x in input().split()]
dp = [[(0) for _ in range(2)] for _ in range(n)]
for i in range(1, n):
choice1 = dp[i - 1][1] + (nums[i - 1] + X ^ nums[i])
choice2 = dp[i - 1][1] + (nums[i - 1]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR B... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
added, notAdded = 0, 0
for i in range(1, n):
v1, v2 = a[i - 1], a[i]
added, notAdded = max((v2 + k ^ v1) + notAdded, (v2 + k ^ v1 + k) + added), max(
(v2 ^ v1) + notAdded,... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP VAR NUMBER VAR VAR ASSIGN VAR VAR FUNC_CALL ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | n = int(input())
for z in range(n):
num, x = map(int, input().split())
arr = [int(i) for i in input().split()]
ans = [0, 0]
new1, new2 = 0, 0
for i in range(1, num):
new1 = max((arr[i] ^ arr[i - 1]) + ans[0], (arr[i] ^ arr[i - 1] + x) + ans[1])
new2 = max(
(arr[i] + x ^ a... | 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 NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VA... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | testcase = int(input())
for _ in range(testcase):
n, x = [int(num) for num in input().split()]
arr = [int(num) for num in input().split()]
ans = [[0, 0] for _ in range(n)]
for i in range(1, n):
for j in range(2):
t = arr[i] + x * j
p0 = ans[i - 1][0] + (arr[i - 1] ^ t)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR V... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | from sys import stdin, stdout
read = stdin.readline
t = int(read())
for i in range(t):
a, x = map(int, read().split())
arr = list(map(int, read().split()))
a1 = []
a2 = []
for j in range(a):
if j == 0:
a1.append(0)
a2.append(0)
else:
n1 = max(a1[-... | ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = map(int, input().split())
l = list(map(int, input().split()))
if n > 1:
a = {}
for i in range(1, n + 1):
a[i] = l[i - 1]
d1 = {}
d2 = {}
for i in range(2, n + 1):
if i - 1 not in d1:
d1[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 IF VAR NUMBER ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR DICT ASSIGN VAR DICT ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def solve(x, a):
res = [0, 0]
for i in range(len(a) - 1):
oldres = res.copy()
res[0] = max(
(a[i] + x ^ a[i + 1] + x) + oldres[0], (a[i] ^ a[i + 1] + x) + oldres[1]
)
res[1] = max((a[i] + x ^ a[i + 1]) + oldres[0], (a[i] ^ a[i + 1]) + oldres[1])
return max(res)
... | FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER BIN_OP BIN_OP VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER FUNC_CALL... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for i in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
dp = []
for i in range(n):
dp.append([0, 0])
dp[0][0] = 0
dp[0][1] = 0
for i in range(1, n):
dp[i][0] = max(
dp[i - 1][0] + (a[i - 1] ^ a[i]), dp[i - 1][1] + (a[i - ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER NUMBER NUMBER FO... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def adjacent_xors(arr, n, X):
p, q = 0, 0
for i in range(1, n):
prev_same = max(p + (arr[i - 1] ^ arr[i]), q + (arr[i] ^ arr[i - 1] + X))
prev_change = max(
p + (arr[i - 1] ^ arr[i] + X), q + (arr[i - 1] + X ^ arr[i] + X)
)
p, q = prev_same, prev_change
return max... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR BIN_OP VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR BIN_... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | def miis():
return map(int, input().split())
for _ in range(int(input())):
n, x = miis()
a = list(miis())
dpgive = [0]
dpdont = [0]
for i in range(1, n):
to_d = max(dpgive[-1] + (a[i - 1] + x ^ a[i]), dpdont[-1] + (a[i - 1] ^ a[i]))
to_g = max(
dpgive[-1] + (a[i - 1... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR BIN_... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | T = int(input())
for j in range(T):
N, X = list(map(int, input().split()))
A = list(map(int, input().split()))
dp = [[(0) for i in range(N)] for i in range(2)]
for i in range(1, N):
dp[0][i] = max(
(A[i] ^ A[i - 1]) + dp[0][i - 1], (A[i] ^ A[i - 1] + X) + dp[1][i - 1]
)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER V... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | import sys
sys.setrecursionlimit(10**6)
def fun(i, n, f, arr, x, dp):
if i == n:
return 0
ans = 0
if dp[i - 1][f] != -1:
return dp[i - 1][f]
if f == 1:
ans = max(
ans,
(arr[i - 1] + x ^ arr[i]) + fun(i + 1, n, 0, arr, x, dp),
(arr[i - 1] + x... | IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR NUMBER IF VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR BIN_OP VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER VAR VAR VAR... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = [int(i) for i in input().split()]
A = [int(i) for i in input().split()]
sum_orig = 0
sum_new = 0
current_sum = 0
for i in range(n - 1):
orig = A[i]
new = A[i] + x
next_orig = A[i + 1]
next_new = A[i + 1] + x
a = max((or... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VA... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | from sys import *
setrecursionlimit(1000000)
def solve(i, n, x, arr, prev, dp):
if i == n:
return 0
if dp[prev][i] != -1:
return dp[prev][i]
if prev:
c1 = (arr[i - 1] + x ^ arr[i]) + solve(i + 1, n, x, arr, 0, dp)
c2 = (arr[i - 1] + x ^ arr[i] + x) + solve(i + 1, n, x, arr... | EXPR FUNC_CALL VAR NUMBER FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR VAR NUMBER RETURN VAR VAR VAR IF VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR VAR VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR VAR VAR FUNC_CALL VAR ... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | t = int(input())
for t_1 in range(t):
line = input().split(" ")
n = int(line[0])
x = int(line[1])
numbers = [int(item) for item in input().split(" ")]
max_by_added_i = [0]
max_not_added_i = [0]
for i in range(1, n):
max_by_added_i.append(
max(
max_by_added... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VA... |
JJ has an array A of length N and an integer X. JJ can perform the following operation at most once:
Select a [subsequence] of A and add X to all the elements of that subsequence.
For example, if A = [2, 1, 6, 3, 5] and X = 7, we can select the subsequence [2, 3, 5] and add X to all the elements. Now the array A becom... | for _ in range(int(input())):
n, x = map(int, input().split())
a = list(map(int, input().split()))
g = [([0] * (n + 1)) for _ in range(2)]
for i in range(1, n):
if i == 1:
g[0][i] = max(a[i - 1] ^ a[i], a[i - 1] + x ^ a[i])
g[1][i] = max(a[i - 1] ^ a[i] + x, a[i - 1] + x ... | 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 BIN_OP VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR NUMBER ASSIGN VAR NUMBER VAR FUNC... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | from sys import stdin
def find_prime(max_value):
assert max_value >= 2
result = [2]
for i in range(3, max_value):
state = 1
for item in result:
if item * item > i:
break
elif i % item == 0:
state = -1
break
if ... | FUNC_DEF VAR NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR VAR VAR IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | n = int(input())
(*a,) = map(int, input().split())
mod = 1000000007
d = []
primes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
b = [
0,
4,
8,
0,
32,
12,
128,
4,
0,
36,
2048,
8,
8192,
132,
40,
0,
131072,
4,
524288,
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER N... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | n = int(input())
s = []
p = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67]
for i in set(map(int, input().split())):
b = 0
for j in p:
while i % j == 0:
i //= j
b ^= 1 << j
for j in s:
b = min(b, b ^ j)
if b > 0:
s.append(b)
print(... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR WHILE BIN_OP VAR VAR N... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | n = int(input())
arr = [0] * 71
a = map(int, input().split())
for i in a:
arr[i] += 1
dp = [0] * 2**11
dp[0] = 1
for i in range(71):
if (
arr[i] == 0
or i == 37
or i == 41
or i == 43
or i == 47
or i == 53
or i == 59
or i == 61
or i == 67
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMB... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | def getmask(x):
ans = 0
for i in range(2, x + 1):
while x % (i * i) == 0:
x //= i * i
if x % i == 0:
ans ^= 1 << i
x //= i
return ans
def main():
maxn = 71
n = int(input())
a = [int(i) for i in input().split()]
cnt = [0] * maxn
for i ... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER WHILE BIN_OP VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER VAR BIN_OP NUMBER VAR VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR... |
Petya was late for the lesson too. The teacher gave him an additional task. For some array a Petya should find the number of different ways to select non-empty subset of elements from it in such a way that their product is equal to a square of some integer.
Two ways are considered different if sets of indexes of eleme... | MOD = int(1000000000.0 + 7)
def is_prime(x):
for i in range(2, int(x**0.5) + 1):
if x % i == 0:
return False
return True
p = [i for i in range(2, 100) if is_prime(i)]
n = int(input())
arr = list(map(int, input().split()))
s = []
for i in set(arr):
b = 0
for j in p:
while ... | ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR VAR NUMBER RETURN NUMBER RETURN NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CAL... |
You are given a board of size $2 \times n$ ($2$ rows, $n$ columns). Some cells of the board contain chips. The chip is represented as '*', and an empty space is represented as '.'. It is guaranteed that there is at least one chip on the board.
In one move, you can choose any chip and move it to any adjacent (by side) ... | t = int(input())
for it in range(t):
n = int(input())
a = []
for i in range(2):
a.append(list(input()))
for j in range(n):
if a[0][j] == "*" or a[1][j] == "*":
l = j
break
for j in range(n):
if a[0][j] == "*" or a[1][j] == "*":
r = j
fo... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR STRING ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUM... |
You are given a board of size $2 \times n$ ($2$ rows, $n$ columns). Some cells of the board contain chips. The chip is represented as '*', and an empty space is represented as '.'. It is guaranteed that there is at least one chip on the board.
In one move, you can choose any chip and move it to any adjacent (by side) ... | x = []
for _ in range(int(input())):
z = int(input())
s1 = input()
s2 = input()
l = r = -1
for i in range(z):
if s1[i] == "*" or s2[i] == "*":
if l == -1:
l = i
r = i
d1, d2 = int(s2[l] == "*"), int(s1[l] == "*")
for i in range(l + 1, r + 1):
... | ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR STR... |
You are given a board of size $2 \times n$ ($2$ rows, $n$ columns). Some cells of the board contain chips. The chip is represented as '*', and an empty space is represented as '.'. It is guaranteed that there is at least one chip on the board.
In one move, you can choose any chip and move it to any adjacent (by side) ... | import sys
input = sys.stdin.readline
def solve():
n = int(input())
g = [list(input().rstrip()) for __ in range(2)]
left, right = -1, 0
for i in range(n):
if g[0][i] == "*" or g[1][i] == "*":
if left == -1:
left = i
right = i
ret = 0
f = [0] * (... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER VAR STRING VAR NUMBER VAR STRING IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR B... |
You are given a board of size $2 \times n$ ($2$ rows, $n$ columns). Some cells of the board contain chips. The chip is represented as '*', and an empty space is represented as '.'. It is guaranteed that there is at least one chip on the board.
In one move, you can choose any chip and move it to any adjacent (by side) ... | import sys
input = sys.stdin.readline
def solve():
n = int(input())
board = [input().strip() for _ in range(2)]
f = 0
while f < n and board[0][f] == "." and board[1][f] == ".":
f += 1
b = n - 1
while b >= 0 and board[0][b] == "." and board[1][b] == ".":
b -= 1
dp = [0, 0]
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR STRING VAR NUMBER VAR STRING VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR STRING VAR NUMBER VAR STRING VAR NUMBER AS... |
Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be together, but ... Nastya doesn't give any answer.
The poor boy was very upset because of that. He wa... | def binStringToInt(s):
return int(s, base=2)
def binIntToString(x):
return bin(x)[2:]
numToString = [
"1110111",
"0010010",
"1011101",
"1011011",
"0111010",
"1101011",
"1101111",
"1010010",
"1111111",
"1111011",
]
digits = [[(-1) for _ in range(10)] for __ in range(2*... | FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING STRING ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VA... |
Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be together, but ... Nastya doesn't give any answer.
The poor boy was very upset because of that. He wa... | zero = "1110111"
one = "0010010"
two = "1011101"
three = "1011011"
four = "0111010"
five = "1101011"
six = "1101111"
seven = "1010010"
eight = "1111111"
nine = "1111011"
numbers = [nine, eight, seven, six, five, four, three, two, one, zero]
n, k2 = map(int, input().split())
bank = 0
completefail = 0
listofusage = []
li... | ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR LIST VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VA... |
Denis, after buying flowers and sweets (you will learn about this story in the next task), went to a date with Nastya to ask her to become a couple. Now, they are sitting in the cafe and finally... Denis asks her to be together, but ... Nastya doesn't give any answer.
The poor boy was very upset because of that. He wa... | import sys
def compare(x, s):
for i in range(len(x)):
if x[i] == "1" and s[i] == "0":
return False
return True
def compare2(x, s):
count = 0
for i in range(len(x)):
if x[i] == "0" and s[i] == "1":
count += 1
return count
li = [
"1110111",
"001001... | IMPORT FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR STRING VAR NUMBER RETURN VAR ASSIGN VAR LIST STRING STRING STRING STRING STRING STRING STRING STRING STRING ST... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.