description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | def multiple_input():
return map(int, input().split())
def list_input():
return list(map(int, input().split()))
for _ in range(int(input())):
p, f = multiple_input()
cs, cw = multiple_input()
s, w = multiple_input()
if s > w:
s, w = w, s
cs, cw = cw, cs
s1, s2, w1, w2 = 0... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR ... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | for _ in range(int(input())):
p, f = list(map(int, input().split()))
cs, cw = list(map(int, input().split()))
s, w = list(map(int, input().split()))
if w < s:
w, s = s, w
cs, cw = cw, cs
ps = p // s
fs = f // s
if ps + fs < cs:
print(ps + fs)
continue
best... | 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | tc = int(input())
for t in range(tc):
p, f = map(int, input().split())
sw_cnt, ax_cnt = map(int, input().split())
s_weight, ax_weight = map(int, input().split())
ans = 0
k = min(sw_cnt + 1, p // s_weight + 1)
for my_sw_cnt in range(k):
ans_ = 0
sw_cnt_ = sw_cnt
ax_cnt_ = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR N... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | for T in range(int(input())):
p, f = map(int, input().split())
cnt_s, cnt_w = map(int, input().split())
s, w = map(int, input().split())
if s > w:
cnt_s, cnt_w = cnt_w, cnt_s
s, w = w, s
ans = 0
for i in range(cnt_s + 1):
if i * s > p:
break
cur = 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BI... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | def main():
for _ in range(Iint()):
myCapacity, friendCapcity = Ilist()
countSword, countWarAxe = Ilist()
SwordWeight, WarAxeWeight = Ilist()
if SwordWeight > WarAxeWeight:
SwordWeight, WarAxeWeight = WarAxeWeight, SwordWeight
countSword, countWarAxe = countWa... | FUNC_DEF FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_O... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
def input():
return sys.stdin.readline().strip()
def list2d(a, b, c):
return [([c] * b) for i in range(a)]
def list3d(a, b, c, d):
return [[([d] * c) for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e):
return [[[([e] * d) for j in range(c)] for j in range(b)] for i in ran... | IMPORT FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN BIN_OP LIST VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF NUMBER RETURN FUNC_CALL ... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | def solve():
p, f = map(int, input().split())
cnts, cntw = map(int, input().split())
s, w = map(int, input().split())
if s > w:
s, w = w, s
cnts, cntw = cntw, cnts
mans = 0
for i in range(cnts + 1):
ans = 0
if p >= s * i:
ans += i
cntsnow =... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER IF VAR ... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | t = int(input())
for case in range(t):
p, f = map(int, input().split())
swords, axes = map(int, input().split())
s, w = map(int, input().split())
capacity = p + f
if s <= w:
if p // s + f // s <= swords:
print(p // s + f // s)
else:
maxWeapons = 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR IF BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR VAR EXP... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | def get_results():
cap1, cap2 = list(map(int, input().split()))
n1, n2 = list(map(int, input().split()))
w1, w2 = list(map(int, input().split()))
max_w = 0
if w2 < w1:
n1, n2 = n2, n1
w1, w2 = w2, w1
for your_lighter in range(0, min(n1, cap1 // w1) + 1):
your_heavier = mi... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR FOR VAR FUNC_CALL VAR N... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
LI = lambda: list(map(int, sys.stdin.readline().strip("\n").split()))
MI = lambda: map(int, sys.stdin.readline().strip("\n").split())
SI = lambda: sys.stdin.readline().strip("\n")
II = lambda: int(sys.stdin.readline().strip("\n"))
for _ in range(II()):
p, f = MI()
cs, cw = MI()
s, w = MI()
i... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL ... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
input = sys.stdin.buffer.readline
def solution():
p, f = map(int, input().split())
cnts, cntw = map(int, input().split())
s, w = map(int, input().split())
num1 = 0
num2 = 0
ans = 0
for i in range(cnts + 1):
num1 = i
if i * s > p:
continue
x =... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR IF BIN_OP... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
p, f = map(int, input().split())
cs, cw = map(int, input().split())
s, w = map(int, input().split())
maxa, mina = max(p, f), min(p, f)
maxa1, mina1 = maxa, mina
l = [[s, cs], [w, cw]]
l.sort()
l1 = []
for i in... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASS... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
input = sys.stdin.readline
for kek in range(int(input())):
p, f = map(int, input().split())
cnt_s, cnt_w = map(int, input().split())
s, w = map(int, input().split())
if s >= w:
s, w = w, s
cnt_w, cnt_s = cnt_s, cnt_w
ma_s = min(cnt_s, p // s + f // s)
ma_w = 0
for... | 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 FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | rr = lambda: input().strip()
rrm = lambda: map(int, rr().split())
def solve():
p, f = rrm()
scnt, wcnt = rrm()
s, w = rrm()
ans = 0
if w < s:
s, w = w, s
wcnt, scnt = scnt, wcnt
x = min(scnt, p // s)
for s1 in range(x + 1):
w1 = min(wcnt, (p - s1 * s) // w)
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR VAR FOR VAR FUNC_CALL... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
input = sys.stdin.readline
def solve():
p, f = list(map(int, input().split()))
cntS, cntW = list(map(int, input().split()))
s, w = list(map(int, input().split()))
if s < w:
a = s
cntA = cntS
b = w
cntB = cntW
else:
a = w
cntA = cntW
... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIG... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | import sys
def i():
return sys.stdin.readline()[:-1]
cases = int(i())
for x in range(cases):
p, f = map(int, i().split())
cs, cw = map(int, i().split())
s, w = map(int, i().split())
if s > w:
s, w = w, s
cs, cw = cw, cs
pMax = p // s
fMax = f // s
if pMax + fMax <= cs... | IMPORT FUNC_DEF RETURN FUNC_CALL 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 ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | t = int(input().split()[0])
for case in range(t):
p, f = map(int, input().split())
cnts, cntw = map(int, input().split())
s, w = map(int, input().split())
if w < s:
s, w = w, s
cnts, cntw = cntw, cnts
ans = 0
fwmax = min(p // w, cntw)
for fw in range(fwmax + 1):
fs = ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR... |
You are playing one RPG from the 2010s. You are planning to raise your smithing skill, so you need as many resources as possible. So how to get resources? By stealing, of course.
You decided to rob a town's blacksmith and you take a follower with you. You can carry at most $p$ units and your follower — at most $f$ uni... | def main():
t = int(input())
for _ in range(t):
p, f = map(int, input().split())
ns, na = map(int, input().split())
ws, wa = map(int, input().split())
if ws > wa:
ws, wa = wa, ws
ns, na = na, ns
ans = -1
for i in range(ns + 1):
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
if n == 1:
print(a[0])
else:
gauche = [~a[0]] * n
droite = [~a[-1]] * n
for i in range(1, n):
gauche[i] = gauche[i - 1] & ~a[i]
for i in range(n - 2, -1, -1):
droite[i] = droite[i + 1] & ~a[i]
maxi = a[i] & droite[i + 1]
in... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST VAR NUMBER VAR ASSIGN VAR BIN_OP LIST VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR FOR VAR F... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
l = [int(x) for x in input().split()]
if n == 1:
print(l[0])
exit(0)
pre = l[0:n]
suf = l[0:n]
for i in range(1, n):
pre[i] |= pre[i - 1]
for i in range(n - 2, -1, -1):
suf[i] |= suf[i + 1]
ans = 0
cur = 0
k = 0
for i in range(n):
if i == 0:
cur = ~(~l[i] | suf[i + 1])
e... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR NUMBER VAR ASSIGN VAR VAR NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
reader = (s.rstrip() for s in sys.stdin)
input = reader.__next__
n = int(input())
a = list(map(int, input().split()))
left = [0]
right = [0]
for ai in a:
left.append(left[-1] | ai)
for ai in reversed(a):
right.append(right[-1] | ai)
maximum = 0
max_ind = 0
for i, ai in enumerate(a):
mask = left[... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN 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 NUMBER ASSIGN VAR LIST NUMBER FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMB... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | input()
a = input().split()
s = {*range(len(a))}
for x in zip(*(f"{int(x):30b}" for x in a)):
if x.count("1") == 1:
t = {i for i, y in enumerate(x) if "0" < y}
if s & t:
s &= t
print(*([a.pop(s.pop())] + a)) | EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR VAR IF FUNC_CALL VAR STRING NUMBER ASSIGN VAR VAR VAR VAR FUNC_CALL VAR VAR STRING VAR IF BIN_OP VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP LIST FUNC_CALL VAR FUNC_CALL VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def decimalToBinary(n):
return bin(n).replace("0b", "")
n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
b = []
for i in range(n):
s = decimalToBinary(a[i])
s = "0" * (32 - len(s)) + s
b.append(s)
ans = -1
for i in range(32):
ind = -1
for j in range(n):
if b[j]... | FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP NUMBER FUNC_CALL... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def f(x, y):
return (x | y) - y
def solve(a):
bit = 33
while bit >= 0:
count = 0
for item in a:
if 1 << bit & item:
count += 1
if count == 1:
break
bit -= 1
if bit < 0:
return a
result = []
skip = None
for i, i... | FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR VAR FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER RETURN VAR ASSIGN VAR LIST ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def cal(x):
if x == 0:
return 1
else:
ret = 0
while x > 0:
ret += 1
x //= 2
return ret
def flip(x, nbits):
more = nbits - cal(x)
d = []
if x == 0:
d.append(0)
else:
while x > 0:
d.append(x % 2)
x //... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR BIN_OP VAR FUNC_CALL VAR VAR ASSIGN VAR LIST IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = [int(i) for i in input().split()]
once = 0
twice = 2**64
for i in a:
twice |= once & i
once |= i
a = sorted([(i & ~twice, i) for i in a], reverse=True)
a = [j for i, j in a]
print(*a) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR VAR VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | from sys import stdin
def iinput():
return int(stdin.readline())
def sinput():
return input()
def minput():
return map(int, stdin.readline().split())
def linput():
return list(map(int, stdin.readline().split()))
n = iinput()
a = linput()
k = 1 << 31
x = -1
while k:
c = 0
for i in range... | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
n = int(sys.stdin.readline())
arr = list(map(int, sys.stdin.readline().split()))
l = [0] * 50
for i in range(n):
s = bin(arr[i])
a, j = 49, len(s) - 1
while j > 1:
if s[j] == "1":
l[a] += 1
a -= 1
j -= 1
ind = -1
ans = -1
for i in range(n):
s = bin(arr[i])... | IMPORT 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 NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER WHILE VAR NUMBER IF VAR VAR STRING VAR VAR NUMBER VAR NUM... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
reader = (line.rstrip() for line in sys.stdin)
input = reader.__next__
n = int(input())
a = list(map(int, input().split()))
digits = [[] for _ in range(32)]
for i, val in enumerate(a):
shift = 0
while val > 0:
if val & 1:
digits[shift].append(i)
val >>= 1
shift +=... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN 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 VAR FUNC_CALL VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR VAR VAR N... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
n = int(sys.stdin.readline().split()[0])
a = list(map(int, sys.stdin.readline().split()))
b = [x for x in a]
idx = -1
while max(b) != 0:
c = [(x & 1) for x in b]
if c.count(1) == 1:
idx = c.index(1)
b = [(x >> 1) for x in b]
if idx >= 0:
sys.stdout.write(str(a[idx]) + " ")
for i ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR VAR IF FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
bitsum = [0] * 32
for i in a:
for j in range(32):
bitsum[j] += i >> j & 1
onebit = None
for i in range(31, -1, -1):
if bitsum[i] == 1:
onebit = i
break
if onebit is None:
print(*a)
exit(0)
for i in range(n):
if a[i] >> oneb... | 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 NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR NONE FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR IF VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
l = list(map(int, input().split()))
cnt = [0] * 30
for i in range(n):
for j in range(30):
if l[i] & 1 << j:
cnt[j] += 1
options = [i for i in range(n)]
for i in range(29, -1, -1):
newoptions = []
if cnt[i] == 1:
for idx in options:
if l[idx] & 1 << i:... | 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 NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP NUMBER VAR VAR VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBE... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
arr = list(map(int, input().split()))
s = set()
for i in range(32, -1, -1):
cnt = 0
bs = []
for c in arr:
if c >> i & 1:
cnt += 1
bs.append(c)
if cnt == 1 and bs[0] not in s:
print(bs[0], end=" ")
s.add(bs[0])
for c in arr:
if c not in... | 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 FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER VAR NUMBER VAR EXPR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | t = 1
while t:
n = int(input())
l = list(map(int, input().split()))
s = [0] * (n + 1)
p = [0] * (n + 1)
p[0] = ~l[0]
for i in range(1, n):
p[i] = p[i - 1] & ~l[i]
s[n - 1] = ~l[-1]
for i in range(n - 2, -1, -1):
s[i] = s[i + 1] & ~l[i]
max_ind = 0
maxi = 0
if ... | ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BI... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
mask = 0
for i in range(31):
if [(j >> i & 1) for j in a].count(1) == 1:
mask += 1 << i
ans = [-1, -1]
for i in range(n):
if ans[0] < a[i] & mask:
ans[0] = a[i] & mask
ans[1] = i
realans = []
realans.append(a[ans[1]])
for i in range(n)... | 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 IF FUNC_CALL BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER NUMBER VAR BIN_OP NUMBER VAR ASSIGN VAR LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER BIN_OP VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
if n == 1:
print(a[0])
else:
pref = [0] * n
suff = [0] * n
pref[1] = ~a[0]
suff[n - 2] = ~a[-1]
for i in range(2, n):
pref[i] = pref[i - 1] & ~a[i - 1]
for i in range(n - 3, -1, -1):
suff[i] = suff[i + 1] & ~a[i + 1]
ma... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
n = int(sys.stdin.readline().strip())
a = list(map(int, sys.stdin.readline().strip().split()))
b = a[:]
C = [0] * n
x = [0] * n
for i in range(0, 40):
for j in range(0, n):
x[j] = b[j] % 2
b[j] = b[j] // 2
if sum(x) == 1:
for j in range(0, n):
if x[j] == 1:
... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR NUMBE... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
ans = []
for i in range(32, -1, -1):
flag = -1
badflag = 0
for j in range(n):
if a[j] & 1 << i:
if flag == -1:
flag = j
else:
badflag = 1
if badflag == 1:
break
if fla... | 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 NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR BIN_OP NUMBER VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUM... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
input = sys.stdin.buffer.readline
n = int(input())
a = [int(i) for i in input().split()]
for i in range(34, -1, -1):
b = 1 << i
cnt = 0
idx = -1
for x in range(n):
if b & a[x] != 0:
cnt += 1
idx = x
if cnt == 1:
print(a[idx], end=" ")
for x... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input().strip())
A = list(map(int, input().strip().split()))
A_set = list(set(A))
if len(A) == 1 or len(A_set) == 1:
print(" ".join(list(map(str, A))))
else:
m = len(A_set)
prefix = [~A_set[0]] * m
postfix = [~A_set[-1]] * m
for i in range(1, m):
prefix[i] = prefix[i - 1] & ~A_set[i]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
u = sys.stdin.readline
n = int(u())
a = list(map(int, u().split()))
ind = -1
for i in range(40, -1, -1):
for j in range(n):
if a[j] & 1 << i:
if ind == -1:
ind = j
else:
ind = -1
break
if ind != -1:
print(a[ind],... | IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR BIN_OP NUMBER VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUN... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def main():
n = int(input())
aa = [int(a) for a in input().split()]
counts = [0] * 30
candidate = [None] * 30
for a in aa:
i = 0
b = a
while b > 0:
if b % 2 == 1:
counts[i] += 1
if counts[i] == 1:
candidate[i] = ... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NONE NUMBER FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR A... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | input()
l = [0] * 30
c = [0] * 30
a = [*map(int, input().split())]
i = 0
for x in a:
for j in range(30):
if x >> 29 - j & 1:
c[j] += 1
l[j] = i
i += 1
if 1 in c:
i = l[c.index(1)]
a = [a.pop(i)] + a
print(*a) | EXPR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER IF NUMBER VAR ASSIG... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
array = list(map(int, input().split()))
max = 0
for i in array:
if i > max:
max = i
k = max
max = 0
while k != 0:
k = int(k / 2)
max += 1
array_of_arrays = []
for i in range(0, max):
array_of_arrays.append([])
for i in range(0, n):
k = array[i]
counter = 0
while k !=... | 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 IF VAR VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR EXPR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | from sys import stdin, stdout
n = int(stdin.readline().strip())
alist = list(map(int, stdin.readline().split()))
cnt = {}
for a in alist:
k = 1
while k <= a:
if a & k:
cnt.setdefault(k, []).append(a)
k *= 2
mx = None
for k, v in sorted(list(cnt.items()), reverse=True):
if len(v)... | ASSIGN VAR FUNC_CALL 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 NUMBER WHILE VAR VAR IF BIN_OP VAR VAR EXPR FUNC_CALL FUNC_CALL VAR VAR LIST VAR VAR NUMBER ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR NUM... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def h(n):
if n == 1:
return "1"
if n == 0:
return "0"
return h(n % 2) + h(n // 2)
n = int(input())
a = list(map(int, input().split()))
b = list(map(h, a))
res = 0
for i in range(31, 0, -1):
ind = -1
col = 0
for j in range(n):
if len(b[j]) >= i and b[j][i - 1] == "1":
... | FUNC_DEF IF VAR NUMBER RETURN STRING IF VAR NUMBER RETURN STRING RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP 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 FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = input().split()
ls = [[(0) for i in range(31)] for j in range(n)]
for i in range(n):
a[i] = int(a[i])
k = 1
while k < 32:
if a[i] & 1 << k - 1:
ls[i][k - 1] = 1
k += 1
j = 30
while j >= 0:
count = 0
store = 0
for i in range(n):
if ls[i][j]... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP VAR VAR BIN_OP NUMBER BIN_OP VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
li = [int(i) for i in input().split(" ")]
valid = {}
for i in li:
for p in range(31):
c = i & 2**p
if c:
valid[c] = valid.get(c, 0) + 1
s = 0
for k, v in valid.items():
if v == 1:
s += k
m = 0
a = li[0]
for i in li:
if i & s > m:
m = i & s
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR DICT FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR IF VAR ASSIGN VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR IF VAR NUMBER V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def func(start, b):
temp = start
for j in range(len(b)):
temp = (temp | b[j]) - b[j]
return temp
n = int(input())
a = list(map(int, input().split()))
count = []
for i in range(32):
count.append([])
for i in a:
b = bin(i)[2:].rjust(32, "0")
for j in range(32):
if b[j] == "1":
... | FUNC_DEF ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR VAR RETURN 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 NUMBER EXPR FUNC_CALL VAR LIST FOR VAR VAR ASSIGN VAR FU... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
c = -float("inf")
val = 0
for i in range(32, -1, -1):
ct = 0
for j in a:
v = 1 << i
if j & v > 0:
ct += 1
val = j
if ct == 1:
c = val
break
a.sort(reverse=True)
ans = []
if c > 0:
ans.append(c)
f... | 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 STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF VAR NUMB... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
count = 0
index = 0
for i in range(30, -1, -1):
count = 0
for j in range(0, n):
if a[j] & 1 << i:
count = count + 1
index = j
if count == 1:
break
print(a[index], *a[:index], *a[index + 1 :]) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF BIN_OP VAR VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR IF V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
exist = 0
final = max(a)
ok = 2**30 - 1
for i in range(n):
tmp = a[i] ^ exist
tmp2 = a[i] & exist
ok = ok & ~tmp2
final = (final | tmp) & ok
exist = exist | a[i]
final = format(final, "b").zfill(30)
idx = 0
for i in range(30):
if final[i] == "... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
m = max(a)
b = 0
while 1 << b < m:
b += 1
for i in reversed(range(b)):
s = 0
for j in range(n):
if 1 << i & a[j] != 0:
if s == 1:
break
s += 1
ans = j
else:
if s == 1:
a[0... | 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 WHILE BIN_OP NUMBER VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER I... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = [int(x) for x in input().split()]
complementPrefixes = [(-1) for _ in range(n)]
complementSuffixes = [(-1) for _ in range(n)]
for i in range(n):
if i == 0:
complementPrefixes[i] = ~0
else:
complementPrefixes[i] = complementPrefixes[i - 1] & ~a[i - 1]
for i in range(n - 1, -1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC_CAL... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | from sys import stdin, stdout
n = int(input())
a = list(map(int, stdin.readline().split()))
used = [False] * n
ans = []
for k in range(30, -1, -1):
cnt1, pos1 = 0, -1
for i in range(n):
if used[i]:
continue
mask = 1 << k
if mask & a[i]:
cnt1 += 1
pos1... | 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 LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR VAR VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
numbers = list(map(int, input().split()))
candidate = 0
prefix = [0] * n
suffix = [0] * n
prefix[0] = suffix[n - 1] = 2147483647
for i in range(1, n):
prefix[i] = prefix[i - 1] & ~numbers[i - 1]
i = n - 2
while i >= 0:
suffix[i] = suffix[i + 1] & ~numbers[i + 1]
i -= 1
ans = -1
pos = -1
for... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
l = list(map(int, input().split()))
m = [0] * n
d = 0
for i in range(n):
bin_str = format(l[i], "b")
d = max(d, len(bin_str))
m[i] = bin_str
for i in range(n):
m[i] = "0" * (d - len(m[i])) + m[i]
i_ = -1
for j in range(d):
cnt = 0
for i in range(n):
if m[i][j] != "0":
... | 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 NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSI... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input(""))
arr = list(map(int, input().split()))
arr.sort(reverse=True)
suff = [0] * (n + 1)
pre = [0] * n
mx = -100000000000000
ind = -1
suff[n - 1] = ~arr[n - 1]
for i in range(n - 2, -1, -1):
suff[i] = suff[i + 1] & ~arr[i]
for i in range(n):
if i == 0:
ase = ~arr[0]
now = arr[i] & su... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR BIN_OP VAR NUMBER FOR VAR FUNC... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def main():
n = int(input())
ints = list(map(int, input().split(" ")))
bins = []
for i in range(31):
bins.append([])
for num in ints:
s = bin(num)[2:]
prefix = "0" * (31 - len(s))
s = prefix + s
i = 0
while i <= 30:
if s[i] == "1":
... | FUNC_DEF 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 LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP STRING BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def main():
n = int(input())
aa = list(map(int, input().split()))
ll = [0] * n
rr = [0] * n
s = 0
for i in range(n):
s |= aa[i]
ll[i] = s
s = 0
for i in range(n - 1, -1, -1):
s |= aa[i]
rr[i] = s
mx = 0
mxi = 0
for i in range(n):
s = 0
... | 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 BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMB... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | N = int(input())
XX = list(map(int, input().split()))
X = ["{:030b}".format(x) for x in XX]
for i in range(30):
xj = None
for j, x in enumerate(X):
if x[i] == "1":
if xj != None:
xj = None
break
xj = j
else:
if xj != None:
b... | 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 STRING VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR VAR IF VAR VAR STRING IF VAR NONE ASSIGN VAR NONE ASSIGN VAR VAR IF VAR NONE IF VAR NONE EXPR FUNC_CALL... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | y = input
z = print
r = range
n = int(y())
l = list(map(int, y().split()))
d = {}
for i in l:
b = bin(i)[:1:-1]
for j in r(len(b)):
if int(b[j]):
d[j] = d.get(j, [])
d[j].append(i)
for i in r(31, -1, -1):
if len(d.get(i, [])) == 1:
v = d[i][0]
print(v, end=" "... | ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN 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 DICT FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def solve():
n = int(input())
a = list(map(int, input().split()))
idx = 0
bit = 30
while bit >= 0:
count = 0
for i, num in enumerate(a):
if num >> bit & 1 == 1:
count += 1
idx = i
if count > 1:
break
... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER NUMBER VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER IF VAR NUMBER VAR NUMBER ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def solution():
n = int(input())
l = list(map(int, input().split()))
nl = []
pre = [~l[0]]
suff = []
for i in range(n):
x = ~l[i]
nl.append(x)
pre.append(x)
suff.append(x)
suff.append(~l[-1])
for i in range(1, n + 1):
pre[i] &= pre[i - 1]
for 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 LIST ASSIGN VAR LIST VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR NUMBER FO... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
t = 1
input = sys.stdin.readline
while t > 0:
t -= 1
n = int(input())
a = [int(x) for x in input().split()]
d = {}
l = [(0) for i in range(40)]
for i in range(n):
u = bin(a[i])[2:]
for k in range(len(u)):
if u[k] == "1":
l[len(u) - k - 1] +... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR DICT ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
ans = 0
f = [(0) for i in range(n)]
b = [(0) for i in range(n)]
for i in range(n):
f[i] = a[i] | (f[i - 1] if i - 1 >= 0 else 0)
for i in range(n - 1, -1, -1):
b[i] = a[i] | (b[i + 1] if i + 1 < n else 0)
index = 0
for i in range(n):
left = (f[i - 1] if i... | 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 VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER FOR VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | get_bin = lambda x: format(int(x), "b").zfill(32)
n = int(input())
seq = list(map(int, input().split()))
s = list(map(get_bin, seq))
arr = [[] for i1 in range(32)]
for i1 in range(32):
for i2 in range(n):
if s[i2][i1] == "1":
arr[i1].append(i2)
result = None
for i1 in arr:
if len(i1) == 1:
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR STRING 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 FUNC_CALL VAR VAR VAR ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
arrr = [int(j) for j in input().split()]
arr = arrr[:]
for i in range(n):
arr[i] = bin(arr[i])[2:]
arr[i] = (30 - len(arr[i])) * "0" + arr[i]
fflag = 0
ans = -1
for i in range(30):
flag = 0
ttemp = 0
for j in range(n):
if arr[j][i] == "1":
flag += 1
if fl... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR VAR STRING VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR N... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
l = [bin(i)[2:].zfill(32) for i in a]
ind = -1
for i in range(32):
c = 0
flag = False
for j in range(n):
if l[j][i] == "1":
if flag:
ind = -1
flag = False
break
flag = True
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER NUMBER VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR STRING IF VAR ASSIGN VAR NUMB... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
s = list(map(int, input().split()))
dig = [0] * 50
record = [None] * 50
for x in s:
i = 0
tmp = x
while tmp != 0:
if tmp % 2 == 1:
record[i] = x
dig[i] += 1
tmp //= 2
i += 1
ans = []
head = None
for i in range(40, -1, -1):
if dig[i] == 1:
... | 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 NUMBER ASSIGN VAR BIN_OP LIST NONE NUMBER FOR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR VAR VAR NUMBER VAR NUMBER VAR NUM... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | t = int(input())
a = list(map(int, input().split()))
if t == 1:
print(a[0])
else:
b = [(~i) for i in a]
pos = [0] * t
pre = [0] * t
pre[0] = b[0]
pos[t - 1] = b[-1]
for i in range(1, t):
pre[i] = pre[i - 1] & b[i]
pos[t - i - 1] = pos[t - i] & b[t - i - 1]
mmax = 0
an... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER FOR VAR FU... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def digit(n, d):
return n % 2 ** (d + 1) // 2**d
def get_ans(nums):
for d in range(30, -1, -1):
s = 0
b = None
for i, n in enumerate(nums):
if digit(n, d):
s += 1
b = i
if s == 1:
return [nums[b]] + nums[:b] + nums[b + 1 :... | FUNC_DEF RETURN BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER BIN_OP NUMBER VAR FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER RETURN BIN_OP BIN_OP LIST VAR VAR VAR VAR VAR BIN_OP VA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
n = int(input())
arr = list(map(int, input().split()))
pref = [0] * n
suff = [0] * n
pref[0], suff[n - 1] = sys.maxsize, sys.maxsize
for i in range(1, n):
pref[i] = pref[i - 1] & ~arr[i - 1]
for i in range(n - 2, -1, -1):
suff[i] = suff[i + 1] & ~arr[i + 1]
ans = -sys.maxsize - 1
temp = 0
for i in r... | IMPORT 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 BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
arr = list(map(int, input().split(" ")))
arr.sort()
arr.reverse()
binarr = list(map(lambda s: str(bin(s))[2:], arr))
l = len(binarr[0])
start = 0
placed = []
placed2 = {}
for pos in range(l):
yes = None
for a in binarr:
a = a.zfill(l)
if a[pos] == "1" and yes == None:
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR DICT F... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def pro(x, pos):
global cou
if x == 0:
return
y = 1
z = 0
while y <= x:
y *= 2
z += 1
y //= 2
z -= 1
while z != -1:
if x >= y:
x -= y
if cou[z] == -1:
cou[z] = pos
else:
cou[z] = -2
... | FUNC_DEF IF VAR NUMBER RETURN ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR NUMBER VAR NUMBER VAR NUMBER WHILE VAR NUMBER IF VAR VAR VAR VAR IF VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
s = [int(x) for x in input().split()]
pos = [0] * 32
for i in range(0, len(s)):
t = bin(s[i])
t = t[2:]
t = "0" * (32 - len(t)) + t
for j in range(0, len(t)):
pos[j] += int(t[j])
ptr = -1
for i in range(0, len(pos)):
if pos[i] == 1:
ptr = i
break
if ptr == -1... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP NUMBER FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)
freq = {}
can = 0
for msb in range(32):
for i in a:
if i & 1 << msb > 0:
if freq.get(msb) == None:
freq[msb] = [i]
else:
freq[msb].append(i)
k = list(freq.keys())
k.sort(reverse=... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR DICT ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER IF FUNC_CALL VAR VAR NONE ASSIGN VAR VAR LIST VAR EXPR FUNC_CALL VAR VAR V... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
scale = 30
btc = [(10**6) for _ in range(scale)]
for i in range(n):
x = a[i]
for d in range(scale):
if x % 2 == 1:
if btc[d] == 10**6:
btc[d] = i
else:
btc[d] = 10**6 + 1
x //= 2
btc.reve... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER IF VAR VAR BIN_OP NUMBER NUMBER ASSIGN VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | __author__ = "tanunia"
n = int(input())
a = list(map(int, input().split()))
left, right = [(0) for _ in range(len(a))], [(0) for _ in range(len(a))]
for i in range(1, len(a)):
left[i] = left[i - 1] | a[i - 1]
right[len(a) - i - 1] = right[len(a) - i] | a[len(a) - i]
best, best_ind = -1, -1
for i in range(len(a)... | ASSIGN VAR STRING 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 VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
sys.stdin.readline()
nums = list(map(int, sys.stdin.readline().split()))
bitRecords = [0] * 32
occurrences = [None] * 32
for n in nums:
for i in range(32):
if n & 1 << i != 0:
bitRecords[i] += 1
if bitRecords[i] == 1:
occurrences[i] = n
firstNum = nums[0]
... | IMPORT EXPR 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 BIN_OP LIST NONE NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR VAR ASSIGN VAR VAR NUMBER F... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | from sys import stdin, stdout
get_string = lambda: stdin.readline().strip("\n")
get_intmap = lambda: map(int, get_string().split(" "))
def testcase():
n = int(input())
a = list(get_intmap())
not_mask = (1 << 32) - 1
a_not = tuple([(not_mask ^ i) for i in a])
dp_left, dp_right = [0] * n, [0] * n
... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR BIN_OP LIST NUMBER VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | N = int(input())
nums = [int(x) for x in input().split()]
bin_nums = [bin(x)[2:] for x in nums]
for pos in range(N):
length = len(bin_nums[pos])
bin_nums[pos] = "0" * (32 - length) + bin_nums[pos]
ind = 0
for bit in range(32):
one = 0
for pos in range(N):
if bin_nums[pos][bit] == "1":
... | 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 NUMBER VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR BIN_OP BIN_OP STRING BIN_OP NUMBER VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR N... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | N = int(input())
A = list(map(int, input().split()))
k = 1 << 31
X = -1
while k:
T = []
for i in range(N):
if A[i] & k:
T.append(i)
if len(T) == 1:
X = T[0]
break
else:
k >>= 1
if X < 0:
print(*A)
else:
ret = A[X]
A.pop(X)
print(ret, *A) | 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 NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER VAR NUMBER IF VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
readline = sys.stdin.readline
N = int(readline())
A = list(map(int, readline().split()))
M = (1 << 32) - 1
nA = [(M ^ a) for a in A]
ar = [M] + nA[:] + [M]
al = ar[:]
for i in range(1, N + 2):
al[i] &= al[i - 1]
for i in range(N, -1, -1):
ar[i] &= ar[i + 1]
d = -1
ans = None
for i in range(N):
a... | IMPORT ASSIGN 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 BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST VAR VAR LIST VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
w = []
for i in range(33):
w.append([])
for i in range(n):
h = a[i]
for j in range(30, -1, -1):
if 2**j <= h:
h -= 2**j
w[j].append(a[i])
else:
continue
t = 0
for i in range(33):
if len(w[32 - i]) ==... | 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 NUMBER EXPR FUNC_CALL VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP NUMBER VAR VAR VAR BIN_OP NUMBER VAR EXPR FUNC_... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
l = list(map(int, input().split()))
bitcount = [0] * 64
for v in l:
i = 0
while v:
if v & 1:
bitcount[i] += 1
v >>= 1
i += 1
bitstart = 0
for i in range(64):
if bitcount[i] == 1:
bitstart = i
start = 0
for v in l:
if 1 << bitstart & v:
... | 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 NUMBER FOR VAR VAR ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = [int(x) for x in input().split()]
a.sort(reverse=True)
mask = 2**30
while mask and len([ai for ai in a if ai & mask]) != 1:
mask >>= 1
for i in range(n):
if mask & a[i]:
break
a[i], a[0] = a[0], a[i]
print(*a) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER NUMBER WHILE VAR FUNC_CALL VAR VAR VAR VAR BIN_OP VAR VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR ASSIGN VAR VAR VAR NUMBER VAR NUMBER VAR VAR EXPR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
def main():
import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int, input().split()))
for j in range(32, -1, -1):
flg = 0
for i, a in enumerate(A):
if a >> j & 1:
flg += 1
idx = i
if flg == 2:
... | IMPORT FUNC_DEF IMPORT ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER IF VAR NUMBER... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | onbits = [[] for i in range(33)]
n = int(input())
nums = [int(i) for i in input().split()]
for i in range(n):
temp = bin(nums[i])[2:][::-1]
for j in range(len(temp)):
if temp[j] == "1":
onbits[j].append(i)
onbits = onbits[::-1]
for i in onbits:
if len(i) == 1:
nums[0], nums[i[0]]... | ASSIGN VAR LIST VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR NUMBER FOR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def calc(s):
b = bin(s)[2:]
b = "0" * (x - len(b)) + b
c = ""
for i in b:
if i == "1":
c += "0"
else:
c += "1"
return int(c, 2)
n = int(input())
a = list(map(int, input().split()))
x = len(bin(max(a))[2:])
if n == 1:
print(a[0])
exit()
p = [calc(a[0]... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR FUNC_CALL VAR VAR VAR ASSIGN VAR STRING FOR VAR VAR IF VAR STRING VAR STRING VAR STRING RETURN FUNC_CALL 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... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
bits = [0] * 65
for i in a:
s = bin(i)[2:]
s = s[::-1]
for i1 in range(len(s)):
if s[i1] == "1":
bits[i1] += 1
ans = [-1, -1]
for i2 in range(len(a)):
i = a[i2]
unique = 0
s = bin(i)[2:]
s = s[::-1]
summ = 0
sd ... | 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 NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING VAR VAR NUMBER ASSIGN VAR LIST NUMBER NUMBER FOR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | I = lambda: int(input())
IL = lambda: list(map(int, input().split()))
n = I()
A = IL()
smask = 0
for i in range(32):
mask = 1 << i
c = sum(a & mask > 0 for a in A)
if c > 1:
smask += mask
B = [(a - (a & smask)) for a in A]
ma = max(B)
mi = [i for i, a in enumerate(B) if a == ma][0]
mA = A.pop(mi)
pr... | 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 ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER VAR VAR IF VAR NUMBER VAR VAR ASSIGN VAR ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
num = input().split()
for i in range(n):
num[i] = int(num[i])
finals = []
l = [0] * n
for i in range(32, -1, -1):
t = 0
k = 0
for j in range(n):
a = num[j]
if (a >> i) % 2 == 1 and l[j] != 1:
k = j
t += 1
if t == 1:
finals.append(num[k... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF BIN_OP... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | import sys
n = int(sys.stdin.readline().split()[0])
a = list(map(int, sys.stdin.readline().split()))
b = [x for x in a]
idx = -1
while max(b) != 0:
c = [(x & 1) for x in b]
if c.count(1) == 1:
idx = c.index(1)
b = [(x >> 1) for x in b]
if idx >= 0:
tmp = a[idx]
a.remove(tmp)
print(tmp, ... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR NUMBER WHILE FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR VAR IF FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP ... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def f(n):
pw = 30
k = ""
for j in range(pw):
if n >> j & 1:
k = "1" + k
else:
k = "0" + k
return k
n = int(input())
a = input().split(" ")
bit = []
used = []
for i in range(30):
used.append([])
for i in range(n):
bit.append(f(int(a[i])))
for j in ran... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP STRING VAR ASSIGN VAR BIN_OP STRING VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR F... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | sp = lambda: map(int, input().split())
si = lambda: int(input())
n = si()
rawa = list(sp())
a = list(map(lambda x: list(map(int, format(x, "030b"))), rawa))
bitcount = [0] * 30
for x in a:
for b in range(30):
bitcount[b] += x[b]
bitcount2 = 0
for bit in bitcount:
bitcount2 <<= 1
bitcount2 += bit == ... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR STRING VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR FOR VAR FUNC_CA... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def solve():
n = int(input())
arr = list(map(int, input().split()))
x_a = [[] for _ in range(31)]
for i in range(n):
for x in range(31):
if arr[i] & 1 << x:
x_a[x].append(i)
m_i = 0
for x in range(30, -1, -1):
if len(x_a[x]) == 1:
m_i = x_a... | 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 LIST VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
a = list(map(int, input().split()))
bitFreq = [0] * 32
for i in a:
for j in range(0, 32):
if i & 1 << j > 0:
bitFreq[j] += 1
currBest = 0
currIn = 0
for i in range(len(a)):
currScore = 0
for j in range(0, 32):
if a[i] & 1 << j > 0 and bitFreq[j] == 1:
... | 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 NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | def main():
n = int(input())
a = list(map(int, input().split()))
st = 2**30
while st > 0:
ans = 0
ind = 0
for i in range(n):
if a[i] % (st * 2) >= st:
ans += 1
ind = i
if ans == 1:
a[0], a[ind] = a[ind], a[0]
... | 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 BIN_OP NUMBER NUMBER WHILE VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER ASSIGN VAR NUM... |
Anu has created her own function $f$: $f(x, y) = (x | y) - y$ where $|$ denotes the bitwise OR operation . For example, $f(11, 6) = (11|6) - 6 = 15 - 6 = 9$. It can be proved that for any nonnegative numbers $x$ and $y$ value of $f(x, y)$ is also nonnegative.
She would like to research more about this function and has... | n = int(input())
l = list(map(int, input().split()))
b = [0] * 32
for i in l:
x = bin(i)[2:]
d = 32 - len(x)
s = "0" * d + x
j = 0
while j < 32:
if s[j] == "1":
b[j] += 1
j += 1
f = -1
for i in range(len(b)):
if b[i] == 1:
f = i
break
if f == -1:
p... | 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 NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.