description
stringlengths
171
4k
code
stringlengths
94
3.98k
normalized_code
stringlengths
57
4.99k
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
n, q = map(int, input().split()) a = int(input(), 2) b = int(input(), 2) for i in range(q): cmd = input().split() if cmd[0] == "set_a": n = 1 << int(cmd[1]) if int(cmd[2]): a = a | n else: a = a & ~n elif cmd[0] == "set_b": n = 1 << int(cmd[1]) ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR ...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(binary_num, idx, bit): value = 1 << idx if bit: return binary_num | value return binary_num & ~value n, q = map(int, input().strip().split(" ")) a = int(input().strip(), 2) b = int(input().strip(), 2) for i in range(q): cmd = input().strip().split(" ") idx = int(cmd[1]) if ...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR IF VAR RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CAL...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
n, q = map(int, input().split()) A = input().strip() B = input().strip() a = int(A, 2) + int(B, 2) A = list(map(int, A))[::-1] B = list(map(int, B))[::-1] o = "" def get(l, i): try: return l[i] except IndexError: return 0 def seT(l, i, x): if len(l) <= i: l.extend([0] * (i - len(...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR STRING...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def twiddle(n, line): i = int(line[1]) if line[2] == "0": return n & ~(1 << i) else: return n | 1 << i N, Q = map(int, input().split()) A = int(input(), 2) B = int(input(), 2) for q in range(Q): line = input().split() if line[0] == "set_a": A = twiddle(A, line) elif lin...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER STRING RETURN BIN_OP VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN ...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def getBit(num, offset): mask = 1 << offset return 1 if num & mask != 0 else 0 def setBit(num, offset, value): if value == 1: mask = 1 << offset return num | mask else: mask = ~(1 << offset) return num & mask n, q = [int(x) for x in input().split()] a = int(input(), 2...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR NUMBER NUMBER NUMBER FUNC_DEF IF VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN ...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
import sys first_line = sys.stdin.readline() arr = first_line.split(" ") N = int(arr[0]) Q = int(arr[1]) A = int(sys.stdin.readline(), 2) B = int(sys.stdin.readline(), 2) R = "" def set_val(number, idx, val): mask = 0 if int(val) == 1: mask = 1 << idx return number | mask else: ma...
IMPORT 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 FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FUNC_DEF ASSIGN VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP N...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
N, Q = map(int, input().rstrip().split(" ")) aStr = input().rstrip() A = 0 for a in aStr: A += int(a) A = A << 1 A = A >> 1 bStr = input().rstrip() B = 0 for b in bStr: B += int(b) B = B << 1 B = B >> 1 res = "" for _ in range(Q): cmd = input().rstrip().split(" ") if cmd[0] == "set_a": i...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def setBit(x, bit, val): if val: return x | 1 << bit return x & ~(1 << bit) n, q = map(int, input().strip().split(" ")) a = int(input().strip(), 2) b = int(input().strip(), 2) output = "" for _ in range(q): cmd = input().strip().split(" ") if cmd[0] == "set_a": a = setBit(a, int(cmd[1]...
FUNC_DEF IF VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR AS...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def setBit(num, bit): mask = 1 << bit return num | mask def clearBit(num, bit): mask = ~(1 << bit) return num & mask def testBit(num, bit): mask = 1 << bit return num & mask N, Q = map(int, input().split()) A = int(input(), 2) B = int(input(), 2) inp = [] for i in range(Q): inp = input...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VA...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
N, Q = input().strip().split() N, Q = int(N), int(Q) A = int(input().strip(), 2) B = int(input().strip(), 2) for q in range(Q): qu = input().strip().split() if qu[0] == "set_a": if qu[2] == "0": A = A & ~(1 << int(qu[1])) elif qu[2] == "1": A = A | 1 << int(qu[1]) eli...
ASSIGN VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING IF VAR NUMBER ST...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
import sys def get(a, b, bit): c = a + b return str(int(bool(c & 1 << bit))) def setbit(a, bit, val): add_ = 1 << bit if val: return a | add_ return a & ~add_ n_bits, Q = map(int, input().strip().split(" ")) A = int(input().strip(), 2) B = int(input().strip(), 2) out = "" for _ in rang...
IMPORT FUNC_DEF ASSIGN VAR BIN_OP VAR VAR RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR BIN_OP NUMBER VAR FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR IF VAR RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FU...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(number, bit, value): if value: return number + (1 << bit) else: return number - (1 << bit) def test(number, bit): return number >> bit & 1 n, q = input().split() n, q = int(n), int(q) a, b = int(input(), 2), int(input(), 2) c = a + b for i in range(q): op, *args = input()...
FUNC_DEF IF VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR B...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(val, i, bit): num = 1 << i if bit: return val | num return val & ~num NQ = input() two_ints = NQ.split() N, Q = int(two_ints[0]), int(two_ints[1]) A = int(input(), 2) B = int(input(), 2) output = [] for i in range(Q): input_line = input() split_input = input_line.split() qu...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR IF VAR RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR LIST FOR VAR ...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
N, Q = map(int, input().split()) A = int(input(), 2) B = int(input(), 2) output = "" for _ in range(Q): inputLine = list(input().split()) if inputLine[0] == "set_a": idx = int(inputLine[1]) x = int(inputLine[2]) A &= ~(1 << idx) A |= x << idx elif inputLine[0] == "set_b": ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER STRING ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL ...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(k, idx, x): bit = 1 << idx result = k | bit if x == 1 else k & ~bit return result def changeBits(a, b, queries): a = int(a, 2) b = int(b, 2) result = "" for q in queries: command, *args = q.split(" ") args = [int(k) for k in args] if command == "set_a": ...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR VAR NUMBER BIN_OP VAR VAR BIN_OP VAR VAR RETURN VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING FOR VAR VAR ASSIGN VAR VAR FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR VAR VAR VAR IF VAR STRING ASSIGN VAR VAR VAR AS...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(n, i, x): if x == 1: return n | 1 << i else: return n & ~(1 << i) def get_bit(n, i): return (n >> i) - (n >> i + 1 << 1) _, q = map(int, input().split(" ")) a = int(input(), 2) b = int(input(), 2) set_a = lambda i, x: set_bit(a, i, x) set_b = lambda i, x: set_bit(b, i, x) get...
FUNC_DEF IF VAR NUMBER RETURN BIN_OP VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR FUNC_DEF RETURN BIN_OP BIN_OP VAR VAR BIN_OP BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def set_bit(val, idx, bit): mask = 1 << idx if bit: return val | mask return val & ~mask def get_bit(val, idx): mask = 1 << idx return int(bool(val & mask)) n, q = map(int, input().strip().split(" ")) a = int(input().strip(), 2) b = int(input().strip(), 2) for i in range(q): cmd = in...
FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR IF VAR RETURN BIN_OP VAR VAR RETURN BIN_OP VAR VAR FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR RETURN FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR NUMBER ASSIGN VAR FU...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
def setat(a, i, val): if val: return a | 1 << i return a & ~(1 << i) n, q = map(int, input().strip().split(" ")) a = int(input(), 2) b = int(input(), 2) for _ in range(q): l = input().strip().split(" ") i = int(l[1]) if l[0] == "set_a": value = int(l[2]) a = setat(a, i, val...
FUNC_DEF IF VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR RETURN BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
import sys def set_bit(n, i, val): part = 1 << i if int(val) == 1: return n | part elif n & part > 0: return n - part else: return n len_a, len_b = (int(i) for i in input().split()) a = int(input(), 2) b = int(input(), 2) for line in sys.stdin: parts = line.split() if...
IMPORT FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR IF FUNC_CALL VAR VAR NUMBER RETURN BIN_OP VAR VAR IF BIN_OP VAR VAR NUMBER RETURN BIN_OP VAR VAR RETURN VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER FOR VAR VAR AS...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
n, q = map(int, input().split(" ")) a = int(input(), 2) b = int(input(), 2) out = "" for i in range(q): query = input().strip().split(" ") cmd = query[0] i = int(query[1]) if cmd == "set_a": bit = int(query[2]) if bit: a |= 1 << i else: a &= ~(1 << i) ...
ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF VAR STR...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
class BitCalculator: def __init__(self, a, b): self.a = a self.b = b def set_a(self, idx, x): if x == "0": self.a &= ~(1 << int(idx)) else: self.a |= 1 << int(idx) def set_b(self, idx, x): if x == "0": self.b &= ~(1 << int(idx)) ...
CLASS_DEF FUNC_DEF ASSIGN VAR VAR ASSIGN VAR VAR FUNC_DEF IF VAR STRING VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_DEF IF VAR STRING VAR BIN_OP NUMBER FUNC_CALL VAR VAR VAR BIN_OP NUMBER FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR BIN_OP VAR VAR RETURN BIN_OP BIN_OP VAR FUNC_CALL VAR VAR NUM...
Let a and b be binary numbers of length n (MSB to the left). The following commands may be performed: set_a idx x: Set $a[i dx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $a[i dx]$ is $\text{id}x^{\text{th}}$ least significant bit of $a$. set_b idx x: Set $b[idx]$ to $\boldsymbol{x}$, where $0\leq idx<n$ and $b...
n, q = list(map(int, input().split())) a = int(input(), 2) b = int(input(), 2) output = "" for i in range(q): cmd = input().split() idx = int(cmd[1]) mask = 1 << idx if "set" in cmd[0]: val = int(cmd[2]) if "_a" in cmd[0]: a &= ~mask if val == 1: a...
ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF STRING VAR...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = [int(i) for i in input().split()] if x % 2 == 0: b = 2 ^ y c = b ^ x elif y % 2 == 0: b = 2 ^ x c = b ^ y else: b = 2 ^ x c = 2 ^ y print(" ".join(["2", str(min(b, c)), str(max(b, c))]))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
tests = int(input()) for i in range(tests): x, y = map(int, input().split()) a = 2 c = x ^ y ^ 2 if x & 1 and y & 1: b = 2 ^ x c = 2 ^ y elif x & 1: b = 2 ^ x else: b = 2 ^ y total = a + b + c minimum = min(a, b, c) maximum = max(a, b, c) print(min...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP NUMB...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y arr = [] if x % 2 == 0: arr = [2, y ^ 2, z ^ 2] elif y % 2 == 0: arr = [x ^ 2, 2, z ^ 2] elif z % 2 == 0: arr = [x ^ 2, y ^ 2, 2] arr.sort() for i in arr: print(i, end=" ") print(...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR LIST BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMB...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for _ in range(t): x, y = map(int, input().split()) z = x ^ y a = 2 if x % 2 != 0: b = x ^ 2 if y % 2 != 0: c = y ^ 2 else: c = y ^ b elif y % 2 != 0: b = y ^ 2 c = x ^ b else: b = z ^ 2 c = x ^ b ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for h in range(int(input())): x, y = map(int, input().split(" ")) a = 2 arr = [x, y] ar = [2] if 2 ^ (2 ^ x) in arr and (2 ^ x) % 2: b = 2 ^ x ar.append(b) if (a ^ (a ^ y) == y or b ^ (a ^ y) == y) and (a ^ y) % 2: ar.append(a ^ y) if (a ^ (b ^ y) == y or ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER ASSIGN VAR LIST VAR VAR ASSIGN VAR LIST NUMBER IF BIN_OP NUMBER BIN_OP NUMBER VAR VAR BIN_OP BIN_OP NUMBER VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR BIN_...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def isprime(num): n = int(num, 2) tof = True for i in range(2, int(n ** (1 / 2) // 1) + 1): if n % i == 0: tof = False break return tof def bx(a, b): k = "0" n = max(len(a), len(b)) a = a.zfill(n) b = b.zfill(n) for i in range(n): k += str((i...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER BIN_OP FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER NUMBER NUMBER NUMBER IF BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER RETURN VAR FUNC_DEF ASSIGN VAR STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR F...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
T = int(input()) vector = lambda x, t: [t(num) for num in x.split()] for _ in range(T): x, y = vector(input(), int) z = x ^ y if x & 1 and y & 1: b = 2 a = 2 ^ x c = z ^ a ans = sorted([a, b, c]) print(*ans) elif y & 1 and z & 1: c = 2 a = z ^ c ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VA...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) while t: x, y = map(int, input().split()) z = x ^ y l = [2, 2, 2] if x & 1: l[0] = x ^ 2 if y & 1: l[1] = y ^ 2 if z & 1: l[2] = z ^ 2 l.sort() for i in l: print(i, end=" ") print() t = t - 1
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBE...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
tc = int(input().strip()) for t in range(tc): x, y = map(int, input().split()) z = x ^ y abc = [2] if x % 2 == 1: abc.append(x ^ 2) if y % 2 == 1: abc.append(y ^ 2) if z % 2 == 1: abc.append(z ^ 2) abc.sort() print(*abc)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def solution(): x, y = list(map(int, input().split())) z = x ^ y ans = [2, 2, 2] if x & 1: ans[0] = x ^ 2 if y & 1: ans[1] = y ^ 2 if z & 1: ans[2] = z ^ 2 ans.sort() print(ans[0], ans[1], ans[2]) n = int(input()) for i in range(n): solution()
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER EXPR F...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) a = 2 if x % 2 == 0: print(*sorted([2, y ^ 2, x ^ y ^ 2])) elif y % 2 == 0: print(*sorted([2, x ^ 2, y ^ x ^ 2])) else: print(*sorted([2, x ^ 2, y ^ 2]))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR LIST NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR LIST NUMBER BI...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y l = [x, y, z] a = [] for i in range(3): if l[i] & 1 == 1: a.append(l[i] ^ 2) print("2", str(min(a)), str(max(a)))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST VAR VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR STRING FUNC_CALL VAR F...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for i in range(t): xy = list(map(int, input().split())) x = xy[0] y = xy[1] if x % 2 == 0 and y % 2 == 1: c = 2 b = y ^ 2 a = x ^ b print(c, min(b, a), max(b, a)) elif x % 2 == 1 and y % 2 == 0: a = 2 b = x ^ 2 c = y ^ b ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for _ in range(t): x, y = [int(x) for x in input().split()] res = [2] * 3 z = x ^ y if x & 1: res[0] = x ^ 2 if y & 1: res[1] = y ^ 2 if z & 1: res[2] = z ^ 2 res.sort() for val in res: print(val, end=" ") print()
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUM...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) if x % 2 == 1 and y % 2 == 1: a = x ^ 2 b = 2 c = y ^ 2 elif y % 2 == 1: a = x ^ y ^ 2 b = y ^ 2 c = 2 else: a = 2 b = x ^ 2 c = x ^ y ^ 2 l = sorted([a, b, c]) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_O...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
T = int(input()) for tc in range(T): x, y = map(int, input().split(" ")) z = x ^ y prime = [2] for alphabet in [z, x, y]: if alphabet % 2 == 1: if alphabet % 4 == 1: prime.append(alphabet + 2) else: prime.append(alphabet - 2) prime.sort...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER FOR VAR LIST VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_O...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y if x % 2 == 0: c = 2 b = y ^ c a = z ^ c elif y % 2 == 0: a = 2 c = z ^ a b = x ^ a elif z % 2 == 0: b = 2 c = y ^ b a = x ^ b print(*sorted([a, b, c])...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y start = [x, y, z] if x % 2 == 0: c = 2 b = y ^ 2 a = z ^ 2 elif y % 2 == 0: a = 2 b = x ^ 2 c = z ^ 2 elif z % 2 == 0: b = 2 a = x ^ 2 c = y ^ 2 an...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VA...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split(" ")) ans = [] if x % 2 != 0 and y % 2 != 0: b = 2 c = y ^ b a = x ^ b ans.append(a) ans.append(b) ans.append(c) elif x % 2 == 0 and y % 2 != 0: c = 2 b = y ^ c a = x ^ b ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VA...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y if x % 2 == 1 and y % 2 == 1: b = 2 a = x ^ b c = y ^ b elif x % 2 == 1 and z % 2 == 1: a = 2 b = x ^ a c = z ^ a elif y % 2 == 1 and z % 2 == 1: c = 2 b = y ^ c ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): lst = [2] x, y = map(int, input().split()) if x % 2 != 0: ans = 2 ^ x lst.append(ans) if y % 2 != 0: ans = 2 ^ y lst.append(ans) if x % 2 == 0: ans = lst[-1] ^ x lst.append(ans) if y % 2 == 0: ans = lst[-1] ^ y...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER AS...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def fill(): bit = [] for i in range(30): bit.append(0) return bit def gen(num, bit, n=1): bit[30 - n] = num % 2 num = num // 2 if num == 0: return bit else: n += 1 return gen(num, bit, n) def xor(bit_m, bit_n): bit_p = fill() p = 0 for i in ran...
FUNC_DEF ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR NUMBER RETURN VAR FUNC_DEF NUMBER ASSIGN VAR BIN_OP NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF VAR NUMBER RETURN VAR VAR NUMBER RETURN FUNC_CALL VAR VAR VAR VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CAL...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for i in range(int(input())): x, y = map(int, input().split()) x1 = list(bin(x).replace("0b", "")) y1 = list(bin(y).replace("0b", "")) if x == 1: x1 = ["0"] + x1 if y == 1: y1 = ["0"] + y1 if x % 2 == 1: if x1[len(x1) - 2] == "0": x1[len(x1) - 2] = "1" ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING ASSIGN VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR VAR STRING STRING IF VAR NUMBER ASSIGN VAR BIN_OP LIST STRING VAR IF VAR NUMBER ASSIGN VAR BIN_OP...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
ri = lambda: int(input()) rl = lambda: list(map(int, input().split())) rs = lambda: input() def solve(): x, y = rl() z = x ^ y ans = [2] if x % 2 == 0: ans.append(y ^ 2) ans.append(z ^ 2) elif y % 2 == 0: ans.append(x ^ 2) ans.append(z ^ 2) elif z % 2 == 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 FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for case in range(int(input())): X, Y = map(int, input().split()) if X % 2 and Y % 2: li = [2, X ^ 2, Y ^ 2] elif X % 2: li = [2, X ^ 2, Y ^ X ^ 2] else: li = [2, Y ^ 2, X ^ Y ^ 2] li.sort() print(*li)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER BIN_OP VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR LIST NUMBER BIN_OP VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR LIST NUMBER B...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): X, Y = [int(x) for x in input().split()] ans = [2] for x in [X, Y, X ^ Y]: if (2 ^ x) % 2: ans.append(2 ^ x) print(*sorted(ans[:3]))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER FOR VAR LIST VAR VAR BIN_OP VAR VAR IF BIN_OP BIN_OP NUMBER VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for i in range(int(input())): x, y = map(int, input().split()) x1, y1 = x, y if x % 2 == 1: x1 = x1 ^ 2 if y % 2 == 1: y1 = y1 ^ 2 if x % 2 == 0: x1 = y1 ^ x if y % 2 == 0: y1 = x1 ^ y k = sorted([2, x1, y1]) print(k[0], k[1], k[2], sep=" ")
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 VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER N...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def solution(): x, y = map(int, input().split()) z = x ^ y ans = [2, 2, 2] if x & 1: ans[0] = x ^ 2 if y & 1: ans[1] = y ^ 2 if z & 1: ans[2] = z ^ 2 ans.sort() return ans t = int(input()) for test in range(t): print(" ".join(str(char) for char in solution()...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR R...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for tc in range(t): x, y = map(int, input().split()) z = x ^ y l = [] if x % 2 != 0 and y % 2 == 0: l.append(x ^ 2) l.append(2) l.append(z ^ 2) if x % 2 == 0 and y % 2 != 0: l.append(y ^ 2) l.append(2) l.append(z ^ 2) if x % 2 != 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 BIN_OP VAR VAR ASSIGN VAR LIST IF BIN_OP VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def solve(): X, Y = map(int, input().split()) Z = X ^ Y ans = [2, 2, 2] if X & 1: ans[0] = X ^ 2 if Y & 1: ans[1] = Y ^ 2 if Z & 1: ans[2] = Z ^ 2 ans.sort() print(ans[0], end=" ") print(ans[1], end=" ") print(ans[2]) t = int(input()) while t > 0: so...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR E...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
l = -1 m = -1 n = l + m for i in range(int(input())): a1, b1 = [int(x) for x in input().split()] if a1 % 2 == 0: b = 2 ^ b1 c = b ^ a1 elif b1 % 2 == 0: b = 2 ^ a1 c = b ^ b1 else: b = 2 ^ a1 c = 2 ^ b1 print("%d %d %d" % (2, min(b, c), max(b, c)))
ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
n = int(input()) for i in range(n): x, y = map(int, input().split()) l = [2] if x & 1 and y & 1: l.append(x ^ 2) l.append(y ^ 2) elif x & 1: l.append(x ^ 2) l.append(l[-1] ^ y) else: l.append(y ^ 2) l.append(l[-1] ^ x) l.sort() print(*l)
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 LIST NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y a = [] a.append(2) if x & 1 != 0: a.append(2 ^ x) if y & 1 != 0: a.append(2 ^ y) else: a.append(2 ^ z) else: a.append(2 ^ y) a.append(2 ^ z) a.sort() p...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
i = int(input()) listk = [] for _ in range(i): kk2 = input().split() kk = [] tot = [] for ele in kk2: kk.append(int(ele)) if (kk[0] ^ kk[1]) % 2 == 1: tot.append(2) k0 = "" if kk[0] % 2 == 1: tot.append(kk[0] ^ 2) tot.append(kk[0] ^ 2 ^ kk[1]) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR NUMBER VAR NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR STRING IF BIN_OP VAR NUMBER NUMBE...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def solve(): x, y = map(int, input().split()) res = [2] if x & 1 and y & 1: res.append(2 ^ x) res.append(2 ^ y) elif x & 1: res.append(2 ^ x) res.append(res[-1] ^ y) else: res.append(2 ^ y) res.append(res[-1] ^ x) print(" ".join(map(str, sorted(res...
FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER IF BIN_OP VAR NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
I = lambda: input() IN = lambda: int(input()) M = lambda: map(int, input().strip().split()) L = lambda: list(map(int, input().strip().split())) LCHR = lambda: [i for i in input()] LW = lambda: [i for i in input().split()] for _ in range(IN()): x, y = M() l = [2] if x % 2 == 1 and y % 2 == 1: l.exten...
ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSI...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
testcases = int(input()) for eachcase in range(testcases): x, y = map(int, input().split()) z = x ^ y arr = [2, 2, 2] if x & 1: arr[0] = x ^ 2 if y & 1: arr[1] = y ^ 2 if z & 1: arr[2] = z ^ 2 arr.sort() print(*arr)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): X, Y = map(int, input().split()) Z = X ^ Y A = 2 if X % 2 != 0: B = 2 ^ X if Y % 2 != 0: C = 2 ^ Y else: C = 2 ^ Z else: B = 2 ^ Y C = 2 ^ Z print(" ".join(map(str, sorted([A, B, C]))))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP NUMBER V...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
n = int(input()) for i in range(n): x, y = map(int, input().split()) z = x ^ y q = [x, y, z] for i in range(3): if q[i] % 2 == 0: q[i] = 2 else: q[i] ^= 2 print(*sorted(q))
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
def function(X, Y): Z = X ^ Y if X % 2 == 0: C = 2 B = Y ^ C A = X ^ B arr = sorted([A, B, C]) return " ".join(str(i) for i in arr) elif Y % 2 == 0: A = 2 B = X ^ A C = Z ^ A arr = sorted([A, B, C]) return " ".join(str(i) for i ...
FUNC_DEF ASSIGN VAR BIN_OP VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR FUNC_CALL VAR LIST VAR VAR VAR RETURN FUNC_CALL STRING FUNC_CALL VAR VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR V...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for _ in range(int(input())): x, y = map(int, input().split()) z = x ^ y ans = [2] for n in (x, y, z): if n % 2: ans.append(n ^ 2) print(*sorted(ans))
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER FOR VAR VAR VAR VAR IF BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR VAR
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for x in range(t): x, y = map(int, input().split()) z = x ^ y a = [2] if x % 2 == 0: a.append(a[0] ^ y) a.append(a[0] ^ z) elif y % 2 == 0: a.append(a[0] ^ z) a.append(a[0] ^ x) elif z % 2 == 0: a.append(a[0] ^ y) a.append(a[0] ^ x...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_C...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for _ in range(t): x, y = map(int, input().split()) z = x ^ y lst = [2] if x % 2 == 1: a = 2 b = x ^ 2 lst.append(b) if y % 2 == 1: b = 2 c = y ^ 2 lst.append(c) if z % 2 == 1: c = 2 a = z ^ 2 lst.append(a) ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIG...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
t = int(input()) for i in range(t): l = input().split() x = int(l[0]) y = int(l[1]) z = x ^ y a = [2, 2, 2] if x % 2 != 0: a[0] = x ^ 2 if y % 2 == 1: a[1] = y ^ 2 if z % 2 == 1: a[2] = z ^ 2 a.sort() for j in range(3): print(a[j], end=" ") pri...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR LIST NUMBER NUMBER NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER ...
For 3 distinct prime integers A, B, and C (1 < A,B,C < 2^{30}), we define positive integers X, Y, and Z as: X = A\oplus B, Y = B\oplus C, and Z = C\oplus A, where \oplus denotes the [bitwise XOR] operation. Given only two integers X and Y and the fact that at least one integer amongst X, Y, and Z is odd, find the ...
for i in range(int(input())): x, y = [int(x) for x in input().split()] ans = [] if x % 2 == 1: ans.append(x ^ 2) if y % 2 == 1: ans.append(y ^ 2) else: ans.append(y ^ ans[0]) else: ans.append(y ^ 2) ans.append(ans[0] ^ x) ans.append(2) ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR BIN...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
l1 = int(input()) for _ in range(l1): n = int(input()) sumi = 0 if n & n - 1 == 0: print(-1) else: sumi += (n - 1) // 2 i = 2 while i <= n: temp = n // i temp2 = temp + 1 temp3 = temp2 // 2 sumi += i * temp3 i *=...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
pow2 = [1] for i in range(1, 31): pow2.append((pow2[-1] << 1) + 1) pow21 = [1] for i in range(1, 32): pow21.append(pow21[-1] << 1) def cost(n): if n == 0: return 0 idx = 0 for i in range(31): if pow2[i] > n: idx = i - 1 break tmp = pow2[idx] ans = in...
ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR LIST NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR VAR A...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
def isPowerOfTwo(x): return x and not x & x - 1 def dp(n): if isPowerOfTwo(n): return -1 b = bin(n)[2:] c = 0 for i in range(1, len(b)): mul = int(b[:i], 2) + 1 if b[i] == "0": mul -= 1 c += mul * pow(2, len(b) - 1 - i) c += pow(2, len(b) - 1) re...
FUNC_DEF RETURN VAR BIN_OP VAR BIN_OP VAR NUMBER FUNC_DEF IF FUNC_CALL VAR VAR RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER NUMBER IF VAR VAR STRING VAR NUMBER VAR BIN_OP VAR FUNC_CALL VAR NUMBER BIN_OP ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
case = int(input()) for r in range(case): n = int(input()) if n == 2: print(-1) continue if n & n - 1 == 0: print(-1) continue summ = n - 1 - n // 2 pw = 1 while pow(2, pw) <= n: pw += 1 for i in range(1, pw): nu = pow(2, i) summ += ((n...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE FUNC_CALL VAR NUMBER VAR VAR VAR ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
import sys from sys import stdin, stdout for _ in range(int(stdin.readline())): n = int(stdin.readline()) if n == 2: print(-1) continue if n == 3: print(3) continue if n % 2 == 0: x = n // 2 else: x = n // 2 + 1 ans = x - 1 bn = bin(n) if ...
IMPORT FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
T = int(input()) for i in range(T): n = int(input()) ans = -1 curr = 1 while True: if curr == n: ans = -1 break elif curr > n: break ans += curr * ((n + curr) // (2 * curr)) curr *= 2 print(ans)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR VAR ASSIGN VAR NUMBER IF VAR VAR VAR BIN_OP VAR BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR VAR
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
for _ in range(int(input())): n = int(input()) answer = 0 if n % 2 == 0: answer += n // 2 - 1 else: answer += n // 2 x = 2 while 1: if x == n: answer = -1 break else: q = n // x if q == 0: break ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE NUMBER IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR IF VAR NUMBER IF BIN_OP VAR NUMBER NUMBER...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
def sol(n): i = 1 ans = 0 while i <= n: ans += (n - i) // (i << 1) * i i <<= 1 i = 2 while i < n: ans += i i <<= 1 return ans t = int(input()) for i in range(t): n = int(input()) if n & n - 1 == 0: print(-1) else: print(sol(n))
FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR NUMBER VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR VAR VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMB...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
for t in range(int(input())): n = int(input()) b_n = bin(n)[2:] if b_n.count("1") == 1: print(-1) continue a = n // 2 - (n % 2 == 0) q = 2 while q <= n: x = n // q - n // (2 * q) a += q * x q = q * 2 print(a)
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR BIN_OP VAR B...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
def main(): T = int(input()) for _ in range(T): N = int(input()) if N & N - 1 == 0: print(-1) else: counter = (N + 1) // 2 - 1 nextCost = 2 while nextCost < N: counter += (N - nextCost) // (2 * nextCost) * nextCost + nextCos...
FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMBER...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
t = int(input()) for xx in range(t): n = int(input()) if n & n - 1 == 0: print(-1) continue res = 0 if n % 2 == 1: res += (n - 1) // 2 n = res else: res += n // 2 - 1 n = n // 2 i = 2 while n != 1: if n % 2 == 1: res += (n +...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR VAR VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
for _ in range(int(input())): n = int(input()) l = [] now = 1 while now < n: l.append(now) now = now << 1 l.append(now << 1) if now == n: print(-1) continue ans = 0 for i in range(len(l) - 1): ans += l[i] * ((n - l[i]) // l[i + 1]) ans += l...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP FUNC_CALL ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
ipnl = lambda n: [int(input()) for _ in range(n)] inp = lambda: int(input()) ip = lambda: [int(w) for w in input().split()] for _ in range(inp()): n = inp() if n and not n & n - 1: print(-1) continue cost = -1 i = 0 while n: ct = (n - 1) // 2 + 1 cost += ct * pow(2, i...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF VAR BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHIL...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
li = [pow(2, x) for x in range(32)] T = int(input()) for i in range(T): n = int(input()) x = 30 val = 0 flag = 1 prev = n // li[x + 1] while x > 0: if li[x] == n: print(-1) flag = 0 break now = n // li[x] val = val + li[x] * (now - prev...
ASSIGN VAR FUNC_CALL VAR NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER WHILE VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
t = int(input()) while t: t = t - 1 n = int(input()) pw = 1 ans = 0 if n & n - 1 == 0: print(-1) continue while pw <= n: ans = ans + (int(n / pw) - int(n / (2 * pw))) * pw pw = pw * 2 print(ans - 1)
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP BIN_OP FUNC_CALL VAR BIN_OP VAR VAR FUNC_CALL VAR BIN_OP VA...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
t = int(input()) answer = "" for _ in range(t): n = int(input()) if not n & n - 1: answer += "-1\n" continue oddNumCnt = (n + 1) // 2 cost = oddNumCnt - 1 currCost = 2 while currCost < n: cost += (n - currCost) // (2 * currCost) * currCost + currCost currCost <<= ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER VAR STRING ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMB...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
dp = [] x = 2 while x <= 10**9: dp.append(x) x = x << 1 for T in range(int(input())): n = int(input()) if n in dp: print(-1) else: res = 0 for i in range(len(dp)): if dp[i] > n: break num = n // dp[i] if num % 2 == 0: ...
ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR BIN_OP NUMBER NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR VAR VAR ASSI...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
for _ in range(int(input())): n = int(input()) x = 1 if n & n - 1 == 0: print(-1) else: tot = 0 while x <= n: m = n // x t = (m + 1) // 2 if x > 1: c = t * x else: c = (t - 1) * x tot += c...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER IF BIN_OP VAR BIN_OP VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER IF VAR NUMBER ASSIGN VAR BIN_OP VAR VAR ASSIGN ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
for _ in range(int(input())): n = int(input()) if not n & n - 1: print(-1) else: count = (n - 1) // 2 i = 1 while True: m = 2**i if m < n: v = (n - m) // (2 * m) + 1 count += v * m i += 1 else...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR N...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
t = int(input()) arr = [(2**i) for i in range(1, 32)] for _ in range(t): d = int(input()) if d in arr: print(-1) elif d == 3: print(3) else: sum = (d - 1) // 2 i = 2 while i < d: m = d // i sum += (m + 1) // 2 * i i = i * 2 ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF VAR VAR EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR ASS...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
from sys import * t = int(stdin.readline()) for _ in range(t): n = int(stdin.readline()) a = bin(n) if a.count("1") == 1: print(-1) continue if n == 2: print(-1) continue if n == 3: print(3) continue if n % 2 == 0: x = n // 2 else: ...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP VAR ...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
L = [(1 << i) for i in range(31)] for _ in range(int(input())): n = int(input()) t = n c = 0 while t: c += 1 t = t & t - 1 if c > 1: break if c == 1: print(-1) continue res, t, k = 0, 0, 0 while L[t] < n: t += 1 for l in range(t...
ASSIGN VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR NUMBER IF VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUM...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
import sys input = sys.stdin.readline for _ in range(int(input())): n = int(input()) if not n & n - 1: print(-1) continue count = (n - 1) // 2 i = 2 while i < n: count += ((n - i) // (2 * i) + 1) * i i <<= 1 print(count)
IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR IF BIN_OP VAR BIN_OP VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR BIN_OP BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP NUMBER VAR NUMBER VAR VAR NUM...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
l = [(2**x) for x in range(32)] t = int(input()) for i in range(t): n = int(input()) x = 30 v = 0 f = 1 while x > 0: if l[x] == n: print(-1) f = 0 break v += l[x] * (n // l[x] - n // l[x + 1]) x -= 1 if n % 2 == 0: v += n // 2 -...
ASSIGN VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER IF VAR VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR BIN_OP VAR VAR BIN_OP BIN_OP...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
def roads(n): res = 0 if n % 2 == 1: res += n // 2 else: res += n // 2 - 1 i = 2 while n > 0: n //= 2 if n % 2 == 0: res += i * (n // 2) else: res += i * (n // 2 + 1) i <<= 1 return res t = int(input()) while t > 0: n ...
FUNC_DEF ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER IF BIN_OP VAR NUMBER NUMBER VAR BIN_OP VAR BIN_OP VAR NUMBER VAR BIN_OP VAR BIN_OP BIN_OP VAR NUMBER NUMBER VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_C...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
power = [] val = 1 while val < 1000000000: power.append(val) val *= 2 power.append(val) t = int(input()) for T in range(t): n = int(input()) bn = bin(n)[2:] if bn.count("1") == 1: print(-1) continue ans = 0 for i in range(len(power)): if power[i] > n: brea...
ASSIGN VAR LIST ASSIGN VAR NUMBER WHILE VAR NUMBER EXPR FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER IF FUNC_CALL VAR STRING NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR NUMB...
Read problems statements in [Hindi], [Mandarin Chinese], [Russian], [Vietnamese], and [Bengali] as well. In Chefland, there are $N$ cities (numbered $1$ through $N$). Initially, there are no roads between them. The Mayor of Chefland has ordered engineers to build roads across Chefland in such a way that each city is r...
t = int(input()) ans = [] for ti in range(t): n = int(input()) ansi = 0 lsb = 1 fake_n = n while fake_n % 2 == 0: fake_n //= 2 lsb *= 2 if lsb == n: ans.append(-1) else: fake_n = n msb = 1 while fake_n > 1: msb *= 2 fake...
ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR WHILE BIN_OP VAR NUMBER NUMBER VAR NUMBER VAR NUMBER IF VAR VAR EXPR FUNC_CALL VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBE...
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
def bit_gen(x): l = [(0) for _ in range(27)] for i in range(1, 28): l[-i] = x % 2 x = x // 2 return l for _ in range(int(input())): a, b, c = map(int, input().split()) a, b, c = bin(a)[2:], bin(b)[2:], bin(c)[2:] m = max(len(a), len(b), len(c)) a = "0" * (m - len(a)) + a ...
FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR NUMBER FUNC...
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
import sys sys.setrecursionlimit(10**8) for _ in range(int(input())): a, b, c = map(int, input().split()) p = 1 cnt = 0 for i in range(30): if ( a & p == 0 and b & p == 0 and c & p != 0 or a & p != 0 and b & p != 0 and c & ...
IMPORT EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP VAR VAR NUMBER BIN_OP...
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
for _ in range(int(input())): a, b, c = map(int, input().split()) carry = 0 for i in range(30): x, y, z = a >> i & 1, b >> i & 1, c >> i & 1 carry ^= x == y and y != z print("YES" if not carry else "NO")
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER BIN_OP BIN_OP VAR VAR NUMBER VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR STRING STRING
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
for _ in range(int(input())): a, b, c = map(int, input().split()) carry = 0 for bits in range(28): x = a >> bits & 1 y = b >> bits & 1 z = c >> bits & 1 if x == y and y != z: carry += 1 if bits > a and bits > b and bits > c: break if carry ...
FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR VAR VAR NUMBER IF VAR VAR V...
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
from sys import stdin input = stdin.readline MAX = 30 def solve(A, B, C): carry = 0 for bit in range(MAX): a = A >> bit & 1 b = B >> bit & 1 c = C >> bit & 1 if (a, b, c) in [(0, 0, 1), (1, 1, 0)]: carry = 1 - carry if carry == 0: return "YES" else:...
ASSIGN VAR VAR ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR VAR LIST NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP NUMBER VAR IF VAR NUMBER RETURN ST...
You are given non-negative integers A, B and C. Does there exist a non-negative integer X such that A \oplus X+ B \oplus X = C \oplus X? As a reminder, \oplus denotes the [bitwise XOR operation]. ------ Input Format ------ - The first line of input will contain a single integer T, denoting the number of test cases...
def bit_gen(x): l = [(0) for _ in range(27)] for i in range(1, 28): l[-i] = x % 2 x = x // 2 return l t = int(input()) for _ in range(t): a, b, c = map(int, input().split()) carry = 0 a_ = bit_gen(a) b_ = bit_gen(b) c_ = bit_gen(c) for i in range(1, 28): if ...
FUNC_DEF ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC...