description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | def solve(n, A):
cnt = [0] * 64
for a in A:
cnt[a.bit_length() - 1] += 1
result = 0
for i in range(n.bit_length()):
if n >> i & 1:
for j in range(i, 64):
if cnt[j] > 0:
break
if cnt[j] == 0:
print(-1)
... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN VAR VAR NUMBER VAR BIN_OP VAR VAR F... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | q = int(input())
for rwrea in range(q):
n, m = map(int, input().split())
l = list(map(int, input().split()))
if sum(l) < n:
print(-1)
else:
dick = {}
i = 1
while i < 10**9:
dick[i] = 0
i *= 2
for i in range(m):
dick[l[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 IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER WHILE VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | for _ in range(int(input())):
n, m = map(int, input().split())
s = map(int, input().split())
bit = [0] * 100
s = list(s)
if sum(s) < n:
print(-1)
continue
for x in s:
bit[int.bit_length(x) - 1] += 1
ans = 0
pre = None
now = n % 2
for i in range(90):
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR VAR NU... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | import sys
def main():
import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
N, M = map(int, input().split())
A = list(map(int, input().split()))
C = [0] * 100
for a in A:
C[a.bit_length() - 1] += 1
ans = 0
flg = 1
... | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER ASSIG... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | t = int(input())
power = {}
for i in range(30):
power[2**i] = i
hyper = 30
for _ in range(t):
ans = 0
n, m = map(int, input().split())
raw = list(map(int, input().split()))
son = sum(raw)
if son < n:
print(-1)
continue
box = [(0) for _ in range(hyper)]
for i in range(m):
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR DICT FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_C... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | import sys
readline = sys.stdin.readline
readlines = sys.stdin.readlines
ns = lambda: readline().rstrip()
ni = lambda: int(readline().rstrip())
nm = lambda: map(int, readline().split())
nl = lambda: list(map(int, readline().split()))
prn = lambda x: print(*x, sep="\n")
def solve():
n, k = nm()
a = nl()
i... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR STRING FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIG... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | for _ in range(int(input())):
m, n = map(int, input().split())
a = list(map(int, input().split()))
mark = [0] * 65
now = 1
for indx in range(65):
for i in a:
if i == now:
mark[indx] += 1
now <<= 1
s = bin(m)[2:]
s = s[::-1]
ans = 0
flg = 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 BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF VAR VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR FU... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | table = {(1 << i): i for i in range(64)}
for _ in range(int(input())):
big, n = map(int, input().split())
pows = list(map(int, input().split()))
bits = [0] * 65
for p in pows:
bits[table[p]] += 1
ans = 0
for i in range(64):
bits[i] += bits[i - 1] // 2
if big % 2:
... | ASSIGN VAR BIN_OP NUMBER VAR VAR VAR FUNC_CALL 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 FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER FO... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | for i in range(int(input())):
k, n = map(int, input().split())
a = list(map(int, input().split()))
d = {}
for i in a:
d[i] = d.get(i, 0) + 1
i = 0
if sum(a) < k:
print(-1)
else:
nn = k
ans = 0
while nn > 0:
if 1 << i & k > 0:
... | 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 VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NU... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | def main(n, m, a):
j = 0
tmp = 0
divisions = 0
for i in range(50):
if n >> i & 1 == 0:
continue
elif tmp >> i & 1 == 1:
tmp -= 1 << i
continue
elif tmp >> i & 1 == 0:
while tmp < 1 << i:
if j == len(a):
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR BIN_OP NUMBER VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER WHILE VAR BIN_OP NUMBER VAR IF VAR FUNC_CALL VAR VAR RETURN NUMBER VAR VAR VAR VAR NUMBER... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | for _ in range(int(input())):
a, n = map(int, input().split())
ar = [int(x) for x in input().split()]
ar.sort()
b = bin(a).replace("0b", "")
b = b[::-1]
d = {}
ans = 0
sm = 0
for i in ar:
sm += i
if i not in d:
d[i] = 1
else:
d[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 VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VA... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | def solve() -> None:
n = [int(i) for i in input().split()][0]
bs = [0] * 32
for i in input().split():
i = int(i)
for bi in range(len(bs) - 1, -1, -1):
bv = 1 << bi
if i & bv != 0:
bs[bi] += 1
break
sm = [bs[0]] * len(bs)
for bi ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR B... |
You have a bag of size $n$. Also you have $m$ boxes. The size of $i$-th box is $a_i$, where each $a_i$ is an integer non-negative power of two.
You can divide boxes into two parts of equal size. Your goal is to fill the bag completely.
For example, if $n = 10$ and $a = [1, 1, 32]$ then you have to divide the box of s... | for _ in range(int(input())):
n, m = map(int, input().split())
boxes = list(map(int, input().split()))
if sum(boxes) < n:
print(-1)
continue
needed = [0] * 60
got = [0] * 60
for b in boxes:
got[b.bit_length() - 1] += 1
divisions = 0
for bit in range(60):
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 FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR VAR BIN_O... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | import sys
t = int(sys.stdin.readline())
for _ in range(t):
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().strip().split()))
s = sum(arr)
sarr = ["1"] * n
x = sum(arr[i] for i in range(0, n, 2))
y = sum(arr[i] for i in range(1, n, 2))
if x > y:
for i in range... | 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 FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST STRING VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR NUMBER VAR NUMBER ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | import sys
input = sys.stdin.readline
print = sys.stdout.write
def ii():
return int(input())
def mii():
return map(int, input().rstrip().split())
def lmii():
return list(map(int, input().rstrip().split()))
t = ii()
for _ in range(t):
n = ii()
A = lmii()
for i in range(n):
tmp = ... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FU... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
while t > 0:
n = int(input())
a = list(map(int, input().split()))
even = sum(a[::2])
odd = sum(a[1::2])
if even >= odd:
i = 0
while i < n:
if i % 2 == 0:
print(a[i], end=" ")
else:
print(1, end=" ")
... | 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 FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER IF VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUN... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
even = 0
odd = 0
for i in range(n):
if i % 2 == 0:
even += a[i]
else:
odd += a[i]
b = [0] * n
if even > odd:
i = 0
else:
i = 1
for j in range(i, ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR VAR ASSIG... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = map(int, input().split())
a = list(map(int, input().split()))
c = 1
i = 0
while c <= 1000000000:
d = 2 * c
if c <= a[i] <= d:
print(c, end=" ")
i += 1
d = 1
if i == len(a):
break
c = d
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR STRING VAR NUMBER ASSIGN V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for tt in range(t):
n = int(input())
a = list(map(int, input().split()))
cnt0 = 0
cnt1 = 1
for i in range(len(a)):
if i % 2 == 0:
cnt0 += a[i]
else:
cnt1 += a[i]
if cnt0 < cnt1:
for i in range(len(a)):
if i % 2 == 0:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR VAR FOR VAR FU... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
odd_sum = 0
for i in range(1, n, +2):
odd_sum += a[i]
even_sum = 0
for i in range(0, n, +2):
even_sum += a[i]
final_arr = []
if odd_sum <= even_sum:
for i in range(0, n):
... | 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 NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR LIST IF VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | import sys
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.readline
for _ in range(int(input())):
N = int(input())
A = list(map(int, input().split()))
S0 = S1 = 0
for i, a in enumerate(A):
if i & 1:
S1 += a
el... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FUNC_DEF 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 VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
flag = []
for i in range(n):
if i % 2 == 0:
flag.append(1)
else:
flag.append(a[i])
cnt = []
for j in range(n):
if j % 2 == 0:
cnt.append(a[j])
el... | 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def inlt():
return list(map(int, input().split()))
def insr():
s = input()
return list(s[: len(s) - 1])
def invr():
return map(int, input().split())
def bam(x):
b = x.bit_length()
a = 1 << b - 1
c = 2 * a
... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR RETURN FUNC_CALL VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
i = 0
c = [(1) for i in range(n)]
add = 0
while i < n:
add += a[i]
i += 2
sum = 0
i = 1
while i < n:
sum += a[i]
i += 2
if add > sum:
i = 0
while i <... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for i in range(t):
n = int(input())
lst = list(map(int, input().split()))
lst1 = []
s = sum(lst)
ind = 0
c = 0
while True:
if ind > n - 1:
break
else:
if c % 2 == 0:
lst1.append(1)
else:
lst1... | 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 LIST ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EX... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = [*map(int, input().split())]
b = [1] * n
c = [1] * n
s = sum(a)
for i in range(n):
if i % 2:
b[i] = a[i]
else:
c[i] = a[i]
if 2 * sum(abs(a[i] - b[i]) for i in range(n)) <= s:
print(*b)
els... | 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 BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for _ in range(t):
n = int(input())
ary = [int(i) for i in input().split()]
for num in ary:
a = 1
while a * 2 <= num:
a *= 2
print(a, end=" ")
print("") | 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 FOR VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR STRING EXPR FUNC_CALL VAR STRING |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for _ in range(t):
n = int(input())
array = [int(x) for x in input().split()]
s = sum(array)
cur = [0, 0]
for i in range(n):
cur[i % 2] += array[i] - 1
for j in range(2):
if 2 * cur[j] > s:
continue
for i in range(n):
if i % 2 == j... | 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 FUNC_CALL VAR VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER I... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def find(b, a):
s = 0
s1 = sum(b)
for i in range(len(b)):
s += abs(a[i] - b[i])
if 2 * s <= s1:
return True
return False
for i in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
b = [1] * n
p = [1] * n
for j in range(0, n, 2):
... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR IF BIN_OP NUMBER VAR VAR RETURN NUMBER RETURN 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 VAR VAR FUNC_CAL... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
s_odd = 0
s_even = 0
s = sum(a)
for i in range(n):
if i % 2 == 0:
s_odd += a[i]
else:
s_even += a[i]
if s_odd <= s // 2:
for i in range(n):
if i % 2 ... | 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 ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR BIN_OP VAR NUM... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def func(n, arr):
s = sum(arr)
odds = [(1 if i & 1 else arr[i]) for i in range(n)]
if sum(map(lambda i: abs(odds[i] - arr[i]), range(n))) << 1 <= s:
return odds
return [(1 if i & 1 == 0 else arr[i]) for i in range(n)]
for _ in range(int(input())):
print(*func(int(input()), list(map(int, in... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR VAR VAR FUNC_CALL VAR VAR IF BIN_OP FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR FUNC_CALL VAR VAR NUMBER VAR RETURN VAR RETURN BIN_OP VAR NUMBER NUMBER NUMBER VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
ans = []
for i in range(n):
x = 1
while x * 2 <= l[i]:
x = x * 2
ans.append(x)
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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
s = sum(l)
s1 = 0
s2 = 0
for i in range(n):
if i % 2 == 0:
s1 += l[i]
else:
s2 += l[i]
if 2 * s2 <= s:
for i in range(n):
if i % 2 == 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 FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF BIN_OP NUMBER VAR ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
res = [0, 0]
for i in range(n):
res[i % 2] += a[i] - 1
for i in range(2):
if 2 * res[i] <= sum(a):
for j in range(n):
if j % 2 == i:
a[j] = 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 LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP NUMBER VAR VAR FUNC_CALL ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def arraycreator(lst):
s = sum(lst)
ind = lst.index(max(lst))
blanck1 = [1] * len(lst)
blanck2 = [1] * len(lst)
for i in range(1, len(lst), 2):
blanck1[i] = lst[i]
for i in range(0, len(lst), 2):
blanck2[i] = lst[i]
lst3 = list(map(lambda x, y: abs(x - y), lst, blanck1))
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def solve():
n = int(input())
a = list(map(int, input().split()))
sum_a = 0
for i in a:
sum_a += i
first_arr = [0] * n
second_arr = [0] * n
for i in range(n):
if i % 2 == 0:
first_arr[i] = a[i]
second_arr[i] = 1
else:
first_arr[i] =... | 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 FOR VAR VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR NUMBER ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = [0] * n
e, o = 0, 0
for i in range(0, n, 2):
e += a[i]
for i in range(1, n, 2):
o += a[i]
if o >= e:
for i in range(n):
if i % 2 == 0:
b[i] = 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 BIN_OP LIST NUMBER VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for _ in range(t):
n = input()
A = list(map(int, input().split()))
B = []
for a in A:
if a == 1:
B.append(1)
else:
div = B[-1] if len(B) > 0 else 2
q = a // div
if q != 0:
B.append(q * div)
else:... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER E... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | from sys import stdin
for _ in range(int(stdin.readline())):
n = int(input())
list1 = list(map(int, stdin.readline().split()))
list2 = [1]
suno1 = list1[0] - 1
for h in range(1, n):
if h % 2 != 0:
list2.append(list1[h])
else:
list2.append(1)
suno1... | 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 NUMBER ASSIGN VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VA... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | T = int(input())
r = 1
while r <= T:
n = int(input())
arr = list(map(int, input().split()))
ans = []
for ele in arr:
s = bin(ele)
base = 1 << len(s) - 3
if base > 1 and ele >= base + base // 2:
base *= 2
if base > 10**9:
base = base // 2
an... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE 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 LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR NUMBER VAR BIN_OP VAR ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
ans1 = a[:]
ans2 = a[:]
dif1 = 0
dif2 = 0
for i in range(n):
if i % 2:
ans1[i] = 1
dif1 += a[i] - 1
else:
ans2[i] = 1
dif2 += a[i] - 1
if 2... | 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 VAR ASSIGN VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VA... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = [x for x in map(int, input().split())]
odd = 0
even = 0
for i in range(n):
if i % 2 == 0:
odd += abs(a[i] - 1)
else:
even += abs(a[i] - 1)
if odd > even:
for i in range(n):
if i % 2 == ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def gen_beautiful_arr(arr, parity):
res = []
for c in range(len(arr)):
if c % 2 == parity:
res.append(arr[c])
else:
res.append("1")
return res
def main():
T = int(input())
for c in range(T):
n = int(input())
arr = input().rstrip().split(" ")
... | FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR STRING RETURN VAR FUNC_DEF 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 FUNC_CALL VAR STRING A... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
while t:
t -= 1
n = int(input())
a = list(map(int, input().split()))
s1, s2 = 0, 0
for i in range(n):
if i % 2:
s1 += a[i]
else:
s2 += a[i]
if s1 > s2:
for i in range(n):
if i % 2:
print(a[i], end=" ")
... | 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 VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR VAR VAR VAR IF VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUM... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for __ in range(int(input())):
n = int(input())
ar = list(map(int, input().split()))
ans = []
for i in range(n):
num1 = 0
while 2**num1 <= ar[i]:
num1 += 1
if 2**num1 - ar[i] > ar[i] - 2 ** (num1 - 1) or 2**num1 > 10**9:
ans.append(2 ** (num1 - 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 LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP NUMBER VAR VAR VAR VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR VAR BIN_OP VAR VAR BIN_OP NUM... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | T = int(input())
while T > 0:
T -= 1
n = int(input())
a = list(map(int, input("").split()))
Sum = sum(a)
tot = 0
i = 0
while i < n:
tot += 2 * (a[i] - 1)
i += 2
if tot <= Sum:
i = 0
ans = []
while i < n:
if i % 2 == 1:
a... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP NUMBER BIN_OP VAR VAR NUMBER VAR NUMBER IF VAR VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for q in range(t):
n = int(input())
mass = [int(x) for x in input().split()]
answer = 0
for i in range(n - 1):
if mass[i] % mass[i + 1] != 0 and mass[i + 1] % mass[i] != 0:
mass[i + 1] = max(1, mass[i + 1] - mass[i + 1] % mass[i])
print(*mass) | 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 FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
for i in range(t):
n = int(input())
a = [int(j) for j in input().split()]
if_a_good = True
for j in range(n - 1):
if a[j] % a[j + 1] != 0 and a[j + 1] % a[j] != 0:
if_a_good = False
break
if if_a_good == True:
print(" ".join([str(j) for j in a... | 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 FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR VAR VAR BIN_OP VAR NUMBER NUMBER BIN_OP VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
s = sum(a) / 2
b1, b2 = [1] * n, [1] * n
for i in range(0, n, 2):
b1[i] = a[i]
for i in range(1, n, 2):
b2[i] = a[i]
check = 0
for i in range(n):
check += abs(a[i] - b1[i])
if c... | 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 BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR BIN_OP LIST NUMBER VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VAR VAR VAR V... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
l1 = []
count = 0
count2 = 0
for i in range(n):
if i % 2 == 0:
l1.append(1)
count += abs(l[i] - 1)
else:
l1.append(l[i])
l2 = []
for i in range(n):
... | 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 ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | innum = lambda: int(input())
inmul = lambda: map(int, input().split())
instr = lambda: str(input())
inarr = lambda: list(map(int, input().split()))
def solve():
n = innum()
a = inarr()
s = sum(a)
seq1 = [(a[i] if i % 2 == 0 else 1) for i in range(n)]
seq2 = [(1 if i % 2 == 0 else a[i]) for i in ra... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBE... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | t = int(input())
while t:
t -= 1
n = int(input())
a = list(map(int, input().split()))
b = a[:]
oddsum = sum(a[::2])
s = sum(a)
if oddsum >= s // 2:
for i in range(1, n, 2):
b[i] = 1
else:
for i in range(0, n, 2):
b[i] = 1
print(*b) | 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 VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER ASSIGN VA... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def check(n, a, b, s):
z = 0
for i in range(n):
z += abs(a[i] - b[i])
return 2 * z <= s
t = int(input())
for i in range(t):
n = int(input())
a = [int(x) for x in input().split()]
s = sum(a)
b = a[:]
b[::2] = [1] * len(b[::2])
if check(n, a, b, s):
print(*b)
else... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR RETURN BIN_OP NUMBER 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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | def read_int():
return int(input())
def read_ints():
return map(int, input().split(" "))
t = read_int()
for case_num in range(t):
n = read_int()
a = list(read_ints())
s = sum(a)
odd = [(a[i] if i % 2 == 1 else 1) for i in range(n)]
if sum(abs(odd[i] - a[i]) for i in range(n)) * 2 <= s:
... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER VAR FUNC_CALL VA... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | tests = int(input())
for t in range(tests):
n = int(input())
ls = list(map(int, input().split()))
ls_others = [(2**i) for i in range(0, 30)]
ans = []
for item in ls:
for sel_idx in range(len(ls_others)):
if sel_idx < len(ls_others) - 1:
if abs(item - ls_others[sel... | 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 NUMBER VAR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR LIST FOR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR BIN_OP FUNC_C... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for tt in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
ans = []
for x in a:
mn = float("inf")
best = 0
for i in range(0, 30):
if abs(2**i - x) < mn:
mn = abs(2**i - x)
best = 2**i
ans.append(best)
... | 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 FOR VAR VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER IF FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR VAR VAR ... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for t in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
if i % 2:
b.append(a[i])
else:
b.append(1)
if sum([abs(a[i] - b[i]) for i in range(n)]) * 2 <= sum(a):
print(" ".join([str(i) for i in b]))
... | 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 FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
A = [int(a) for a in input().split()]
odd = []
even = []
s_odd = 0
s_even = 0
for i in range(n):
if i % 2 == 0:
odd.append(A[i])
s_odd += A[i]
even.append(1)
s_even += 1
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 VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR VAR VAR VAR VAR EXPR FUNC_CAL... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | for _ in range(int(input())):
n = int(input())
arr = list(map(int, input().split()))
s = sum(arr)
b = [0] * n
for i in range(n):
b[i] = arr[i] if i % 2 == 0 else 1
su = 0
for i in range(n):
su += abs(arr[i] - b[i])
if 2 * su > s:
for i in range(n):
b[i... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER FO... |
You are given an array $[a_1, a_2, \dots, a_n]$ such that $1 \le a_i \le 10^9$. Let $S$ be the sum of all elements of the array $a$.
Let's call an array $b$ of $n$ integers beautiful if:
$1 \le b_i \le 10^9$ for each $i$ from $1$ to $n$;
for every pair of adjacent integers from the array $(b_i, b_{i + 1})$, either $... | import sys
def main():
def modst(a, s):
ret = 1
while s:
if s % 2:
ret = ret * a % mod
a = a * a % mod
s //= 2
return ret
def Cnk(n, k):
return (k <= n and n >= 0) * (
f[n] * modst(f[k] * f[n - k] % mod, mod - 2)... | IMPORT FUNC_DEF FUNC_DEF ASSIGN VAR NUMBER WHILE VAR 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 FUNC_DEF RETURN BIN_OP VAR VAR VAR NUMBER BIN_OP BIN_OP VAR VAR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER VAR ASSIG... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
b = bin(c)[2:]
o = []
for i in range(len(b)):
if i == 0:
o.append("1")
elif b[i] == "1":
o.append("0")
else:
o.append("1")
n1 = int("".join(o), 2)
n2 = c ^ n1
print(n1 * n2) | 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 NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING IF VAR VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
n = int(input())
s = bin(n)[2:]
l = len(s)
x, y = "", ""
for i in range(l):
if i == 0:
if s[i] == "1":
x += "1"
y += "0"
else:
x += "1"
y += "1"
elif s[i] == "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 VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER IF VAR VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING IF VAR VAR STRING VAR STRING VAR ST... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | testcases = int(input())
for i in range(testcases):
C = int(input())
temp = bin(C).replace("0b", "")
x = "0"
y = "1"
z = len(temp)
for k in range(1, z):
if temp[k] == "1":
x = x + "1"
y = y + "0"
else:
x = x + "1"
y = y + "1"
A ... | 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 VAR STRING STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def main():
T = int(input())
for counter in range(T):
ans = 0
a = ""
b = ""
c = int(input())
cbin = bin(c)[2:]
d = len(cbin)
cbin = str(cbin)
countera = 0
counterb = 0
for i in range(len(cbin)):
if cbin[i] == "0":
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR F... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
n = int(input())
binary = bin(n)
binary = binary[2:]
a = "1"
b = "0"
for i in range(1, len(binary)):
if binary[i] == "1":
b += "1"
a += "0"
else:
a += "1"
b += "1"
print(int(a, 2) * int(b, 2)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | p = int(input())
for i in range(p):
c = int(input())
w = bin(c)[2:]
a = ""
b = ""
se = False
for i in range(len(w)):
if not se and w[i] == "1":
a += "1"
b += "0"
se = True
elif w[i] == "1":
a += "0"
b += "1"
else... | 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 NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING VAR STRING VAR STRING ASSIGN VAR NUMBER IF VAR VAR STRING VAR ST... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def decimalToBinary(n):
return bin(n).replace("0b", "")
case = int(input())
for i in range(case):
c = int(input())
n = str(decimalToBinary(c))
a = [0] * len(n)
b = [0] * len(n)
a[0] = 1
for i in range(1, len(n)):
if n[i] == "0":
a[i] = 1
b[i] = 1
els... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING 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 ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER N... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
a = b = 0
flag = False
for i in range(32, -1, -1):
if flag:
if c & 1 << i > 0:
a |= 1 << i
else:
a |= 1 << i
b |= 1 << i
elif c & 1 << i > 0:
flag = True
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMB... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
n = int(input())
x = bin(n).replace("0b", "")
p = 1 << len(x) + 1 - 1
p //= 2
print((p - 1) * (n ^ p - 1)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR BIN_OP VAR NUMBER |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
n = int(input())
binary = bin(n)
binary = binary[2:]
a = ""
b = ""
for i in range(len(binary)):
if binary[i] == "1":
temp_1 = a + "1"
temp_2 = b + "0"
temp_3 = a + "0"
temp_4 = b + "1"
if int(temp_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 VAR ASSIGN VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING ASSIGN VAR BIN_OP VAR STRING... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def gcd(a, b):
if b == 0:
return a
return gcd(b, a % b)
t = int(input())
while t:
t -= 1
c = int(input())
i = 0
while 1 << i <= c:
i += 1
a = 0
b = 0
flag = True
for j in range(i - 1, -1, -1):
if c & 1 << j == 0:
a |= 1 << j
b |= ... | 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 FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUM... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for _ in range(t):
n = int(input())
n = bin(n).replace("0b", "")
leng = len(n)
a = str()
b = str()
a1 = 1
for i in range(leng):
if n[i] == "1" and a1 == 1:
a = a + "1"
b = b + "0"
a1 = 0
elif n[i] == "0":
a = a ... | 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 VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER ASSIGN VAR ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for i in range(int(input())):
c = int(input())
a = 0
b = 0
t = 0
for j in range(32, -1, -1):
r = c & 1 << j
if r > 0:
if t == 0:
t = 1
if a < b:
a += r
else:
b += r
elif t != 0:
a ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER IF VAR VAR VAR VAR VAR VAR IF VAR NUMBER VAR BIN... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | try:
for i in range(int(input())):
n = int(input())
bi = bin(n).replace("0b", "")
a = 2 ** len(bi) // 2
l = 2 ** len(bi) - 1
b = l - (n - a)
a -= 1
print(a * b)
except Exception as e:
print(e) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL V... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
s = str(bin(c))[2:]
s1, s2 = "", ""
k = True
for i in s:
if i == "0":
s1 += "1"
s2 += "1"
elif k:
s1 += "1"
s2 += "0"
k = False
else:
s1 += "0"
s... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR STRING STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING VAR STRING IF VAR VAR STRING VAR STRING ASSIGN VAR NUMBER VAR STRING VAR STRING ASSIGN VAR NUMBER... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for u in range(t):
n = int(input())
a = b = 0
i = 0
while n > 1:
r = n % 2
if r:
b += 2**i
else:
a += 2**i
b += 2**i
n //= 2
i += 1
a += 2**i
print(a * b) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER VAR BIN_OP NUMBER VAR EXPR FUNC_CAL... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | T = int(input())
for t in range(T):
C = bin(int(input()))
if C == "0b1":
print(0)
else:
A = "0b1"
B = "0b"
for i in range(3, len(C)):
B += "1"
if C[i] == "1":
A += "0"
else:
A += "1"
print(int(A, 2) *... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR STRING EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR VAR STRING IF VAR VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP FU... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for _ in range(t):
C = int(input())
d = len(bin(C)) - 2
A = 2**d - 1 ^ C
B = A
A |= 2 ** (d - 1)
C ^= 2 ** (d - 1)
B = B | C
print(A * B) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER VAR ASSIGN VAR VAR VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for i in range(int(input())):
c = int(input())
b = bin(c).replace("0b", "")
b = str(b)
a = "1"
r = "0"
for j in range(1, len(b)):
if b[j] == "0":
a += "1"
r += "1"
else:
a += "0"
r += "1"
a = int(a, 2)
b = int(b, 2)
r = ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF VAR VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING ASSI... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def largest(i):
k = 2
while k <= i:
k = k * 2
return k
i = int(input())
listk = []
for _ in range(i):
listno = []
kk = int(input())
max = 0
ls = largest(kk)
no = ""
for k in range(len(format(kk, "b"))):
if k == 0:
no = "1"
elif str(format(kk, "b"... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FU... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
x = int(input())
a = "1"
b = "0"
x = bin(x)[2:]
for i in x[1:]:
if i == "0":
a += "1"
b += "1"
else:
b += "1"
a += "0"
print(int(a, 2) * int(b, 2)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR VAR NUMBER IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input().strip())):
C = int(input().strip())
bin_c = bin(C)[2:]
out_bin_A = ["1"] + ["0"] * (len(bin_c) - 1)
out_bin_B = ["0"] * len(bin_c)
for idx, bit in enumerate(bin_c[1:], 1):
if bit == "0":
out_bin_A[idx] = "1"
out_bin_B[idx] = "1"
elif... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST STRING BIN_OP LIST STRING BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | T = int(input())
for i in range(T):
n = int(input())
s = bin(n)[2:]
p = 0
sec = 0
x = 0
for z in range(len(s) - 1, -1, -1):
if s[z] == "0":
p = p + 2**x
sec = sec + 2**x
x += 1
else:
if z == 0:
p = p + 2**x
... | 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 NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR STRING ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
d = len(bin(c)) - 2
x = 2 ** (d - 1) - 1
print(x * (c ^ x)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR VAR |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def solve():
num = int(input())
tmp = bin(num)[2:]
a = ""
b = ""
flag = True
for i in tmp:
if i == "1":
if flag:
a += "1"
b += "0"
flag = False
else:
a += "0"
b += "1"
else:
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING IF VAR VAR STRING VAR STRING ASSIGN VAR NUMBER VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
while t > 0:
c = 0
n = int(input())
m = n
while m != 0:
m = m >> 1
c += 1
a_ = 0
b_ = 0
flag = False
for i in range(c - 1, -1, -1):
mask = 1 << i
val = n & mask
if val == 0:
a_ = a_ | 1 << i
b_ = b_ | 1 << i... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VA... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | ass = int(input())
for i in range(ass):
bn = int(input())
bn = bin(bn)[2:]
r = len(bn)
bn = bn[1:]
a = ["1"] + [("0" if i == "1" else "1") for i in bn]
b = ["0"] + ["1"] * (r - 1)
a = "".join(a)
b = "".join(b)
c = int(a, 2) * int(b, 2)
print(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 NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR STRING STRING STRING VAR VAR ASSIGN VAR BIN_OP LIST STRING BIN_OP LIST STRING BIN_OP VAR NUMBER... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | T = int(input())
for _ in range(T):
C = int(input())
A, B = "1", "0"
for i in bin(C)[3:]:
if i == "0":
A += "1"
B += "1"
else:
B += "1"
A += "0"
print(int(A, 2) * int(B, 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 VAR STRING STRING FOR VAR FUNC_CALL VAR VAR NUMBER IF VAR STRING VAR STRING VAR STRING VAR STRING VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
id = 0
a = 0
b = 0
flag = 1
for i in range(31, -1, -1):
if c & 1 << i:
id = i
break
for i in range(id, -1, -1):
if c & 1 << i:
if flag == 1:
a = a | 1 << i
flag ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER V... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for _ in range(t):
n = int(input())
bi_num = bin(n)[2:]
a, b = 1, 0
for i in bi_num[1:]:
if i == "1":
a, b = 2 * a, 2 * b + 1
else:
a, b = 2 * a + 1, 2 * b + 1
print(a * b) | 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 NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR NUMBER IF VAR STRING ASSIGN VAR VAR BIN_OP NUMBER VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER BIN_OP... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for t in range(int(input())):
c = int(input())
a = 0
b = 0
msbc = 0
for i in range(31, -1, -1):
if 1 << i & c:
msbc = i
break
flag = True
for i in range(msbc, -1, -1):
if 1 << i & c:
if flag:
a |= 1 << i
flag... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER NUMBER IF BIN_OP BIN_OP NUMBER VAR V... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
n = int(input())
c = bin(n).replace("0b", "")
a = ""
b = ""
c = list(c)
f = 1
for i in range(len(c)):
if c[i] == "1" and f == 1:
a += "1"
b += "0"
f = 0
elif c[i] == "1" and f == 0:
b += "1"
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR NUMBER VAR STRING VAR STRING ASSI... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
c = int(input())
binary = bin(c).replace("0b", "")
a = 0
b = 0
for i in range(len(binary)):
if binary[i] == "0":
a += 2 ** (len(binary) - i - 1)
b += 2 ** (len(binary) - i - 1)
elif i == 0:
a += 2 ** (len(binary) - 1)
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR BIN_OP NUMBER BIN_OP BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR BIN_OP NUMBER BIN_O... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | for _ in range(int(input())):
s = int(input())
s = bin(s).replace("0b", "")
a = ""
b = ""
count = 0
for i in s:
if i == "0":
a += "1"
b += "1"
elif i == "1":
if count == 0:
a += "1"
b += "0"
count... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR VAR IF VAR STRING VAR STRING VAR STRING IF VAR STRING IF VAR NUMBER VAR STRING VAR STRING VAR NUMBER VAR STRING VAR ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for _ in range(t):
n = int(input())
b = "{0:b}".format(n)
b = list(b)
x = ""
y = ""
flag = False
for i in range(len(b)):
if not flag and b[i] == "1":
x += "1"
y += "0"
flag = True
elif b[i] == "1":
x += "0"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING VAR STRING VAR STRING ASSIGN VAR NUMBER... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | t = int(input())
for i in range(t):
n = int(input())
a = ""
while n >= 1:
a = str(n % 2) + a
n = n // 2
c = 1
p = ""
q = ""
for i in a:
if i == "1":
if c == 1:
p = p + "1"
q = q + "0"
c = c + 1
el... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING WHILE VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR IF VAR STRING IF VAR NUMBER ASSI... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def decimalToBinary(n):
return bin(n).replace("0b", "")
t = int(input())
for z in range(t):
n = int(input())
l = list(decimalToBinary(n))
s = ""
s1 = ""
for i in range(len(l) - 1, 0, -1):
if l[i] == "1":
s = s + "1"
s1 = s1 + "0"
else:
s += "... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING 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 ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER IF VAR VAR ... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def Power(n):
ans, x = 1, 2
while n != 0:
if n & 1 == 1:
ans = ans * x
n = n >> 1
x = x * x
return ans
for _ in range(int(input())):
c = int(input())
s1, s2, d = 0, 0, 0
for i in range(31, -1, -1):
if c >> i & 1 == 1 and s1 == 0:
s1 = s1 ... | FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP 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 VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CAL... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def toBin(n):
return bin(n).replace("0b", " ")
def solve(n):
s = str(toBin(n))
a = []
b = []
for i in range(len(s)):
if s[i] == "1":
if a.count("1") == 0:
a.append("1")
b.append("0")
else:
b.append("1")
... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR STRING EXPR FUNC_C... |
Read problem statements in [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
You are given an integer $C$. Let $d$ be the smallest integer such that $2^{d}$ is strictly greater than $C$.
Consider all pairs of non-negative integers $(A,B)$ such that $A,B < 2^{d}$ and $A \oplus B = C$ ($\oplus$ denote... | def decimalToBinary(n):
return bin(n).replace("0b", "")
for i in range(int(input())):
n = int(input())
binary = decimalToBinary(n)
a1 = 0
a2 = 0
for i in range(len(binary)):
if binary[i] == "0":
a1 = a1 * 2 + 1
a2 = a2 * 2 + 1
if binary[i] == "1":
... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.