description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n = input()[:-1][::-1]
L = len(n)
dp = [[([0] * 2) for _ in range(2)] for _ in range(L + 1)]
dp[0][0][0] = 1
for i in range(L):
a = int(n[i]) + 1
b = 9 - int(n[i])
dp[i + 1][0][0] += a * dp[i][0][0]
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | n = int(input())
for _ in range(n):
s = input()
a = "0"
b = "0"
for g in range(len(s)):
if g % 2 == 0:
a += s[g]
else:
b += s[g]
p = 1 + int(a)
q = 1 + int(b)
print(p * q - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER FUNC_CALL VAR VAR EXPR FUNC_CALL V... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = int(input())
i = 1
a, b = 0, 0
while n:
a += n % 10 * i
n //= 10
b += n % 10 * i
n //= 10
i *= 10
if a == 0 or b == 0:
print(max(a - 1, b - 1))
else:
print((a + 1) * (b + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER WHILE VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR BIN_OP VAR NUMBER... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
n = input()
a, b = "", ""
for i in range(0, len(n), 2):
a += n[i]
for i in range(1, len(n), 2):
b += n[i]
if a:
a = int(a)
if b:
b = int(b)
if not b:
b = 0
if not a:
a = 0
print((a + 1) * (b + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR ASSIGN VAR FUNC_CALL VAR V... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | from sys import stdin
input = stdin.readline
def func(b, k):
if b >= k:
v = 1
flag = 0
t = a.copy()
for x in range(k - 1, -1, -1):
if o[x] == 0:
if t[x] < 0:
v = 0
break
v = v * (t[x] + 1)
... | ASSIGN VAR VAR FUNC_DEF IF VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER IF VAR VAR NUMBER IF VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for _ in range(t):
s = input()[::-1]
odd = even = ""
k = len(s)
for i in range(0, k, 2):
odd += s[i]
if i + 1 < k:
even += s[i + 1]
odd = odd[::-1]
even = even[::-1]
if even == "":
even = "0"
odd = int(odd)
even = int(even)
ans... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR STRING ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR IF BIN_OP VAR NUMBER VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER IF VAR STRING ASSIGN VAR ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def answer():
n = list(input())
s1 = ""
s2 = ""
for i in range(len(n)):
if i % 2 == 0:
s1 += n[i]
else:
s2 += n[i]
if s2 == "":
print(int(n[0]) - 1)
return
ans = 0
x1 = int(s1)
x2 = int(s2)
if x2 == 0:
ans = x1 - 1
e... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR IF VAR STRING EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER RETURN ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CA... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def cal():
s = list(input())
first = int("".join(s[0::2])) + 1
second = int("".join(s[1::2])) + 1 if len(s) > 1 else 1
print(first * second - 2)
def main():
t = int(input())
while t:
cal()
t -= 1
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR FUNC_CALL STRING VAR NUMBER NUMBER NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL ... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = ["0"] + list(input())
evens = int("".join([i for i in n[::2]]))
odds = int("".join([i for i in n[1::2]]))
print((evens + 1) * (odds + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import sys
input = sys.stdin.readline
def solve():
s = "0" + input().strip()
a = int(s[0::2])
b = int(s[1::2])
return (a + 1) * (b + 1) - 2
for _ in range(int(input())):
print(solve()) | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP STRING FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC_CALL VAR FUNC_CALL VAR |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def conv(x):
if x == "":
return 1
return int(x) + 1
def main():
n = input()
l = len(n)
a, b = "", ""
for i in range(0, len(n), 2):
a += n[i]
for i in range(1, len(n), 2):
b += n[i]
print(conv(a) * conv(b) - 2)
t = int(input())
for i in range(t):
main() | FUNC_DEF IF VAR STRING RETURN NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING STRING FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR B... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | import itertools as _itertools
import sys as _sys
def how_many_inputs_give_same_result_for_alice_addition(alice_additon_result):
if not isinstance(alice_additon_result, int):
raise TypeError
alice_additon_result = int(alice_additon_result)
if alice_additon_result < 2:
return 0
result =... | IMPORT IMPORT FUNC_DEF IF FUNC_CALL VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER RETURN NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR STRING VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL STRING VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP NUMBER VAR VAR FO... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
n = input()
o = ""
e = ""
k = 1
for j in range(0, len(n)):
if k & 1:
o = o + n[j]
else:
e = e + n[j]
k += 1
if len(o) > 0:
o = int(o)
else:
o = 0
if len(e) > 0:
e = int(e)
else... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR NUMBER ASSIGN VA... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
s = input()
n1 = s[::2]
n2 = s[1::2]
s1 = 1
if n1 != "":
s1 *= int(n1) + 1
if n2 != "":
s1 *= int(n2) + 1
print(s1 - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER IF VAR STRING VAR BIN_OP FUNC_CALL VAR VAR NUMBER IF VAR STRING VAR BIN_OP FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for _ in range(t):
s = list(map(int, list(input())))
q = [(0, 1, [])]
result = 0
while q:
pos, pairs_count, ones_pos = q.pop(0)
if pairs_count == 0:
continue
add = int(pos in ones_pos)
if pos == len(s):
result += pairs_count
... | 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 VAR FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER LIST ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR VAR VAR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR VAR IF VAR FUNC_CALL VAR VAR VAR VAR A... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def prob():
s = input()
n = len(s)
if n == 1:
print(int(s) - 1)
return
a = ""
b = ""
for i in range(0, n, 2):
a += s[i]
for i in range(1, n, 2):
b += s[i]
x = int(a) + 1
y = int(b) + 1
print(x * y - 2)
t = 1
t = int(input())
for _ in range(0, t):... | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR NUMBER AS... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | numOfTestCases = int(input())
while numOfTestCases > 0:
numOfTestCases -= 1
aliceResult = input()
oddnumber = "0"
evenNumber = "0"
for i, c in enumerate(aliceResult):
if i % 2 == 0:
evenNumber += c
else:
oddnumber += c
oddnumber = int(oddnumber)
evenNu... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VA... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | d1 = {}
d2 = {(9): 0}
for i in range(10):
for j in range(10):
if i + j < 10:
if i + j not in d1:
d1[i + j] = 0
d1[i + j] += 1
else:
i1 = (i + j) % 10
if i1 not in d2:
d2[i1] = 0
d2[i1] += 1
f_dict = {(0): 1}
... | ASSIGN VAR DICT ASSIGN VAR DICT NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_OP VAR VAR NUMBER IF BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR NUMBER IF VAR VAR ASSIGN VAR VAR NUMBER VAR VAR NUMBER ASSIGN VAR DICT NUMBER... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve(n):
a = b = 0
place = 1
while n:
a += n % 10 * place
n //= 10
b += n % 10 * place
n //= 10
place *= 10
return (a + 1) * (b + 1) - 2
for t in range(int(input())):
n = int(input())
print(solve(n)) | FUNC_DEF ASSIGN VAR VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR BIN_OP BIN_OP VAR NUMBER VAR VAR NUMBER VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR EXPR FUNC... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def rec(pos, c, count_before, a_before, b_before):
global count
if pos < -l:
if a_before != 0 and b_before != 0:
count += count_before
return
c1 = c.copy()
c2 = c.copy()
c2[pos - 2] += 1
count1 = 0
count2 = 0
count0 = 0
for a in range(10):
a_now = ... | FUNC_DEF IF VAR VAR IF VAR NUMBER VAR NUMBER VAR VAR RETURN ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR VAR VAR VAR VAR NUMBER... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
k = input()
if len(k) == 1:
print(int(k) - 1)
return
print((int(k[::2]) + 1) * (int(k[1::2]) + 1) - 2)
n = int(input())
for i in range(n):
solve() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER RETURN EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
s = input()
f = 0
a = "0"
b = "0"
for c in s:
if f:
a += c
else:
b += c
f ^= 1
print((int(a) + 1) * (int(b) + 1) - 2)
def main():
tc = int(input())
for _ in range(tc):
solve()
main() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR VAR IF VAR VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUN... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
n = input()
if len(n) == 1:
print(int(n) - 1)
else:
n1 = ""
n2 = ""
for i in range(len(n)):
if i % 2 == 0:
n1 += n[i]
else:
n2 += n[i]
ans = (int(n1) + 1) * (int(n2) + 1) - 2
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP FUNC_CALL VAR VAR NUMBER ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP FUNC_C... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for _ in range(t):
sn = input()
s1 = sn[::2]
s2 = sn[1::2]
c1 = 0
for c in s1:
c1 = c1 * 10 + ord(c) - ord("0")
c2 = 0
for c in s2:
c2 = c2 * 10 + ord(c) - ord("0")
print((c1 + 1) * (c2 + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP BIN_OP BIN_OP VAR N... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | for _ in range(int(input())):
s = input()
a = 0
try:
a = int(s[1::2])
except:
a = 0
print((int(s[::2]) + 1) * (a + 1) - 2) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER BIN_OP VAR NUMBER NUMBER |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | t = int(input())
for i in range(t):
s = input()
n = len(s)
s1 = ""
s2 = ""
for i in range(0, n, 2):
s1 += s[i]
for i in range(1, n, 2):
s2 += s[i]
k1 = int(s1)
k2 = 0 if s2 == "" else int(s2)
print((k1 + 1) * (k2 + 1) - 2) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR NUMBER VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR STRING NUMBER FUN... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | from sys import stdin, stdout
nmbr = lambda: int(input())
lst = lambda: list(map(int, input().split()))
for _ in range(nmbr()):
s = input()
n = len(s)
even = 0
odd = 0
for i in range(n):
if i & 1 == 0:
even = even * 10 + int(s[i])
else:
odd = odd * 10 + int(s... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBE... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def solve():
nn = input()
n1 = "0"
n2 = "0"
for i in range(len(nn)):
if i % 2 == 0:
n1 += nn[i]
else:
n2 += nn[i]
n1 = int(n1)
n2 = int(n2)
print((n1 + 1) * (n2 + 1) - 2)
t = int(input())
for _ in range(t):
solve() | FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR STRING ASSIGN VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER VAR VAR VAR VAR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP VAR NUMBER BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR... |
Alice has just learned addition. However, she hasn't learned the concept of "carrying" fully β instead of carrying to the next column, she carries to the column two columns to the left.
For example, the regular way to evaluate the sum $2039 + 2976$ would be as shown:
However, Alice evaluates it as shown:
In particul... | def main(n):
vals = [0, 0]
idx = 0
l = 0
while n:
d = n % 10
vals[idx] += d * pow(10, l)
n //= 10
idx ^= 1
if idx == 0:
l += 1
if vals[0] == 0 or vals[1] == 0:
return max(vals) - 1
else:
return (vals[0] + 1) * (vals[1] + 1) - 2
... | FUNC_DEF ASSIGN VAR LIST NUMBER NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR ASSIGN VAR BIN_OP VAR NUMBER VAR VAR BIN_OP VAR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VAR NUMBER IF VAR NUMBER NUMBER VAR NUMBER NUMBER RETURN BIN_OP FUNC_CALL VAR VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR NUMBE... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = [int(i) for i in input().split()]
ans = 0
curr = 0
for i in a:
curr += i
ans |= i | curr
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | from sys import stdin
input = stdin.readline
MAX = 60
for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
for i in range(n):
done = set()
for j in range(MAX):
asd = 1 << j
if asd >= a[i]:
break
x = a[i] % asd... | ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR IF VAR VAR VAR ASSIGN VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for i in range(int(input())):
o = 0
s = 0
input()
l = map(int, input().split())
for j in l:
s += j
o = o | s | j
print(o) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER EXPR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | l1 = int(input())
for _ in range(l1):
n = int(input())
s = list(map(int, input().split()))
count = 0
a = []
for i in s:
a.append(count + i)
count += i
f = a[0]
for i in range(n):
f = f | a[i]
f = f | s[i]
print(f) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR VAR VAR ASSIGN VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BI... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
for _ in range(t):
bits = [0] * 50
n = int(input())
l = list(map(int, input().split()))
for i in range(n):
j = l[i]
index = 0
while j > 0:
val = j % 2
bits[index] += val
index += 1
j //= 2
ans = 0
cur = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
for _ in range(t):
n = int(input())
l = list(map(int, input().split()))
s = sum(l)
l.sort()
m = [s - l[0]]
for i in range(1, n):
m.append(m[-1] - l[i])
for i in range(n):
s = s | m[i]
for i in range(n):
s = s | l[i]
print(s) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR ASSIGN VAR LIST BIN_OP VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR EXPR FUNC_CALL VAR BIN_OP VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
s = sum(a)
ans = s
prefsum = 0
for i in range(n):
prefsum += a[i]
ans = ans | prefsum
ans = ans | a[i]
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
N = int(input())
temp = 0
sum = 0
arr = map(int, input().split())
for x in arr:
sum += x
temp = temp | x | sum
print(temp) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().strip().split()))
ans = 0
bits = 0
for i in range(30):
for j in range(n):
if a[j] >> i & 1:
bits += 1
if bits > 0:
ans |= 1 << i
bits >>= 1
i = 30
while bi... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR VAR NUMBER VAR NUMBER IF VAR NUMBER VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
while t != 0:
n = int(input())
arr = list(map(int, input().split()))
ans = 0
sm = 0
while n > 0:
ans = ans | arr[n - 1]
sm = sm + arr[n - 1]
ans = ans | sm
n -= 1
print(ans)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | def answer():
bits = [0] * 61
ans = 0
for i in range(60):
for v in a:
if v >> i & 1:
bits[i] += 1
bits[i + 1] += bits[i] // 2
if bits[i]:
ans |= 1 << i
return ans
for T in range(int(input())):
n = int(input())
a = list(map(int, in... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR IF BIN_OP BIN_OP VAR VAR NUMBER VAR VAR NUMBER VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER IF VAR VAR VAR BIN_OP NUMBER VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | def hello_bhai():
for i in range(n):
parameter = bin(hi[i])[2:]
le = len(parameter)
for j in range(le):
good_night[j] += int(parameter[-j - 1])
def kaisa_hai():
for i in range(100000):
if good_night[i] > 1:
byee(i)
def byee(i):
good_night[i + 1] +=... | FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER IF VAR VAR NUMBER EXPR FUNC_CALL VAR VAR FUNC_DEF VAR BIN_OP VAR NUMBER BIN_OP VAR VAR NUMBER ASSIGN VAR VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
b = [(0) for x in range(30)]
for i in range(n):
x = a[i]
j = 0
while x > 0:
b[j] = b[j] + x % 2
x = x // 2
j += 1
k = 0
rep = 1
ans = 0
for i in ... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER ASSIGN VAR VAR BIN_OP VAR VAR BIN_OP VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
for i in range(t):
n = int(input())
a = list(map(int, input().split()))
sum = 0
r = 0
for j in range(n):
r |= a[j]
sum += a[j]
r |= sum
print(r) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
finalOr = 0
numOfBits = 0
carryOverBits = 0
for i in range(50):
for j in l:
temp = j
temp = temp >> i
numOfBits += temp & 1
if numOfBits + carryOverBits >= 1:
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER FOR VAR VAR ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER IF BIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | import sys
def main():
test_cases = int(sys.stdin.readline())
for _ in range(test_cases):
N = int(sys.stdin.readline())
A = [int(i) for i in sys.stdin.readline().split()]
max_bit = 50
bits_set = [(0) for _ in range(max_bit)]
for a in A:
for b in range(max_bi... | IMPORT FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP NUMBER VAR IF BIN_OP VAR VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().strip().split()))
m = max(a).bit_length()
i = ans = bits = 0
while i < m or bits > 0:
for j in range(n):
if a[j] >> i & 1:
bits += 1
if bits > 0:
ans |= 1 << i
bit... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER WHILE VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR VAR NUMBER VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
for _ in range(t):
n = int(input())
a = list(map(int, input().split()))
s = 0
l = a.copy()
for i in range(n):
s = s + a[i]
l.append(s)
k = l[0]
for i in range(1, len(l)):
k = k | l[i]
print(k) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER FOR V... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for i in range(int(input())):
n = int(input())
a = [int(x) for x in input().split()]
sm = 0
smm = []
for j in a:
sm += j
smm.append(sm)
ans = 0
for k in smm:
ans = ans | k
for k in a:
ans = ans | k
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXP... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
def abc(l, n, i, x):
if i == n:
return x
return abc(l, n, i + 1, x) | abc(l, n, i + 1, x + l[i])
for _ in range(t):
n = int(input())
l = list(map(int, input().split()))
ans = 0
l.sort()
c = 0
for i in l:
c += i
ans = ans | i
ans = ans ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF IF VAR VAR RETURN VAR RETURN BIN_OP FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER BIN_OP VAR VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR A... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
while t > 0:
t -= 1
n = int(input())
l1 = [int(i) for i in input().split(" ")]
l2 = []
k = 0
for i in l1:
k += i
l2.append(k)
ans = 0
for i in range(n):
ans = ans | l2[i]
ans = ans | l1[i]
print(ans) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
arr = [int(c) for c in input().split()]
dp = [(0) for i in range(50)]
for i in range(50):
count = 0
for j in arr:
if j & 1 << i:
count += 1
dp[i] = count + dp[i - 1] // 2
ans = 0
s = sum(arr)
f... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF BIN_OP VAR BIN_OP NUMBER VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR BIN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
for i in range(t):
n = int(input())
a = [int(x) for x in input().split()]
sum = 0
s = 0
b = []
for i in range(len(a)):
sum += a[i]
b.append(sum)
for i in range(len(b)):
s = s | b[i] | a[i]
print(s) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
r = 0
t = 0
for i in range(n):
r = r | a[i]
t += a[i]
r = r | t
print(t | r) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for i in range(int(input())):
n = int(input())
a = list(map(int, input().split()))
g = [0] * 75
b = 1
for j in range(n):
b = 1
c = 0
while a[j] > 0:
g[c] = g[c] + a[j] % 2 * b
a[j] = a[j] // 2
c = c + 1
b = b * 2
b = 1
s... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER WHILE VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | def log(a):
c = 0
while a > 0:
a >>= 1
c += 1
return c
def sso(arr, n, brr, l):
for i in range(l):
count = 0
for j in range(n):
if arr[j] >> i & 1 == 1:
count += 1
if i == 0:
brr[0] = count
else:
brr[i]... | FUNC_DEF ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER RETURN VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP BIN_OP VAR VAR VAR NUMBER NUMBER VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR BIN_OP VAR NUMBER NUMBER ASSIGN VAR N... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
num = [0] * 100000
for i in l:
x = bin(i)[2:]
for j in range(len(x)):
num[j] += int(x[-j - 1])
for i in range(100000):
if num[i] > 1:
num[i + 1] += num[i] // 2
... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER NUMBER FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR FUNC_CALL VAR VAR BIN_OP VAR NU... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | I = lambda: list(map(int, input().split()))
(t,) = I()
for _ in range(t):
(n,) = I()
l = I()
an = 0
x = 1
pr = 0
for i in range(57):
ct = 0
for j in range(n):
if x & l[j]:
ct += 1
if ct:
an += x
elif pr >= x:
an ... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR VAR... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for tc in range(int(input())):
n = int(input())
li = list(map(int, input().strip().split()))
a = [0] * n
a[0] = li[0]
for i in range(1, n):
a[i] = a[i - 1] + li[i]
c = 0
for i in range(n):
c = c | a[i]
c = c | li[i]
print(c) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR BIN_OP VAR NUMBER VAR VAR ASSIGN... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
l = list(map(int, input().split()))
p = [l[0]]
for i in l[1:]:
p.append(p[-1] + i)
x = 0
for i in p:
x |= i
for i in l:
x |= i
print(x) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR NUMBER FOR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR NUMBER VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR FOR VAR VAR VAR VAR EXPR FUNC_CALL VAR ... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
s = 0
l = list(map(int, input().split()))
ans = l[0]
for i in l:
ans |= i
s += i
ans |= s
print(ans) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER FOR VAR VAR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
a = list(map(int, input().strip().split()))
s = sum(a)
m = 0
while s > 0:
s >>= 1
m += 1
ans = 0
bits = 0
for i in range(m):
for j in range(n):
if a[j] >> i & 1:
bits += 1
if bits >... | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER WHILE VAR NUMBER VAR NUMBER VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | for _ in range(int(input())):
n = int(input())
A = list(map(int, input().split()))
B = A.copy()
for i in range(1, n):
A[i] = A[i] + A[i - 1]
bitsum = 0
for i in A:
bitsum = bitsum | i
for x in B:
bitsum = bitsum | x
print(bitsum) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VA... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | from sys import setrecursionlimit as srl
from sys import stdin as stin
from sys import stdout as stout
def get_ints():
return map(int, stin.readline().split())
def get_list():
return list(map(int, stin.readline().split()))
def get_int():
return int(stin.readline())
def get_str():
return stin.rea... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR N... |
Read problem statements in [Hindi], [Bengali], [Mandarin Chinese], [Russian], and [Vietnamese] as well.
Chef once had a deep epiphany and ended up saying: Given a sequence of positive integers $a_{1}, a_{2}, \ldots, a_{N}$, if you take each of its $2^{N}$ subsequences and write down the sum of elements of this subsequ... | t = int(input())
while t > 0:
n = int(input())
a = list(map(int, input().split()))
s = []
ans = 0
s = 0
for x in a:
s = s + x
ans |= x
ans |= s
print(ans)
t -= 1 | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR NUMBER |
Girl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess β all the objects from her handbag were thrown about the room. Of course, she wanted to put them back into her handbag. The problem is that the girl canno... | xs, ys = map(float, input().split())
n = int(input())
dist = [([0] * (n + 1)) for i in range(n + 1)]
dist2 = [([0] * n) for i in range(n)]
objects = [list(map(float, input().split())) for i in range(n)] + [[xs, ys]]
for i in range(n + 1):
for j in range(n + 1):
dist[i][j] = (objects[i][0] - objects[j][0]) *... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_C... |
Girl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess β all the objects from her handbag were thrown about the room. Of course, she wanted to put them back into her handbag. The problem is that the girl canno... | x0, y0 = map(int, input().split())
n = int(input())
arr = [[x0, y0]]
for i in range(0, n):
x, y = map(int, input().split())
arr.append([x, y])
dist = [[(0) for j in range(0, n + 1)] for i in range(0, n + 1)]
for i in range(0, n + 1):
for j in range(0, n + 1):
dist[i][j] = (arr[i][0] - arr[j][0]) ** ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST LIST VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR LIST VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR FUNC_CAL... |
Girl Lena likes it when everything is in order, and looks for order everywhere. Once she was getting ready for the University and noticed that the room was in a mess β all the objects from her handbag were thrown about the room. Of course, she wanted to put them back into her handbag. The problem is that the girl canno... | import sys
def main():
BITS = [(1 << sh) for sh in range(24)]
B2N = {v: u for u, v in enumerate(BITS)}
def getPt():
return tuple(map(int, input().split()))
def dist(ptA, ptB):
return sum((u - v) ** 2 for u, v in zip(ptA, ptB))
def getBits(val):
return tuple(filter(lambda... | IMPORT FUNC_DEF ASSIGN VAR BIN_OP NUMBER VAR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP BIN_OP VAR VAR NUMBER VAR VAR FUNC_CALL VAR VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 10**9 + 7
def power(a, b):
if b == 0:
return 1
ax = power(a, int(b / 2))
ax = ax * ax % mod
if b % 2 == 1:
ax = ax * a % mod
return ax
p = int(input())
for _ in range(p):
n = input().split(" ")
n, k = int(n[0]), int(n[1])
m = 0
for i in range(k):
x =... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VA... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 1000000007
for _ in range(int(input())):
n, m = list(map(int, input().split()))
y = 0
for i in range(m):
l, r, x = list(map(int, input().split()))
y |= x
t = 0
for i in range(32):
if y & 1 << i:
t += (1 << i) * pow(2, n - 1, mod)
print(t % mod) | ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER IF BIN_... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | def power_of_two(base, n):
mod = 1000000007
if n == 1:
return 2
if n == 0:
return 1
if n % 2 == 0:
val = power_of_two(base, n / 2)
return val % mod * (val % mod) % mod
else:
val = 2 * (power_of_two(base, n - 1) % mod) % mod
return val % mod
t = int(i... | FUNC_DEF ASSIGN VAR NUMBER IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER IF BIN_OP VAR NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR VAR BIN_OP VAR NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR VAR BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP FUNC_CALL VAR VAR BIN_OP VAR NUMBER VAR VAR RETURN BIN_OP VAR VAR AS... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | import sys
input = sys.stdin.readline
mod = 10**9 + 7
for _ in " " * int(input()):
n, m = map(int, input().split())
res = 0
for _ in " " * m:
l, r, x = map(int, input().split())
res |= x
print(res * pow(2, n - 1, mod) % mod) | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR BIN_OP STRING FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR BIN_OP STRING VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
rajawat = 10**9 + 7
for test in range(t):
n, m = map(int, input().split())
temp = 0
for k in range(m):
lks = list(map(int, input().split()))
temp |= lks[-1]
print(temp * 2 ** (n - 1) % rajawat) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR BIN_OP ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | p = int(input())
for _ in range(p):
n = input().split(" ")
n, k = int(n[0]), int(n[1])
m = 0
mod = 10**9 + 7
for i in range(k):
x = input().split()
m = m | int(x[2])
n = n - 1
ans = 1
res = 2
while n > 0:
if n & 1:
ans = ans * res % mod
res... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR VAR FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR F... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | MOD, T = 10**9 + 7, int(input())
for CASE in range(T):
n, m = map(int, input().split())
a = 0
for i in range(m):
l, r, x = map(int, input().split())
a = a | x
print(a * pow(2, n - 1, MOD) % MOD) | ASSIGN VAR VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BI... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | M = 10**9 + 7
def xorSum(arr, n):
bits = 0
for i in range(len(arr)):
bits |= arr[i]
ans = bits * pow(2, n - 1)
ans %= M
return ans
for _ in range(int(input())):
n, m = map(int, input().split())
arr = []
for i in range(m):
l, r, val = map(int, input().split())
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN V... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
n, m = map(int, input().split(" "))
here = 0
mod = int(1000000000.0 + 7)
for y in range(m):
l, r, x = map(int, input().split(" "))
here |= x
print(pow(2, n - 1, mod) * here % mod) | 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 FUNC_CALL VAR BIN_OP NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP FUNC_CA... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
for i in range(t):
n, m = map(int, input().split())
X = 0
for j in range(m):
l, r, x = map(int, input().split())
X |= x
ans = X * 2 ** (n - 1)
print(ans % (10**9 + 7)) | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER EXPR FUNC_CALL VAR BIN_OP VAR B... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | def power(x, MOD):
ans = 1
for i in range(x):
ans = ans * 2 % MOD
return ans
t = int(input())
for _ in range(t):
n, k = [int(x) for x in input().split()]
ans = 0
MOD = pow(10, 9) + 7
totalOr = 0
for j in range(k):
a, b, c = [int(x) for x in input().split()]
tota... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR NUMBER VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR NUMBER F... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | I = lambda: [*map(int, input().split())]
M = 10**9 + 7
for _ in [0] * I()[0]:
n, m = I()
o = 0
for i in range(m):
o |= I()[2]
print(o * 2 ** (n - 1) % M) | ASSIGN VAR LIST FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR BIN_OP LIST NUMBER FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR NUMBER V... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for iiii in range(int(input())):
n, m = map(int, input().split())
x = 0
for i in range(m):
a, b, c = map(int, input().split())
x = x | c
per = 1000000000 + 7
cou = x % per
for i in range(n - 1):
cou = cou % per * 2 % per
print(cou) | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR ASSIGN VAR BIN_OP NUMBER NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FUNC_CALL VAR BI... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
while t > 0:
n, m = [int(x) for x in input().split()]
ans = 0
for i in range(m):
ip = [int(x) for x in input().split()]
l = ip[0]
r = ip[1]
x = ip[2]
ans = ans | x
for i in range(n - 1):
ans = ans % 1000000007 * 2 % 1000000007
print(an... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR FOR VAR FU... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
while t:
t -= 1
b = list(map(int, input().split()))
x = 0
for i in range(b[1]):
a = list(map(int, input().split()))
x = x | a[2]
x = x % 1000000007
y = 1
for i in range(b[0] - 1):
y = y * 2 % 1000000007
print(x * y % 1000000007) | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP VAR NUMBER ASSIGN VAR NU... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
n, m = map(int, input().split())
x = 0
for j in range(m):
l, r, o = map(int, input().split())
x |= o
mod = 1000000007
c = pow(2, n - 1, mod) % mod
c = c % mod * x % mod % mod
print(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 NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR ASSIGN VAR BIN_OP... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | import sys
input = sys.stdin.readline
def solve(n, m, Q):
mo = 10**9 + 7
curr = 0
for l, r, x in Q:
curr |= x
print(curr * pow(2, n - 1, mo) % mo)
for _ in range(int(input())):
n, m = map(int, input().split())
Q = [tuple(map(int, input().split())) for _ in range(m)]
solve(n, m, ... | IMPORT ASSIGN VAR VAR FUNC_DEF ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER 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... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | def hehe(n):
res = 1
for i in range(n - 1):
res = res * 2 % 1000000007
return res
for _ in range(int(input())):
n, m = map(int, input().split())
l = []
ans = 0
for i in range(m):
temp = list(map(int, input().split()))
l.append(temp)
for i in range(m):
an... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR NUMBER NUMBER RETURN VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CA... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 1000000007
def f():
n, m = map(int, input().split())
s = 0
for i in range(m):
l, r, x = map(int, input().split())
s |= x
return int(s * pow(2, n - 1, mod)) % mod
for _ in range(int(input())):
print(f()) | ASSIGN VAR NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR RETURN BIN_OP FUNC_CALL VAR BIN_OP VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR F... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
n, m = map(int, input().split())
bits = 0
mod = 10**9 + 7
a, b, c = map(int, input().split())
ans = c
for i in range(m - 1):
d, e, f = map(int, input().split())
ans |= f
print(ans % mod * (pow(2, n - 1) % mod) % mod) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
y, [n, m] = 0, map(int, input().split())
for i in range(m):
y |= [int(x) for x in input().split()][2]
print(2 ** (n - 1) * y % (10**9 + 7)) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR LIST VAR VAR NUMBER FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
n, m = map(int, input().split())
xor = 0
for i in range(m):
A = list(map(int, input().split()))
xor = xor | A[2]
ans = 2 ** (n - 1) * xor
print(ans % 1000000007) | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP VAR NUMBER VAR EXPR FUNC_CALL ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
mod = 1000000007
def power(n):
if n == 1:
return 2
if n == 0:
return 1
ans = power(n // 2)
if n % 2 != 0:
return ans * (ans * 2) % mod % mod
else:
return ans * ans % mod
while t > 0:
n, m = list(map(int, input().split()))
total_or = 0
... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP BIN_OP BIN_OP VAR BIN_OP VAR NUMBER VAR VAR RETURN BIN_OP BIN_OP VAR VAR VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 1000000007
def inp():
return list(map(int, input().split()))
_t = int(input())
for _ in range(_t):
n, m = inp()
bit = 0
for i in range(m):
l, r, x = inp()
bit |= x
ans = bit * pow(2, n - 1, mod=mod)
print(ans % mod) | ASSIGN VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR BIN_OP VAR FUNC_CALL VAR NUMBER BIN_OP V... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | import sys
input = sys.stdin.readline
def inp():
return int(input())
def st():
return input().rstrip("\n")
def lis():
return list(map(int, input().split()))
def ma():
return map(int, input().split())
t = inp()
while t:
t -= 1
n, m = ma()
p = 10**9 + 7
x = 0
for i in range(... | IMPORT ASSIGN VAR VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL FUNC_CALL VAR STRING FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR AS... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 10**9 + 7
for i in range(int(input())):
n, m = list(map(int, input().split()))
fullOr = 0
for i in range(m):
_, _, x = list(map(int, input().split()))
fullOr |= x
print(fullOr * 2 ** (n - 1) % mod) | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for _ in range(int(input())):
n, m = map(int, input().split())
oor = -1
for i in range(m):
l, r, x = map(int, input().split())
if i == 0:
oor = x
else:
oor = oor | x
print(2 ** (n - 1) * oor % (10**9 + 7)) | 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 FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP BIN_OP NUMBER BIN_OP... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | t = int(input())
for i in range(t):
n, m = map(int, input().split(" "))
l = [(0) for theta in range(m)]
r = [(0) for delta in range(m)]
all_and = 0
for j in range(m):
l[j], r[j], x = map(int, input().split(" "))
all_and = all_and | x
p = 10**9 + 7
all_and = all_and % p
te... | 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 NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VA... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | mod = 10**9 + 7
def mpow(a, b):
ans = 1
while b:
if b & 1:
ans = ans * a % mod
a = a * a % mod
b >>= 1
return ans
for _ in range(int(input())):
n, m = map(int, input().split())
a = []
for i in range(m):
a.append([int(x) for x in input().split()])
... | ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER FUNC_DEF ASSIGN VAR NUMBER WHILE VAR IF BIN_OP VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR ASSIGN VAR BIN_OP BIN_OP VAR VAR VAR VAR NUMBER RETURN VAR 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 LI... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | for t in range(int(input())):
n, m = list(map(int, input().split()))
l, r, xx = list(map(int, input().split()))
for i in range(m - 1):
l, r, x = list(map(int, input().split()))
xx = xx | x
print(2 ** (n - 1) * xx % 1000000007) | FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VA... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | def input_int():
return int(input())
def input_multiple():
return map(int, input().split())
t = input_int()
while t > 0:
n, m = input_multiple()
or_value = 0
for i in range(m):
l, r, x = input_multiple()
or_value |= x
print(or_value * 2 ** (n - 1) % 1000000007)
t -= 1 | FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR WHILE VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR FUNC_CALL VAR VAR VAR EXPR FUNC_CALL VAR BIN_OP BIN_OP VAR BIN_OP NUMBER BIN_OP VAR ... |
Once Divan analyzed a sequence $a_1, a_2, \ldots, a_n$ consisting of $n$ non-negative integers as follows. He considered each non-empty subsequence of the sequence $a$, computed the bitwise XOR of its elements and added up all the XORs, obtaining the coziness of the sequence $a$.
A sequence $c$ is a subsequence of a s... | import sys
input = sys.stdin.readline
for _ in range(int(input())):
n, m = list(map(int, input().split()))
xor = 0
mod = 1000000007
def fun(n):
if n == 0:
return 1
if n == 1:
return 2
t = fun(n // 2)
if n % 2 == 0:
return t * t % mod
... | IMPORT ASSIGN VAR VAR FOR VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FUNC_DEF IF VAR NUMBER RETURN NUMBER IF VAR NUMBER RETURN NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF BIN_OP VAR NUMBER NUMBER RETUR... |
Moamen and Ezzat are playing a game. They create an array $a$ of $n$ non-negative integers where every element is less than $2^k$.
Moamen wins if $a_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots \,\&\, a_n \ge a_1 \oplus a_2 \oplus a_3 \oplus \ldots \oplus a_n$.
Here $\&$ denotes the bitwise AND operation , and $\oplus$ deno... | import sys
input = sys.stdin.readline
MAX = 2 * 10**5 + 100
MOD = 10**9 + 7
fact = [0] * MAX
inv = [0] * MAX
finv = [0] * MAX
fact[0] = 1
fact[1] = 1
finv[0] = 1
finv[1] = 1
inv[1] = 1
for i in range(2, MAX):
fact[i] = fact[i - 1] * i % MOD
inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD
finv[i] = finv[i - ... | IMPORT ASSIGN VAR VAR ASSIGN VAR BIN_OP BIN_OP NUMBER BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMBER NUMBER ASSIGN VAR NUMB... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.