description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | for _ in range(int(input())):
u, v = map(int, input().split())
fla = 1
if u > v:
print("NO")
continue
num1 = 0
num2 = 0
for i in range(32):
if u & 1 << i:
num1 += 1
if v & 1 << i:
num2 += 1
if num1 < num2:
fla = 0
if... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER IF VAR ... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | t = int(input())
def lsb(a):
return a & -a
def solve():
a, b = map(int, input().split())
if a > b:
return "NO"
else:
ispossible = True
while b != 0:
if lsb(a) > lsb(b) or a == 0:
return "NO"
else:
a -= lsb(a)
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR RETURN STRING ASSIGN VAR NUMBER WHILE VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR NUMBER RETURN STRING VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR RETURN STRING FO... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | t = int(input())
for _ in range(t):
a, b = map(int, input().split())
if b == a:
print("YES")
continue
if b < a:
print("NO")
continue
works = True
aCount = 0
bCount = 0
i = 0
c = 1 << i
while c <= b:
if b & c:
bCount += 1
if ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR WHILE VAR VAR IF BIN_OP... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | for ct in range(int(input())):
u, v = map(int, input().split())
if u > v:
print("NO")
else:
total = 0
for i in range(30):
if 1 << i & u:
total += 1
if 1 << i & v:
total -= 1
if total < 0:
break
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR VAR NUMBER IF VAR NUMBER EXPR VAR NUMBER FUNC_CALL VAR... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | import sys
zz = 1
sys.setrecursionlimit(10**5)
if zz:
input = sys.stdin.readline
else:
sys.stdin = open("input.txt", "r")
sys.stdout = open("all.txt", "w")
di = [[-1, 0], [1, 0], [0, 1], [0, -1]]
def fori(n):
return [fi() for i in range(n)]
def inc(d, c, x=1):
d[c] = d[c] + x if c in d else x
... | IMPORT ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER IF VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR FUNC_CALL VAR STRING STRING ASSIGN VAR LIST LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER LIST NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF NU... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | q = int(input().strip())
out = ""
AAA = 2**30
for _ in range(q):
u, v = map(int, input().strip().split())
if u > v:
out += "NO\n"
else:
U, V = bin(u + AAA), bin(v + AAA)
u_1, v_1 = 0, 0
for x in range(32, 2, -1):
u_1 += U[x] == "1"
v_1 += V[x] == "1"
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR VAR VAR STRING ASSIGN VAR VAR FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR ... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | from itertools import zip_longest
Q = int(input())
queries = [tuple(map(int, input().split())) for _ in range(Q)]
def popcnt(x):
return bin(x).count("1")
for u, v in queries:
if u > v:
print("NO")
elif u == v:
print("YES")
else:
u = bin(u)[::-1]
v = bin(v)[::-1]
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING FOR VAR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | from itertools import zip_longest
from sys import *
input = stdin.readline
for _ in range(int(input())):
u, v = map(int, input().split())
bit_u, bit_v = bin(u)[2:][::-1], bin(v)[2:][::-1]
cnt_u, cnt_v = 0, 0
ans = 0
for i, j in zip_longest(bit_u, bit_v, fillvalue="0"):
if i == "1":
... | 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 NUMBER NUMBER FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR STRING IF VAR STRING VAR NUMBER IF VAR... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | import sys
mod = 1000000007
eps = 10**-9
def main():
import sys
input = sys.stdin.buffer.readline
for _ in range(int(input())):
u, v = map(int, input().split())
if u > v:
print("NO")
continue
u_bin = bin(u)[2:]
v_bin = bin(v)[2:]
if u_bin.c... | 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 VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | def main(u, v):
if u > v:
return False
if u == v:
return True
if u & 1 == 0 and v & 1 == 1:
return False
if u & 1 == v & 1:
return main(u >> 1, v >> 1)
if u & 2 == 0:
return main(u + 1, v)
k = 1
while k & u == k:
k <<= 1
k += 1
k >>... | FUNC_DEF IF VAR VAR RETURN NUMBER IF VAR VAR RETURN NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER WHILE BIN... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | def f(x):
a = []
while x:
a.append(x & 1)
x //= 2
return a + [0] * (30 - len(a))
for _ in range(int(input())):
u, v = map(int, input().split())
if u > v:
print("NO")
continue
a, b = f(u), f(v)
if a.count(1) < b.count(1):
print("NO")
continue
... | FUNC_DEF ASSIGN VAR LIST WHILE VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER RETURN BIN_OP VAR BIN_OP LIST NUMBER BIN_OP NUMBER FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | import sys
input = sys.stdin.buffer.readline
for i in range(int(input())):
u, v = map(int, input().split())
gu = []
gv = []
c = 0
k = 0
while u > 0 or v > 0:
gu.append(u % 2)
gv.append(v % 2)
u = u // 2
v = v // 2
c = c + 1
for j in range(c - 1, -1, -... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | def toBinArr(n, size=None):
if size is None:
arr = []
while n > 0:
arr.append(n % 2)
n //= 2
else:
arr = [0] * size
i = 0
while n > 0:
arr[i] = n % 2
n //= 2
i += 1
return arr
def solve(src, dst):
if ds... | FUNC_DEF NONE IF VAR NONE ASSIGN VAR LIST WHILE VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | def solve(u, v):
if u == v:
return True
if v % u == 0 and v // u & v // u - 1 == 0:
return True
if u > v:
return False
if u % 2 == 0 and v % 2 == 1:
return False
binU = format(u, "b")
binV = format(v, "b")
binULength = len(binU)
binVLength = len(binV)
... | FUNC_DEF IF VAR VAR RETURN NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR VAR NUMBER NUMBER RETURN NUMBER IF VAR VAR RETURN NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR STRING ASSIGN VAR FUNC_CALL VAR ... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | for _ in range(int(input())):
ui, vi = map(int, input().split())
if ui <= vi:
uib = str(bin(ui)[2:]).rjust(31, "0")
vib = str(bin(vi)[2:]).rjust(31, "0")
nosu = 0
nosv = 0
for i in range(30, -1, -1):
if nosu < nosv:
print("NO")
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER NUMBER STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL ... |
There is a new attraction in Singapore Zoo: The Infinite Zoo.
The Infinite Zoo can be represented by a graph with an infinite number of vertices labeled $1,2,3,\ldots$. There is a directed edge from vertex $u$ to vertex $u+v$ if and only if $u\&v=v$, where $\&$ denotes the bitwise AND operation . There are no other ed... | def check(u, v):
a = 0
b = 0
for i in range(31):
if u >> i & 1:
a += 1
if v >> i & 1:
b += 1
if b > 0:
if a <= 0:
return 0
a -= 1
b -= 1
return 1
T = int(input())
while T > 0:
T -= 1
u, v = map(... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER VAR NUMBER IF VAR NUMBER IF VAR NUMBER RETURN NUMBER VAR NUMBER VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR VAR ... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | n = int(input())
a = list(map(int, input().split()))
min_subsequence_end = [None] * 1024
min_subsequence_end[0] = 0
for a_i in a:
for x, end in enumerate(min_subsequence_end):
if end is not None and end < a_i:
if (
min_subsequence_end[a_i ^ x] is None
or min_subse... | 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 NONE NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR VAR FOR VAR VAR FUNC_CALL VAR VAR IF VAR NONE VAR VAR IF VAR BIN_OP VAR VAR NONE VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR V... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | def korney(a):
inf = float("inf")
xors_by_a = {(0): [0]}
a_by_xor = {(0): 0}
used_a = [0]
recent = set()
for ai in a:
if len(a_by_xor.keys()) == 512:
break
if ai in recent:
continue
else:
recent.add(ai)
changed = False
f... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR DICT NUMBER LIST NUMBER ASSIGN VAR DICT NUMBER NUMBER ASSIGN VAR LIST NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR FOR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | import sys
input = sys.stdin.readline
n = int(input())
a = list(map(int, input().split()))
inf = float("inf")
A = [inf] * 512
A[0] = 0
for x in a:
B = A[:]
for y in range(512):
if A[y] < x:
B[y ^ x] = min(B[y ^ x], A[y ^ x], x)
A = B[:]
ans = []
for y in range(512):
if A[y] != inf:
... | 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 FUNC_CALL VAR STRING ASSIGN VAR BIN_OP LIST VAR NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR FUNC... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | def process(A):
answer = [float("inf") for i in range(512)]
answer[0] = -1
my_count = 511
for x in A:
for y in range(512):
if answer[x ^ y] < x:
my_count -= 1
answer[y] = min(answer[y], x)
final_answer = []
for i in range(512):
if answe... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR STRING VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF VAR BIN_OP VAR VAR VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR FUNC_CALL VAR STRING EXPR FUNC_CALL ... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | n = int(input())
a = list(map(int, input().split()))
pos = {(0): 0}
to_skip = set()
for ai in a:
if ai in to_skip:
continue
changed = False
for k, v in list(pos.items()):
if v < ai:
nou = k ^ ai
if nou not in pos or ai < pos[nou]:
pos[nou] = ai
... | 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 NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR VAR IF VAR VAR ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR ASSIGN VAR BIN_OP VAR VAR IF VAR VAR VAR VAR VAR ASSIGN VAR VAR VAR... |
This is an easier version of the problem with smaller constraints.
Korney Korneevich dag up an array $a$ of length $n$. Korney Korneevich has recently read about the operation bitwise XOR , so he wished to experiment with it. For this purpose, he decided to find all integers $x \ge 0$ such that there exists an increas... | import sys
n = int(sys.stdin.readline().strip())
a = list(map(int, sys.stdin.readline().strip().split(" ")))
dp = [10000] * n
upd = [[0] for _ in range(8192)]
dp = [8192] * 8192
dp[0] = 0
for i in range(n):
for x in upd[a[i]]:
z = x ^ a[i]
p = dp[z]
if p > a[i]:
dp[z] = a[i]
... | 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 STRING ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST NUMBER VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR VA... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
z = l ^ r
c = 0
if z == 0:
print(0)
exit()
while z:
c += 1
z >>= 1
x = "1" * c
print(int(x, 2)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR WHILE VAR VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP STRING VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def solve():
l, r = map(int, input().split())
ans = l ^ r
j = 0
while 1 << j <= ans:
ans |= 1 << j
j += 1
print(ans)
solve() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE BIN_OP NUMBER VAR VAR VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
if l == r:
print(0)
elif r & r - 1 == 0:
print(r ^ r - 1)
else:
x = l ^ r
p1 = 1
while p1 <= x:
p1 *= 2
print(p1 - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split(" "))
n1 = bin(l)[2:]
n2 = bin(r)[2:]
if l == r:
print(0)
elif len(n1) < len(n2):
print(int(len(n2) * "1", 2))
else:
index = 0
for i in range(len(n1)):
if n1[i] != n2[i]:
index = i
break
print(int((len(n1) - index) * "1", 2)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR STRING NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | left, right = [int(x) for x in input().split(" ")]
if left == right:
print(0)
else:
x = 1
while x <= right:
x *= 2
x //= 2
y = x
while y > 0 and x <= left or x > right:
if x <= left:
x += y
else:
x -= y
y //= 2
print(x ^ x - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR BIN_OP VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
l, r = map(int, sys.stdin.readline().split())
i = 64
while i >= 0:
if 1 << i & l != 0 and 1 << i & r != 0 or 1 << i & l == 0 and 1 << i & r == 0:
i -= 1
else:
break
print((1 << i + 1) - 1) | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBE... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = [int(x) for x in input().split(" ")]
idx = 0
if a == b:
print(0)
else:
for i in range(63, -1, -1):
set1 = a >> i & 1
set2 = b >> i & 1
if set1 != set2:
idx = i
break
print((1 << idx + 1) - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = [int(i) for i in input().split()]
bitafter = -1
for i in range(60, -1, -1):
if l & 1 << i != r & 1 << i:
bitafter = i
break
res = 0
while bitafter >= 0:
res += 1 << bitafter
bitafter -= 1
print(res) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a = [int(x) for x in input().split()]
n = a[0] ^ a[1]
x = bin(n)[2:]
f = 0
for i in range(len(x)):
if x[i] == "1":
f = 1
break
l = len(x) - i
sum = 0
for i in range(l):
sum += 2**i
if f == 0:
sum = 0
print(sum) | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR STRING ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR BIN_O... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
if l == r:
print(0)
exit()
binr, binl = bin(r)[2:], bin(l)[2:]
binl = "0" * (len(binr) - len(binl)) + binl
for i in range(len(binl)):
if binl[i] != binr[i]:
binl = "1" * len(binl[i:])
break
print(int(binl, 2)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSI... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
l, r = map(int, sys.stdin.readline().split())
binr = list(str(bin(r)))[2:]
binl = list(str(bin(l)))[2:]
lenr = len(binr)
lenl = len(binl)
for i in range(lenr - lenl):
binl.insert(0, 0)
ans = ["1"]
length = lenr
status = 0
for i in range(0, length):
if status == 1:
ans.append("1")
if binr... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | numeros = [int(i) for i in input().split(" ")]
l = bin(numeros[0])
r = bin(numeros[1])
p = -1
if len(r) == len(l):
for i in range(len(l)):
if l[i] != r[i]:
p = i
break
if numeros[0] != numeros[1]:
saida = 2 ** (len(r) - p) - 1
print(saida)
else:
print(... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR VAR IF VAR NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUM... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
l, r = tuple(int(x) for x in sys.stdin.readline().split())
l = bin(l)
r = bin(r)
l = l[2:]
r = r[2:]
l = l.zfill(len(r))
i = 0
while l[i] == r[i]:
if i == len(l) - 1:
print(0)
return
i += 1
i = len(l) - i
print(2**i - 1) | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR IF VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def bina(bi):
binary1 = bi
decimal, i, n = 0, 0, 0
while bi != 0:
dec = bi % 10
decimal = decimal + dec * pow(2, i)
bi = bi // 10
i += 1
return decimal
def con(n):
return bin(n).replace("0b", "")
l, r = map(int, input().split())
k = con(l)
m = con(r)
k = list(str(... | FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
lx = l
rx = r
l1 = list(bin(l))[2:]
r1 = list(bin(r))[2:]
l1 = ["0"] * (len(r1) - len(l1)) + l1
n = len(r1)
ans = ["0"] * n
d = [0] * n
f = 0
for i in range(n):
if l1[i] != r1[i]:
f = 1
d[i] = f
for i in range(n):
if d[i] == 0:
ans[i] = "0"
elif l1[i] == ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP LIST STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LI... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def main():
l, r = map(int, input().split())
if l == r:
print(0)
else:
rs = ""
while r:
rs += "1" if r % 2 else "0"
r //= 2
for i in range(len(rs), 65):
rs += "0"
ls = ""
while l:
ls += "1" if l % 2 else "0"
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING WHILE VAR VAR BIN_OP VAR NUMBER STRING STRING VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER VAR STRING ASSIGN VAR STRING WHILE VAR VAR BIN_OP VAR NUMBER STRING STRING VAR NUMBER FOR VAR F... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | start, end = input().split()
start = int(start)
end = int(end)
maximum = 0
save = end
count = 0
if end ^ start == 0:
print(0)
else:
while end ^ start > 0:
end = end >> 1
start = start >> 1
count += 1
print(2**count - 1) | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER WHILE BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_O... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
z = str(bin(l ^ r))[2:]
if int(z) == 0:
print(0)
else:
print(2 ** (len(z) - z.index("1")) - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR STRING NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = map(int, input().split())
b1 = bin(b)[2:]
a1 = bin(a)[2:]
if len(a1) == len(b1):
d = b ^ a
v = d.bit_length()
print(int("0" + "1" * v, 2))
else:
print(int("1" * len(b1), 2)) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING BIN_OP STRING VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
Ri = lambda: [int(x) for x in sys.stdin.readline().split()]
ri = lambda: sys.stdin.readline().strip()
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)]
... | IMPORT ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR 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 FUN... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = map(int, input().split())
bina = bin(a)[2:]
binb = bin(b)[2:]
length = len(binb)
length2 = len(bina)
bina = "0" * (length - length2) + bina
for i in range(length):
if bina[i] == binb[i] and bina[i] == "1":
z = bina[:i] + "0" + bina[i + 1 :]
z1 = int(z, 2)
if z1 <= b and z1 >= a:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR VAR VAR STRING ASSIGN VAR BIN_OP BIN_... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = [int(c) for c in input().split()]
p = l ^ r
c = 0
while p:
c += 1
p = p >> 1
resultado = 2**c - 1
print(resultado) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = list(map(int, input().split()))
if l == r:
print(0)
else:
x = l ^ r
c = 0
while x > 0:
x = x // 2
c = c + 1
print(2**c - 1) | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = [int(i) for i in input().split(" ")]
for i in range(70, -1, -1):
if l & 1 << i == r & 1 << i:
continue
else:
print((1 << i + 1) - 1)
break
else:
print(0) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l = [int(x) for x in input().split()]
l.sort()
b, a = l
s1 = list(bin(a)[2:])
s2 = list(bin(b)[2:])
if s1 == s2:
print(0)
elif len(s1) == len(s2):
cont = 0
while s1[cont] == s2[cont]:
s1[cont] = "0"
cont += 1
for i in range(cont, len(s1)):
s1[i] = "1"
print(int("".join(s1), 2... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR ASSIGN VA... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = ["{:061b}".format(int(x)) for x in input().split()]
pot = 0
for i in range(61):
if l[i] != r[i]:
pot = 61 - i
break
if pot == 0:
print(0)
else:
print(2**pot - 2 ^ 1) | ASSIGN VAR VAR FUNC_CALL STRING FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | [l, r] = list(map(int, input().split()))
if l == r:
print(0)
else:
a = bin(l)
b = bin(r)
a = list(a[2:])
b = list(b[2:])
d = 0
if len(a) != len(b):
d = len(b) - len(a)
acta = ["0"] * d
for j in a:
acta.append(j)
a = acta
flag = 0
sol = len(... | ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FU... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = (int(x) for x in input().split())
limit = l ^ r
if limit != 0:
limit = len(bin(limit)) - 2
maxXor = "1" * limit
print(int(maxXor, 2))
else:
print(0) | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP STRING VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | lr = input()
lr_list = lr.split(" ")
l = int(lr_list[0])
r = int(lr_list[1])
xor = l ^ r
bms = 0
while xor != 0:
bms = bms + 1
xor = xor >> 1
maxxor = 0
dois = 1
while bms != 0:
maxxor = maxxor + dois
dois = dois << 1
bms = bms - 1
print(maxxor) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
j = bin(l ^ r)
ans = 0
i = 0
while 2**i <= r - l:
ans += 2**i
i += 1
while 2**i <= r:
if j[-i - 1] == "b":
break
if j[-i - 1] != "0":
ans += 2**i
i += 1
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE BIN_OP NUMBER VAR BIN_OP VAR VAR VAR BIN_OP NUMBER VAR VAR NUMBER WHILE BIN_OP NUMBER VAR VAR IF VAR BIN_OP VAR NUMBER STRING IF VAR BIN_OP VAR NUMBER STRING VAR BIN_OP NUMBER VAR V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
a = bin(l)
b = bin(r)
a = "0" * (len(b) - len(a)) + a[2 : len(a)]
b = b[2 : len(b)]
c = [(0) for i in range(len(a))]
flag = False
for i in range(len(a)):
if a[i] != b[i]:
flag = True
if flag:
c[i] = 1
ans = 0
for j in range(len(a)):
ans += c[len(a) - 1 - j] *... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = map(int, input().split())
if a == b:
print(0)
else:
x = a ^ b
c = 0
while x:
x //= 2
c += 1
print(2**c - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
lxr = l ^ r
msb = 0
while lxr:
msb += 1
lxr >>= 1
m = 0
t = 1
while msb:
m += t
t <<= 1
msb -= 1
print(m) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def solve(a: int, b: int) -> int:
if a > b:
a, b = b, a
ba = bin(a)[2:]
bb = bin(b)[2:]
r = ""
if len(ba) != len(bb):
int("1" * len(bb), 2)
else:
for ca, cb in zip(ba, bb):
if ca == cb:
r += "0"
else:
r += "1"
... | FUNC_DEF VAR VAR IF VAR VAR ASSIGN VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR VAR STRING VAR STRING VAR BIN_OP STRI... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
al = []
ar = []
while r:
p = r % 2
ar.append(p)
r = r // 2
while l:
p = l % 2
al.append(p)
l = l // 2
if len(ar) != len(al):
ans = 2 ** len(ar) - 1
else:
n = len(ar)
s = 0
k = 0
for i in range(n - 1, -1, -1):
if ar[i] != al[i]:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def power(x, a):
if a == 0:
return 1
z = power(x, a // 2)
z *= z
if a % 2:
z *= x
return z
[l, r] = list(map(int, input().split()))
a, b = bin(l)[2:], bin(r)[2:]
la, lb = len(a), len(b)
mx = max(la, lb)
a = "0" * (mx - la) + a
b = "0" * (mx - lb) + b
idx = 0
while idx < mx and not ... | FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR IF BIN_OP VAR NUMBER VAR VAR RETURN VAR ASSIGN LIST VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def main():
l, r = map(int, input().split())
if l == r:
print(0)
return
l = bin(l)[2:]
r = bin(r)[2:]
if len(l) == len(r):
i = 1
while l[i] == r[i]:
i += 1
tam = len(l) - i
else:
tam = len(r)
num = ""
for i in range(tam):
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR ASSIGN V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
x = 64
while x >= 0 and l & 1 << x == r & 1 << x:
x -= 1
print((1 << x + 1) - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
SIZE = 105
a = SIZE * [0]
b = SIZE * [0]
lr = input().split()
l = int(lr.pop(0))
r = int(lr.pop(0))
if l == r:
print(0)
else:
len1 = 0
len2 = 0
while l != 0:
a[len1] = l % 2
l = int(l / 2)
len1 += 1
while r != 0:
b[len2] = r % 2
r = int(r / 2)
... | IMPORT ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR BIN_OP VAR LIST NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
ans = 0
for i in range(63, -1, -1):
if r & 1 << i > 0 and l & 1 << i == 0:
ans = (1 << i + 1) - 1
break
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP VAR BIN_OP NUMBER VAR NUMBER BIN_OP VAR BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
for i in range(61)[::-1]:
if l >> i & 1 != r >> i & 1:
print((1 << i + 1) - 1)
exit()
print(0) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR EXPR FUNC_CALL VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
a = "{0:062b}".format(l)
b = "{0:062b}".format(r)
n = len(a)
i = 0
if l == r:
print(0)
else:
while i < n and a[i] == b[i]:
i += 1
print(2 ** (62 - i) - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
p = l
lp = -1
while p:
p = p >> 1
lp += 1
q = r
rp = -1
while q:
q = q >> 1
rp += 1
s = max(lp, rp)
n = 0
while s >= 0:
if l >> s & 1 != r >> s & 1:
n |= (r >> s & 1) << s
break
s -= 1
s -= 1
while s >= 0:
n |= 1 << s
s -= 1
print(n) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER IF BIN_OP BIN_OP VAR VAR NUMB... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
for i in range(63, -1, -1):
mx, mn = r, l
if 1 << i & l and 1 << i & r:
mx = (1 << i) - 1
mx = r ^ 1 << i | mx
elif 1 << i & l == 0 and 1 << i & r == 0:
mn = (1 << i) - 1
mn = l & mn ^ (l | 1 << i)
if mx >= l and mx <= r and mn >= l and mn... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR BIN_OP NUMBER VAR VAR IF BIN_OP BIN_OP NUMBER VAR VAR NUMBER BIN... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | string = input()
l, r = string.split()
l = int(l)
r = int(r)
p = l ^ r
x = 1
while x <= p:
x = x << 1
print(x - 1) | ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | input_arr = [int(i) for i in input().split()]
a, b = input_arr
def dec_to_bin(N):
res = [0] * 64
pos = 0
while N != 0:
last_bit = N & 1
res[pos] = last_bit
pos += 1
N = N >> 1
return res
def max_xor(a, b):
a_bin = dec_to_bin(a)
b_bin = dec_to_bin(b)
res = ... | ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
r1 = len(bin(r)) - 3
l1 = len(bin(l)) - 3
ans = 0
while l > 0:
if l1 == r1:
r -= 1 << l1
l -= 1 << l1
else:
ans = (1 << r1 + 1) - 1
break
z1 = min(l, r)
z2 = max(l, r)
l, r = z1, z2
r1 = len(bin(r)) - 3
l1 = len(bin(l)) - 3
if ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR VAR VAR BIN_OP NUMBER VAR VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER AS... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = list(map(int, input().split()))
i = 0
if l == r:
if l == 1 and r == 1:
print(0)
else:
print(1)
else:
l, r = format(l, "b"), format(r, "b")
if len(l) == len(r):
while l[i] == r[i]:
i += 1
print((1 << len(r) - i) - 1) | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF VAR VAR IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR STRING FUNC_CALL VAR VAR STRING IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR VAR VAR NUMBER EXPR F... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
a = bin(r)[2:]
b = "0" * (len(a) - len(bin(l)[2:])) + bin(l)[2:]
ans = 0
for i in range(len(a)):
if a[i] != b[i]:
ans = 2 ** (len(a) - i) - 1
break
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMB... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
def findbits(n):
bits = [None] * 66
i = 0
for i in range(66):
bits[i] = n & 1
n >>= 1
return bits
bitsa = findbits(l)
bitsb = findbits(r)
cnt = 0
for i in range(66):
if bitsa[i] != bitsb[i]:
cnt = i + 1
ans = (1 << cnt) - 1
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP LIST NONE NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR V... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def max_xor_naive(l, r):
max_xor = 0
xor = 0
for a in range(l, r + 1):
for b in range(a + 1, r + 1):
xor = a ^ b
if xor > max_xor:
max_xor = xor
return max_xor
def max_xor_efficient(l, r):
s1 = bin(l)[2:]
s2 = bin(r)[2:]
l1 = len(s1)
l2 =... | FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR VAR ASSIGN VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | from sys import stdin as si
class Solution:
def bazinga(self, a, b):
if a == b:
return 0
z = lambda x: list(bin(x))[2:]
ii = lambda x: int("".join(x), 2)
a, b = z(a), z(b)
a = ["0"] * (len(b) - len(a)) + a
i = len(b) - 1
while i > 0:
... | CLASS_DEF FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP LIST STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NU... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def number(pos):
ans = 0
for i in range(pos + 1):
ans += 2**i
return ans
l, r = input().split()
l = int(l)
r = int(r)
if l == r:
print(0)
else:
b_pos = 0
i = 0
while l > 0 or r > 0:
if l % 2 != r % 2:
b_pos = i
l >>= 1
r >>= 1
i += 1
... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER VAR BIN_OP NUMBER VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER B... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def solve():
l, r = map(int, input().split())
if l == r:
print(0)
return
mx = str(bin(l ^ r))
x = len(mx[2:])
print(2**x - 1)
solve() | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER RETURN ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def maxXORInRange(L, R):
LXR = L ^ R
msbPos = 0
while LXR:
msbPos += 1
LXR >>= 1
maxXOR, two = 0, 1
while msbPos:
maxXOR += two
two <<= 1
msbPos -= 1
return maxXOR
L, R = map(int, input().split())
print(maxXORInRange(L, R)) | FUNC_DEF ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR VAR VAR NUMBER VAR NUMBER RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
if l == r:
print(0)
exit()
x = 1
while x <= r:
x = x << 1
x = x >> 1
k = x
while x <= l or x > r:
if x <= l:
x += k
else:
x -= k
k = k >> 1
print(x ^ x - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR VAR VAR VAR IF VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_O... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def bin(a):
if a <= 1:
return a
else:
return 10 * bin(a // 2) + a % 2
def convBin(a):
k, i = 0, 0
while a != 0:
k += a % 10 * int(2**i)
a //= 10
i += 1
return k
def maxi(a, b):
if a == b:
return 0
elif a + 1 == b:
return a ^ b
e... | FUNC_DEF IF VAR NUMBER RETURN VAR RETURN BIN_OP BIN_OP NUMBER FUNC_CALL VAR BIN_OP VAR NUMBER BIN_OP VAR NUMBER FUNC_DEF ASSIGN VAR VAR NUMBER NUMBER WHILE VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR BIN_OP NUMBER VAR VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF IF VAR VAR RETURN NUMBER IF BIN_OP VAR NUMBER VAR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
p = bin(l)
p = p[2:]
q = bin(r)
q = q[2:]
t = len(q)
u = len(p)
p = (t - u) * "0" + p
ans = []
for i in range(len(q)):
if q[i] == "1" and p[i] == "0":
ans.append(1)
break
elif q[i] == "1" and p[i] == "1":
ans.append(0)
continue
elif q[i] == "0... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR STRING VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
x = l ^ r
a = 2
if l == r:
print(0)
else:
while a <= x:
a = a * 2
print(a - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
a = str(bin(l))
b = str(bin(r))
count = 0
da = len(a) - 2
db = len(b) - 2
if db > da:
for i in range(db):
count += 2**i
print(count)
elif l == r:
print(0)
elif db == da:
for i in range(3, db + 2):
if int(b[i]) == 1 and int(a[i]) == 0:
db = db ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR VAR FOR VAR FUNC_CALL VAR VAR VAR BIN_OP NUMBER VAR EXPR FUNC_CALL... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
binR = list(bin(r)[2:])
binL = list(bin(l)[2:].rjust(len(binR), "0"))
f, XOR = False, ""
for i, j in zip(binR, binL):
if i != j:
if i == "1" and not f:
f = True
XOR += "1"
if i == j:
if f:
XOR += "1"
else:
XOR +... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR STRING ASSIGN VAR VAR NUMBER STRING FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR IF VAR STRING VAR ASSIGN VAR NUMBER VAR STRING IF VAR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = map(int, input().split())
a, b = min(a, b), max(a, b)
A = bin(a)[2:]
B = bin(b)[2:]
A = "0" * (len(B) - len(A)) + A
diff = 0
for i in range(len(A)):
if A[i] != B[i]:
diff = len(A) - i
break
print(2**diff - 1) | 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 ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
for i in range(64, -2, -1):
if i < 0 or 1 << i & l != 1 << i & r:
break
print((1 << i + 1) - 1) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF VAR NUMBER BIN_OP BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def calc(n):
cnt = 0
while n > 0:
cnt += 1
n //= 2
return cnt
def main():
l, r = map(int, input().split())
k1 = calc(l)
k2 = calc(r)
while k1 >= k2:
l ^= 2 ** (k2 - 1)
r ^= 2 ** (k1 - 1)
if l == 0 and r == 0:
print(0)
return
... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP NUMBER BIN_OP VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUN... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def main():
l, r = (format(int(s), "b") for s in input().split())
le = len(r)
if len(l) == le:
for i in range(le):
if l[i] != r[i]:
print(int("1" * (le - i), 2))
break
else:
print(0)
else:
print(int("1" * le, 2))
def __sta... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR STRING VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR VAR VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP STRING BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BI... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = input().split()
if a == b:
print("0")
else:
xor = bin(int(a) ^ int(b))[2:]
a = bin(int(a))[2:]
b = bin(int(b))[2:]
ans = ""
if a[0] == b[0]:
ans += "0"
else:
ans += "1"
for i in range(len(xor)):
ans += "1"
print(int(ans, 2)) | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING IF VAR NUMBER VAR NUMBER VAR STRING VAR STRING FOR ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | def maximum(l, r):
r = bin(r)[2:]
l = bin(l)[2:].zfill(len(r))
if r[0] == "1" and l[0] == "0":
return int("1" * len(l), base=2)
else:
if l[1:] != "":
l = int(l[1:], base=2)
r = int(r[1:], base=2)
else:
return 0
return maximum(l, r)
in... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR IF VAR NUMBER STRING VAR NUMBER STRING RETURN FUNC_CALL VAR BIN_OP STRING FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER RETUR... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
hmm, t = l ^ r, 2**60
while hmm ^ t > hmm:
t //= 2
print(2 * t - 1 if hmm != 0 else 0) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP NUMBER NUMBER WHILE BIN_OP VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR NUMBER BIN_OP BIN_OP NUMBER VAR NUMBER NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | vals = list(map(int, input().split()))
l = vals[0]
r = vals[1]
if l == r:
print("0")
else:
i = 0
j = 0
while l > 0 or r > 0:
i += 1
if l & 1 ^ r & 1 == 1:
j = i
l = l >> 1
r = r >> 1
ans = 1
for i in range(0, j):
ans = ans * 2
ans -= 1
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER IF BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = [int(x) for x in input().split()]
def solve(l, r):
if l == r:
return 0
bits_l = "{0:b}".format(l)
bits_r = "{0:b}".format(r)
bits_l = "0" * (len(bits_r) - len(bits_l)) + bits_l
p = len(bits_l) - next(i for i in range(len(bits_l)) if bits_l[i] != bits_r[i]) - 1
return 2 ** (p + 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF IF VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL STRING VAR ASSIGN VAR BIN_OP BIN_OP STRING BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP FUNC_CALL VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FUN... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
l, r = tuple(int(x) for x in sys.stdin.readline().split())
maximum = -1
cur_pow = 1
while cur_pow <= r:
if cur_pow - 1 >= l:
cur_result = cur_pow ^ cur_pow - 1
maximum = max(maximum, cur_result)
cur_pow *= 2
if maximum < 0:
n_ones = len(bin(l))
str1, str2 = bin(l), bin(r)
... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR IF BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CA... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = map(int, input().split(" "))
a, b = min(a, b), max(a, b)
bina = str(bin(a))[2:]
binb = str(bin(b))[2:]
lena = len(bina)
lenb = len(binb)
ans = 0
if lena != lenb:
ans = 2**lenb - 1
else:
a = "0" * (lena - lenb) + bina
for i in range(lenb):
if bool(int(bina[i])) != bool(int(binb[i])):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER IF VAR VAR ASSIGN VAR... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | import sys
m, n = map(int, sys.stdin.readline().split())
res = m ^ n
s = bin(res)
s = s[2:]
s = int(s)
if s == 0:
print(0)
else:
s = str(s)
res = 2 ** len(s) - 1
print(res) | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR VAR |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | arra = []
arrb = []
arr = []
s = ""
temp = 1
value = ans = n = 0
def fill(myList=[], *args):
for i in range(n):
arra.insert(0, 0)
def check():
for i, j in zip(arra, arrb):
if i == j:
return 1
else:
return 0
def Engine1(num):
if num > 1:
Engine1(n... | ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR STRING ASSIGN VAR NUMBER ASSIGN VAR VAR VAR NUMBER FUNC_DEF LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER NUMBER FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR VAR IF VAR VAR RETURN NUMBER RETURN NUMBER FUNC_DEF IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NU... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
def maxXor(low, high):
highestPower = high.bit_length() - 1
if high == 1 and low == 0:
return 1
if highestPower <= 0:
return 0
if low < 2**highestPower:
return 2 ** (highestPower + 1) - 1
return maxXor(low - 2**highestPower, high - 2**highes... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER IF VAR NUMBER VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF VAR BIN_OP NUMBER VAR RETURN BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER NUMBER RETURN FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR BIN_OP VAR BIN_OP NU... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
masks = []
for i in range(64, -1, -1):
if 1 << i > r:
continue
masks.append(1 << i)
x, y = 0, 0
for k in masks:
if x < y:
x += k
else:
y += k
for j in range(64, -1, -1):
if x >> j & 1 or y >> j & 1:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP NUMBER VAR VAR EXPR FUNC_CALL VAR BIN_OP NUMBER VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR VAR IF VAR VAR VAR VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER IF BIN_OP BIN_OP VAR VAR NUMBER... |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | a, b = input().split()
a = int(a)
b = int(b)
s = a ^ b
cnt = 0
while s != 0:
s = int(s / 2)
cnt = cnt + 1
print(2**cnt - 1) | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER VAR NUMBER |
A little girl loves problems on bitwise operations very much. Here's one of them.
You are given two integers l and r. Let's consider the values of $a \oplus b$ for all pairs of integers a and b (l β€ a β€ b β€ r). Your task is to find the maximum value among all considered ones.
Expression $x \oplus y$ means applying bi... | l, r = map(int, input().split())
i = 1 << 60
while i & l == i & r and i != 0:
i = i >> 1
ans = i
while i > 0:
i = i >> 1
ans += i
print(ans) | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER NUMBER WHILE BIN_OP VAR VAR BIN_OP VAR VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR VAR WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR VAR EXPR FUNC_CALL VAR VAR |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.