description stringlengths 171 4k | code stringlengths 94 3.98k | normalized_code stringlengths 57 4.99k |
|---|---|---|
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
l = []
for i in range(n):
x = list(map(int, input().split()))
l.append(x)
xor = 0
a = []
for i in range(n):
xor ^= l[i][0]
a.append(1)
if xor == 0:
for i in range(n):
x = l[i][0]
flag = 0
for j in range(m):
if l[i][j] != x:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER FOR VAR FUNC... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def main():
n, m = map(int, input().split())
a = [([0] * m) for i in range(n + 5)]
choose = [0] * 1000
choice = [[0, 0] for i in range(n)]
choiceind = []
nochoice = 0
for i in range(0, n):
a[i] = list(map(int, input().split()))
u = sorted(a[i])
if u[m - 1] == u[0]:
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER NUMBER ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR VAR FUNC_CALL VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = [[int(i) for i in input().split()] for _ in range(n)]
t = a[0][0]
for i in range(1, n):
t ^= a[i][0]
if t != 0:
print("TAK")
print(" ".join("1" for i in range(n)))
else:
for i in range(n):
for j in range(1, m):
if a[i][j] != a[i][0]:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING STRING VAR FUNC_CALL VAR VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def can(b, n):
flag = [([False] * 2) for _ in range(n + 1)]
flag[n][0] = True
for i in range(n - 1, -1, -1):
flag[i][0] = (
flag[i + 1][0] and b[i][0] != -1 or flag[i + 1][1] and b[i][1] != -1
)
flag[i][1] = (
flag[i + 1][0] and b[i][1] != -1 or flag[i + 1][1]... | FUNC_DEF ASSIGN VAR BIN_OP LIST NUMBER NUMBER VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER NUMBER VAR BIN_OP VAR NUMBER NUMBER VAR VAR NUMBER NUMBER ASSIGN VAR VAR NUMBER VAR BIN_O... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
bitbool = [[[(-1) for k in range(2)] for j in range(10)] for i in range(n)]
for i in range(n):
row = list(map(int, input().split()))
for j in range(m):
num = row[j]
bits = [(False) for k in range(10)]
for exp in range(9, -1, -1):
k = pow(2, ex... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR 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 VAR FUNC_CALL VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
def input():
return sys.stdin.readline()[:-1]
def getInt():
return int(input())
def getIntIter():
return map(int, input().split())
def getIntList():
return list(getIntIter())
def flush():
sys.stdout.flush()
n, m = getIntIter()
key = -1
curr = 0
for x in range(n):
row = get... | IMPORT FUNC_DEF RETURN FUNC_CALL VAR NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF EXPR FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | params = list(map(int, list(input().split())))
m = []
for _ in range(params[0]):
m.append(list(map(int, list(input().split()))))
path = []
for row in m:
s = set(row)
path.append([row[0], len(s), 1])
def get_pos(path, r):
for col in range(1, len(m[r])):
if m[r][col] != m[r][0]:
retu... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR VAR ASSIGN VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR LIST VAR NUMBER FUNC_CALL... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = tuple(map(int, input().strip().split()))
mat = []
for i in range(n):
mmm = list(map(int, input().strip().split()))
mat.append(mmm)
st = 0
rnum = -1
cnum = -1
for i in range(n):
for ii in range(m - 1):
if mat[i][ii] != mat[i][ii + 1]:
st = 1
rnum = i
cnum = ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(x) for x in input().split()]
arr = []
for i in range(n):
arr.append([int(x) for x in input().split()])
val = 0
pos = [1] * n
for i in range(n):
val ^= arr[i][0]
if val > 0:
print("TAK")
print(*pos)
else:
flag = 0
for i in range(n):
cur = arr[i][0]
newval = val ^ cur
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr = [None] * n
cx = 0
for i in range(n):
arr[i] = [int(o) for o in input().split()]
cx ^= arr[i][0]
ans = [1] * n
if cx != 0:
print("TAK")
print(*ans)
else:
flag = 0
for i in range(n):
for j in range(1, m):
if arr[i][j] != arr[i][0]:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR ASSIGN VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | l = input().split()
n = int(l[0])
m = int(l[1])
lfi = []
for i in range(n):
l = input().split()
li = [int(i) for i in l]
lfi.append(li)
xori = 0
for i in range(n):
xori = xori ^ lfi[i][0]
if xori != 0:
print("TAK")
for i in range(n):
print(1, end=" ")
print()
quit()
done = 0
arr ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL 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 NU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
matrix = []
for i in range(n):
line = input().split()
line = [int(x) for x in line]
matrix.append(line)
total = 0
res = []
for line in matrix:
total ^= line[0]
res.append(1)
if total == 0:
i = 0
achei = False
while i < n and achei == False:
for j ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
for i in range(10):
zero_flag = [False] * n
one_flag = [False] * n
for j in range(n):
for k in range(m):
if a[j][k] >> i & 1:
one_flag[j] = True... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR IF ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
lis = [[int(j) for j in input().split()] for i in range(n)]
x = 0
y = 0
lis1 = []
for i in range(n):
x = x ^ lis[i][0]
if x != 0:
print("TAK")
for i in range(n):
print(1, end=" ")
else:
for i in range(n):
for j in range(1, m):
if lis[i][j] != ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXP... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
res = [1] * n
isPossible = False
for i in range(n):
cur = 0
res = [1] * n
for j in range(n):
if i != j:
cur = cur ^ a[j][0]
for j in range(m):
if cur ^ a[i][j] > 0:
res[i] = j... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF VAR VAR ASSIGN ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
num = []
key = []
non_one = []
ans_idx = [0] * n
for i in range(n):
l = map(int, input().split())
dt = dict()
for j, it in enumerate(l):
dt[it] = j
num.append(dt)
ky = sorted(dt.keys())
if len(ky) != 1:
non_one.append(i)
key.append(sorted(dt.k... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIG... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
grid = []
for i in range(n):
grid.append(list(map(int, input().split())))
xor = 0
for i in range(n):
xor ^= grid[i][0]
def find(grid):
for i in range(n):
for j in range(1, m):
if grid[i][j] != grid[i][0]:
return i, j
return -1, -1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = tuple(map(int, input().rstrip().split()))
a = []
for _ in range(n):
a.append(list(map(int, input().rstrip().split())))
c = [(1) for _ in range(n)]
def bxr():
s = 0
for i in range(n):
s ^= a[i][c[i] - 1]
if s > 0:
print("TAK")
print(" ".join(map(str, c)))
else:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR BIN_OP ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(i) for i in input().split()]
a = 0
b = -1
l1 = []
l2 = []
for i in range(n):
s = [int(i) for i in input().split()]
if b != -1:
l1.append(1)
a ^= s[0]
b ^= s[0]
l2.append(1)
else:
f = set(s)
if len(f) == 1:
l1.append(1)
l2.ap... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR VAR NUMBER VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER ASSIGN VAR F... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
matrix = []
u = {k: {} for k in range(n)}
for i in range(n):
a = list(map(int, input().split(" ")))
for tro in range(m):
u[i][a[tro]] = tro
matrix.append(a)
dp = [[] for i in range(1024)]
avail = {}
for k in range(len(matrix[0])):
dp[matrix[0][k]] = [matrix[0][k]... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR VAR DICT VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR FUNC_CALL... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
s = list(map(int, input().split()))
mapper = []
for i in range(s[0]):
l = list(map(int, input().split()))
mapper.append(l)
xor = 0
for i in range(s[0]):
xor = mapper[i][0] ^ xor
if xor != 0:
print("TAK")
ans = ""
for i in range(s[0]):
ans += str(1)
ans += " "
prin... | IMPORT ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER VAR IF VAR NUMBER EXPR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
x = 0
c = [1] * (n - 1)
for i in range(n - 1):
x = x ^ a[i][0]
f = 0
for j in range(m):
if a[n - 1][j] != x:
c.append(j + 1)
f = 1
break
if f == 1:
print("TAK")
print(*c)
else... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER ASS... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
dont = 0
flagdont = True
arr = []
for i in range(n):
arr.append(list(map(int, input().split())))
for j in range(1, m):
if arr[i][j] != arr[i][0]:
flagdont = False
dont = 0
adadTaghir = i
break
else:
if flagdont ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | line = list(map(int, input().split()))
n = line[0]
m = line[1]
a = [None] * n
sXor = 0
for i in range(n):
a[i] = list(map(int, input().split()))
sXor ^= a[i][0]
sol = [1] * n
if sXor != 0:
print("TAK")
for i in range(n):
print(str(sol[i]), end=" ")
else:
solved = False
for i in range(n):... | ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
for b in range(10):
RB = [0] * n
for j in range(n):
SCORE = []
for k in range(m):
if A[j][k] & 1 << b == 0:
SCORE.append(0)
else... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR IF BIN_OP VAR VAR VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
mat = []
for i in range(n):
row = list(map(int, input().split()))
mat.append(row)
idx = [(0) for i in range(n)]
ans = 0
tot_cnt = 0
for i in range(n):
ans ^= mat[i][idx[i]]
while ans == 0:
j = n - 1
while j >= 0:
if idx[j] < m - 1:
idx[j] += 1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR WHILE VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def myXOR(x, y):
res = 0
for i in range(31, -1, -1):
b1 = x & 1 << i
b2 = y & 1 << i
b1 = min(b1, 1)
b2 = min(b2, 1)
xoredBit = 0
if b1 & b2:
xoredBit = 0
else:
xoredBit = b1 | b2
res <<= 1
res |= xoredBit
return... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER NUMBER NUMBER ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR BIN_OP VAR BIN_OP NUMBER VAR ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER IF BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP VAR VAR VAR NUMBER VAR VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, l = input().split()
n = int(n)
l = int(l)
matriz = [0] * n
resposta = 0
for i in range(0, n):
linha = input().split()
matriz[i] = linha
resposta = int(matriz[i][0]) ^ resposta
if resposta > 0:
print("TAK", end="\n")
for i in range(0, n):
print("1 ")
else:
linha = -1
coluna = -1
... | ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR ASSIGN VAR BIN_OP FUNC_CALL VAR VAR VAR NUMBER VAR IF VAR NUMBER EXPR FUNC_CALL VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
idx = -1
for _ in range(n):
z = list(map(int, input().split()))
s = set(z)
if len(set(s)) > 1:
idx = _
p = sorted(set(s))
jdx, kdx = z.index(p[0]), z.index(p[-1])
a.append(z)
res = 0
if idx == -1:
for i in range(n):
res ^= a[i][... | 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def solve():
N, M = map(int, input().split())
matrix = []
ans = 0
result = [1] * N
for _ in range(N):
matrix.append([int(k) for k in input().split()])
ans ^= matrix[-1][0]
col = 0
while col < N and not ans:
for i in range(1, M):
ans ^= matrix[col][i - 1]
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER WHILE VAR VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split()))
s = [list(map(int, input().split())) for _ in range(n)]
flag = 0
for i in range(n):
if len(set(s[i])) != 1:
flag = 1
break
if flag == 0:
a = 0
for j in range(n):
a = a ^ s[j][0]
if a == 0:
print("NIE")
exit()
else:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr = []
setArr = []
bad = 0
ans = []
stop = 0
for _ in range(n):
next = list(map(int, input().split()))
arr.append(next)
def selectPaht(a, row):
global ans
xor = 0
temp = []
for i in range(n):
xor ^= arr[i][a[i]]
temp.append(a[i] + 1)
if xo... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_DEF ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | N, M = map(int, input().split())
X = [[int(a) for a in input().split()] for i in range(N)]
i0, j0 = -1, -1
for i in range(N):
for j in range(M - 1):
if X[i][j] != X[i][j + 1]:
i0, j0 = i, j + 1
break
if i0 >= 0:
break
s = 0
for i in range(N):
s ^= X[i][0]
if s > 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR BIN_OP VAR NUMBER IF VAR VAR VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR VAR VAR BIN_OP VAR NUMBER IF VAR NUMB... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
lis = []
b = False
for i in range(n):
l = list(map(int, input().split()))
lis.append(l)
if len(set(l)) > 1:
b = True
tmpList = l
tmp = list(set(l))
sql = l[0]
mg = i
if not b:
x = 0
for i in lis:
x = x ^ i[0]
if x =... | 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
mat = [[int(x) for x in input().split()] for i in range(n)]
x = 0
for m in mat:
x ^= m[0]
if x > 0:
print("TAK")
print("1 " * n)
else:
i = -1
f = 0
for m in mat:
if f:
break
i += 1
for k in range(len(m)):
if m[k] !=... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR IF VAR VAR NUM... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
f = 0
ind = -1
for i in range(n):
a.append(list(map(int, input().split())))
k = len(set(a[-1]))
if k > 1:
f = 1
ind = i
if ind == -1:
xor = 0
for i in range(n):
xor ^= a[i][0]
if xor == 0:
print("NIE")
else:
prin... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR IF VAR NUMBER... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
class Main:
def __init__(self):
self.buff = None
self.index = 0
def next(self):
if self.buff is None or self.index == len(self.buff):
self.buff = sys.stdin.readline().split()
self.index = 0
val = self.buff[self.index]
self.index += 1... | IMPORT CLASS_DEF FUNC_DEF ASSIGN VAR NONE ASSIGN VAR NUMBER FUNC_DEF IF VAR NONE VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR VAR VAR VAR NUMBER RETURN VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF ASSIGN VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NONE ASSI... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
l = []
cur = 0
ans = []
for i in range(n):
l.append(0)
cur ^= a[i][0]
if cur > 0:
print("TAK")
for i in range(n):
print(l[i] + 1, end=" ")
else:
for i in range(n):
t = -1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_C... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def solve(s, n, depth, ans, curr):
if depth == n:
if curr != 0:
return ans
else:
return []
for i in s[depth]:
xorr = curr ^ i
ans.append(i)
t = solve(s, n, depth + 1, ans, xorr)
if t != []:
return t
ans.pop()
return ... | FUNC_DEF IF VAR VAR IF VAR NUMBER RETURN VAR RETURN LIST FOR VAR VAR VAR ASSIGN VAR BIN_OP VAR VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR BIN_OP VAR NUMBER VAR VAR IF VAR LIST RETURN VAR EXPR FUNC_CALL VAR RETURN LIST ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUN... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
b = list(map(int, input().split()))
a.append(b)
p = 0
c = []
for i in range(0, n - 1):
p = a[i][0] ^ p
c.append(1)
k = a[n - 1]
q = 0
for j in range(m):
if k[j] != p:
c.append(j + 1)
q = 1
break
if q == 0:
c.appen... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER BIN_OP VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER VAR EXPR FUNC_CAL... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
le = []
ans = [1] * n
ans1 = []
flag = True
for i in range(n):
xx = list(map(int, input().split()))
ans1.append(xx[0])
if flag:
f1 = False
for j in range(m):
if xx[j] != xx[0]:
f1 = True
flag = False
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR NUMBER IF VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def main():
n, m = list(map(int, input().split(" ")))
num = []
for i in range(n):
num.append(list(map(int, input().split(" "))))
ans = 0
for i in range(n):
ans ^= num[i][0]
if ans != 0:
print("TAK")
for i in range(n):
print(1, end=" ")
print("\... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr = [[int(x) for x in input().split()] for _ in range(n)]
answer = []
for i in range(n):
answer = [(i, 0)]
for j in range(1, m):
if arr[i][0] != arr[i][j]:
answer.append((i, j))
break
if len(answer) > 1:
break
if len(answer) > 1:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR NUMBER VAR VAR VAR EXPR FUNC_CALL VAR VAR VAR IF FUNC_CALL VAR VAR NUMB... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | R = lambda: map(int, input().split())
n, m = R()
t = None
cur = None
a = None
for i in range(n):
a = tuple(R())
s = list(set(a))
if t is None and len(s) > 1:
t = [(s[0], a.index(s[0])), a.index(s[1]), i]
else:
cur = a[0] if cur is None else cur ^ a[0]
if n == 1:
ls = list(filter(lamb... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR NONE ASSIGN VAR NONE ASSIGN VAR NONE FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF VAR NONE FUNC_CALL VAR VAR NUMBER ASSIGN VAR LIST VAR NUMBER FUNC_CALL VAR VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
b = []
a = []
xor = 0
for i in range(n):
l = list(map(int, input().split()))
xor ^= l[0]
a.append(len(set(l)))
b.append(l)
if xor != 0:
print("TAK")
ans = [1] * n
print(*ans)
else:
ans = [1] * n
flag = 0
for i in range(len(a)):
if a[i] > 1... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST 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 FUNC_CALL VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
input = sys.stdin.readline
N, M = map(int, input().split())
state = [list(map(int, input().split())) for _ in range(N)]
ok = False
for b in range(10):
L1 = [None] * N
L0 = [None] * N
for m in range(M):
for n in range(N):
if state[n][m] & 1 << b:
L1[n] = m + 1
... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR BIN_OP LIST NONE VAR ASSIGN VAR BIN_OP LIST NONE VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
mat = [[(0) for i in range(m)] for j in range(n)]
for i in range(n):
mat[i] = list(map(int, input().split()))
xor = 0
flag = 0
row = 0
for i in range(n):
if mat[i].count(mat[i][0]) == m:
xor = xor ^ mat[i][0]
else:
flag = 1
row = i
break
if fl... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR 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 VAR IF FUNC_CALL VAR VAR VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split()))
mat = [list(map(int, input().split())) for _ in range(n)]
res = []
for i in range(n):
prev = -1
for j in range(m):
if prev == -1:
prev = mat[i][j]
elif prev != mat[i][j]:
xr = 0
for k in range(n):
if k != ... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR VAR IF VAR VAR VAR VAR ASSIGN VAR NUMBER ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(x) for x in input().split()]
answer = []
xor = 0
total = []
for i in range(n):
a = [int(x) for x in input().split()]
answer.append(a)
for item in answer:
xor ^= item[0]
total.append(1)
if xor > 0:
print("TAK")
print(*total)
else:
for i in range(n):
for j in range(m):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FOR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(el) for el in input().split()]
matrix = list()
for i in range(n):
matrix.append([int(el) for el in input().split()])
base = matrix[0][0]
for i in range(1, len(matrix)):
base = base ^ matrix[i][0]
if base != 0:
print("TAK")
print(" ".join([str(el) for el in [1] * n]))
else:
rem_j = -1
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL V... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
n, m = [int(x) for x in input().split()]
a = []
for i in range(n):
a += [[int(x) for x in input().split()]]
path = [(0) for _ in range(n)]
def solve(i, curxor):
if i == n:
if curxor != 0:
print("TAK")
print(" ".join(str(i + 1) for i in path))
sys.exit(0)... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR VAR LIST FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FUNC_DEF IF VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR FUNC_CALL STRING FUNC_CALL VAR BIN_O... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
matrix = []
for i in range(n):
l = list(map(int, input().split()))
matrix.append(l)
ans = 0
for i in range(n):
ans ^= matrix[i][0]
to_print = [1] * n
for i in range(n):
if len(set(matrix[i])) > 1:
for j in range(m):
if matrix[i][j] ^ matrix[i][0] ^ an... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR IF FUNC_... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
l1 = []
l3 = []
for i in range(0, n):
l2 = list(map(int, input().split()))
l1.append(l2)
l3.append(list(set(l2)))
ans = []
x = 0
for i in range(0, n):
x = x ^ l3[i][0]
ans.append(l3[i][0])
if x != 0:
print("TAK")
for i in range(0, n):
print(l1[i].inde... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR N... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def bitwise_xor(a, b):
return a ^ b
pre = 0
flg = -1
n, m = map(int, input().split())
a = [[] for i in range(n)]
for i in range(n):
a[i] = list(map(int, input().split()))
ans = [[0, 0] for _ in range(n)]
for i in range(n):
Ma = max(a[i])
Mi = min(a[i])
if Ma == Mi:
ans[i] = [1, 1]
else... | FUNC_DEF RETURN BIN_OP VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST NUMBER NUMBER VAR FUNC_CALL VAR VAR FOR VAR F... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def main():
n, m = map(int, input().split())
grid = [list(map(int, input().split())) for i in range(n)]
flag = 0
mi = [0] * n
ma = [0] * n
for i in range(n):
mi[i] = min(grid[i])
ma[i] = max(grid[i])
if mi[i] != ma[i]:
flag = i + 1
if flag:
print("... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR ASSIGN VAR VAR F... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | from sys import stdin
inp = lambda: stdin.readline().strip()
n, m = [int(x) for x in inp().split()]
a = [[] for x in range(n)]
b = [set() for x in range(n)]
flag = False
inPair = []
for i in range(n):
count = 1
for j in inp().split():
a[i].append(int(j))
b[i].add(int(j))
if len(b[i]) > ... | ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR FUNC_C... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
x = 0
l = []
for i in range(n):
l.append(list(map(int, input().split())))
x ^= l[i][0]
if x != 0:
print("TAK")
print("1 " * n)
else:
t = False
ans = [1] * n
for i in range(n):
for j in range(m):
if x ^ l[i][0] ^ l[i][j] != 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP STRING VAR ASSIGN VAR NUMBER ASSIGN VAR BIN... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def xor(m, v):
a = 0
for i, j in enumerate(v):
a = a ^ m[i][j]
if a:
return True
return False
def main():
n, m = [int(x) for x in input().split()]
v = []
for i in range(n):
line = [int(x) for x in input().split()]
v.append(line)
ans = [0] * n
for i i... | FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR VAR VAR IF VAR RETURN NUMBER RETURN NUMBER FUNC_DEF ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR AS... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def main():
n, m = input().split()
n = int(n)
m = int(m)
a = [[(0) for i in range(m)] for j in range(n)]
for i in range(n):
a[i] = [int(j) for j in input().split()]
xor = 0
for i in range(n):
xor ^= a[i][0]
if xor > 0:
print("TAK")
for i in range(n):
... | FUNC_DEF ASSIGN VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
sys.setrecursionlimit(10**5 + 1)
inf = int(10**20)
max_val = inf
min_val = -inf
RW = lambda: sys.stdin.readline().strip()
RI = lambda: int(RW())
RMI = lambda: [int(x) for x in sys.stdin.readline().strip().split()]
RWI = lambda: [x for x in sys.stdin.readline().strip().split()]
rows, cols = RMI()
matrix = [R... | IMPORT EXPR FUNC_CALL VAR BIN_OP BIN_OP NUMBER NUMBER NUMBER ASSIGN VAR FUNC_CALL VAR BIN_OP NUMBER NUMBER ASSIGN VAR VAR ASSIGN VAR VAR ASSIGN VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR VAR FUNC_CALL FUNC_CALL FUN... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | from sys import stdin, stdout
n, m = map(int, stdin.readline().split())
a = [list(map(int, stdin.readline().split())) for i in range(n)]
isDiff = False
p, q = -1, -1
for i in range(n):
cval = a[i][0]
for j in range(1, m):
if cval is not a[i][j]:
isDiff = True
p, q = i, j
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR VAR ASSIGN VAR NUMBER ASSIG... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | m, n = map(int, input().split())
data = [list(map(int, input().split())) for _ in range(m)]
x = 0
for i in range(m):
x ^= data[i][0]
if x > 0:
print("TAK")
print(*([1] * m))
else:
for i, d in enumerate(data):
s = set(d)
if len(set(d)) > 1:
for x in s:
if x != ... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FOR VAR VAR FUNC_CALL VAR VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(i) for i in input().split()]
ls = []
for i in range(n):
ls.append([int(i) for i in input().split()])
ans = 0
for i in range(n):
ans ^= ls[i][0]
res = []
if ans != 0:
res = [(1) for i in range(n)]
else:
for i in range(n):
for j in range(m):
if ls[i][0] != ls[i][j]:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR LIST IF VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL V... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split(" ")))
mat = [None for i in range(n)]
for i in range(n):
mat[i] = list(map(int, input().split(" ")))
tmp_xor = 0
for i in range(n):
tmp_xor ^= mat[i][0]
if tmp_xor:
print("TAK")
for i in range(n):
print("1 ", end="")
else:
flag = False
idx = 0
val =... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NONE VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR STRING ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING FOR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
input = sys.stdin.readline
n, m = map(int, input().split())
mat = [list(map(int, input().split())) for _ in range(n)]
smat = [set(r) for r in mat]
xor = 0
for i in range(n):
xor ^= mat[i][0]
if xor > 0:
print("TAK")
print(" ".join(map(str, [1] * n)))
sys.exit(0)
else:
if all(len(r) == 1 ... | IMPORT ASSIGN VAR VAR ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
__version__ = "1.3"
__date__ = "2019-04-18"
def find_xor(matrix, m, n):
idx = [list(range(1024)) for r in range(m)]
xors = [set() for r in range(m)]
for col, val in enumerate(matrix[0]):
idx[0][val] = [col]
xors[0] = set(matrix[0])
for row in range(1, m):
for col in ran... | IMPORT ASSIGN VAR STRING ASSIGN VAR STRING FUNC_DEF ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR FOR VAR VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER VAR LIST VAR ASSIGN VAR NUMBER FUNC_CALL VAR VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR FOR VAR F... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr = []
ans = 0
for i in range(n):
k = list(map(int, input().split()))
ans ^= k[0]
arr.append(k)
ind = [0] * n
if ans == 0:
for i in range(n):
for j in range(1, m):
ans ^= arr[i][0]
ans ^= arr[i][j]
if ans:
ind... | 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR NUMBER EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR IF VAR NUMBER FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().strip().split())
matrix = []
for i in range(n):
x = list(map(int, input().strip().split()))
matrix.append(x)
output = matrix[0][0]
for i in range(1, n):
output ^= matrix[i][0]
if output == 0:
isans = False
for i in range(n):
for j in range(1, len(matrix[i])):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR VAR VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR NUMBE... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]
x = 0
for v in a:
x ^= v[0]
if x:
print("TAK")
print(*([1] * n))
else:
def go():
for i in range(n):
for j in range(m):
if a[i][j] != a[i][0]:
v = [1] * n
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR BIN_OP LIST NUMBER VAR FUNC_DEF FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL V... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
matrix = []
for i in range(n):
matrix.append(list(map(int, input().split())))
for list in matrix:
if len(set(list)) != 1:
break
else:
xor = 0
for list in matrix:
xor ^= list[0]
if xor == 0:
print("NIE")
exit()
print("TAK")
ls = []
matr... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | R = lambda: map(int, input().split())
n, m = R()
a = [[*R()] for _ in [0] * n]
s = j = 0
for i, r in enumerate(a):
while j < m and r[j] == r[0]:
j += 1
if j < m:
break
j = 0
for r in a:
s ^= r[0]
t = s ^ a[i][0] ^ a[i][j]
r = [1] * n
if s == t == 0:
print("NIE")
exit()
if t:
... | ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR LIST FUNC_CALL VAR VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR NUMBER FOR VAR VAR FUNC_CALL VAR VAR WHILE VAR VAR VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER ASSIGN VAR BIN_OP BIN_OP VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | from sys import stdin, stdout
for _ in range(1):
r, c = list(map(int, stdin.readline().split()))
a = [list(map(int, stdin.readline().split())) for _ in range(r)]
xor = 0
f = 0
for i in range(r):
xor ^= a[i][0]
if xor > 0:
print("TAK")
print(*[(1) for i in range(r)])
... | FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def is_odds(row):
return all(x % 2 == 1 for x in row)
def is_evens(row):
return all(x % 2 == 0 for x in row)
def odd(row):
for i, x in enumerate(row):
if x % 2 == 1:
return i + 1
def even(row):
for i, x in enumerate(row):
if x % 2 == 0:
return i + 1
def so... | FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR VAR FUNC_DEF RETURN FUNC_CALL VAR BIN_OP VAR NUMBER NUMBER VAR VAR FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP VAR NUMBER FUNC_DEF FOR VAR VAR FUNC_CALL VAR VAR IF BIN_OP VAR NUMBER NUMBER RETURN BIN_OP VAR NUMBER FUNC_DEF A... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr = [[int(x) for x in input().split()] for _ in range(n)]
same, xor, same_cnt, diff = [], 0, 0, 0
for i, row in enumerate(arr):
xor ^= row[0]
if sorted(row) == sorted(row, reverse=True):
same.append(True)
same_cnt += 1
else:
same.append(False)
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR VAR LIST NUMBER NUMBER NUMBER FOR VAR VAR FUNC_CALL VAR VAR VAR VAR NUMBER IF FUNC_CALL VAR VAR FUNC_CALL VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER VAR NUMBER EXPR FU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
b = []
ans = 0
for i in range(n):
ans ^= a[i][0]
b.append(1)
if ans != 0:
print("TAK")
for i in b:
print(i, end=" ")
print()
else:
check = False
for i in range(n):
for j i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING F... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(x) for x in input("").split(" ")]
matlis = []
matset = []
leng = 1
swi = -1
for i in range(n):
lis = [int(x) for x in input("").split(" ")]
matlis.append(lis)
matset.append(list(set(lis)))
if len(set(lis)) > 1:
leng = len(set(lis))
swi = i
yihuo = matlis[0][0]
if swi < 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING STRING ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR STRING STRING EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR IF FUN... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = [0] * 2**10
b = []
t = 0
for i in range(n):
temp = list(map(int, input().split()))
b.append(temp)
t = t ^ temp[0]
if t > 0:
res = [1] * n
print("TAK")
print(*res)
exit()
else:
for i in range(n):
for j in range(m):
if b[i][j] != b[i... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER BIN_OP NUMBER NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER IF VAR NUMBER ASSIGN VAR BIN_... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
A = [list(map(int, input().split())) for i in range(n)]
xox = 0
s = 0
F = 0
for i in range(n):
M = A[i]
if not F and len(set(M)) != 1:
s = i
F = 1
else:
xox ^= M[0]
if F:
ans = [1] * n
for i in range(m):
if A[s][i] != xox:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR VAR VAR IF VAR FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR ASSIGN VAR NUM... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, _ = map(int, input().split())
mtrx = [list(map(int, input().split())) for _ in range(n)]
dri = None
for i, row in enumerate(mtrx):
if len(set(row)) > 1:
dri = i
break
if dri is None:
rez = 0
for row in mtrx:
rez ^= row[0]
if rez:
print("TAK")
print(*([1] * n))
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NONE FOR VAR VAR FUNC_CALL VAR VAR IF FUNC_CALL VAR FUNC_CALL VAR VAR NUMBER ASSIGN VAR VAR IF VAR NONE ASSIGN VAR NUMBER FOR VAR VAR VAR VAR NUMBER IF VAR EXPR FU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | from sys import setcheckinterval, setrecursionlimit, stdin
setcheckinterval(1000)
setrecursionlimit(10**7)
def iin():
return int(stdin.readline())
def lin():
return list(map(int, stdin.readline().split()))
n, m = lin()
a = [lin() for i in range(n)]
ans = [[set() for i in range(n + 1)] for j in range(10)]... | EXPR FUNC_CALL VAR NUMBER EXPR FUNC_CALL VAR BIN_OP NUMBER NUMBER FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR FUNC_DEF RETURN FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR FUNC_CALL VAR BIN_OP VAR NUMBER V... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | mat = []
n, m = [int(i) for i in input().split()]
xor = 0
res = []
flag = False
for i in range(n):
mat.append([int(i) for i in input().split()])
xor = xor ^ mat[len(mat) - 1][0]
res.append(1)
if xor > 0:
flag = True
else:
for i in range(n):
for j in range(1, m):
if mat[i][res[i] ... | ASSIGN VAR LIST ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR BIN_OP FUNC_CALL VAR VAR NUMBER NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NU... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | x, y = map(int, input().split())
p = list()
l = [(1) for i in range(x)]
a = 0
for i in range(x):
p.append(list(map(int, input().split())))
a ^= p[i][0]
if a != 0:
print("TAK")
print("1 " * x)
exit()
else:
for i in range(x):
for j in range(y):
if p[i][0] ^ p[i][j] != 0:
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR B... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(i) for i in input().split()]
a = 0
store = []
for i in range(n):
temp = [int(j) for j in input().split()]
store.append(temp)
a ^= temp[0]
if a > 0:
print("TAK")
for i in range(n):
print(1, end=" ")
else:
flag = 0
ii = -1
jj = -1
for i in range(n):
for j in... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR NUMBER STRING ASSIG... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
n, m = map(int, input().split())
a = []
for _ in range(n):
a.append(list(map(int, input().split())))
for k in range(11):
b = [[(0) for _ in range(m)] for _ in range(n)]
for i in range(n):
for j in range(m):
b[i][j] = 1 if a[i][j] & 1 << k > 0 else 0
c = []
for i in ra... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR NUMBER VAR FUNC_CALL VAR VAR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split()))
matrix = []
for _ in range(n):
matrix.append(list(map(int, input().split())))
init_xor = 0
for i in range(n):
init_xor ^= matrix[i][0]
ok = False
if init_xor > 0:
print("TAK")
print(*[(1) for i in range(n)])
ok = True
else:
for i in range(n):
if ok:... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_C... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
n, m = list(map(int, input().split()))
table = []
xor_test = 0
for _ in range(n):
temp = list(map(int, input().split()))
table.append(temp)
xor_test ^= temp[0]
if xor_test != 0:
print("TAK")
for _ in range(len(table)):
print(1, end=" ")
sys.exit()
result_r = -1
result_c = -1
... | IMPORT ASSIGN VAR VAR FUNC_CALL 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR VAR VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR VAR FUNC_CALL VAR FUNC_CALL VAR V... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split()))
a = []
b = []
x = 0
for i in range(n):
a.append(list(map(int, input().split())))
x = x ^ a[i][0]
b.append(len(set(a[i])))
if x != 0:
c = [1] * n
print("TAK")
print(*c)
else:
d = []
e = 0
for i in range(len(b)):
if b[i] > 1:
e... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP VAR VAR VAR NUMBER EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR VAR IF VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = list(map(int, input().split()))
a = []
for i in range(n):
a.append(list(map(int, input().split())))
c = []
q = []
for i in range(n):
b = -1
w = 0
for j in range(m):
if b == -1:
if a[i][j] != b:
b = a[i][j]
w = j
elif a[i][j] != b:
... | ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBE... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
n, m = map(int, input().split())
def xor(A):
x = 0
for a in A:
x ^= a
return x
A = [[int(x) for x in input().split()] for _ in range(n)]
I = [0] * n
ref = A[0][0]
if xor(A[i][0] for i in range(n)):
print("TAK")
print(*[(i + 1) for i in I])
sys.exit()
else:
for i in ra... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR VAR VAR VAR RETURN VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR VAR NUMBER NUMBER IF FUNC_CALL VAR VAR VAR NUMBER VAR FUNC_CALL VAR VAR EX... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
arr1 = []
ans = 0
ansarr = [0] * n
for i in range(n):
arr = list(map(int, input().split()))
if arr.count(arr[0]) == len(arr):
ans = ans ^ arr[0]
ansarr[i] = 1
else:
arr1.append((arr, i))
for i in range(len(arr1)):
for j in range(m):
if ans... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR NUMBER ASSIGN VAR BIN_OP LIST NUMBER VAR FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF FUNC_CALL VAR VAR NUMBER FUNC_CALL VAR VAR ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR VAR NUMBER E... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def solve():
for k in range(10):
ft, tf, tt = 0, 0, 0
for i in range(n):
if l[i][k][0] and l[i][k][1]:
tt += 1
elif l[i][k][0]:
tf += 1
elif l[i][k][1]:
ft += 1
ans = []
verdict = True
if ft %... | FUNC_DEF FOR VAR FUNC_CALL VAR NUMBER ASSIGN VAR VAR VAR NUMBER NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR VAR NUMBER VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER IF VAR VAR VAR NUMBER VAR NUMBER ASSIGN VAR LIST ASSIGN VAR NUMBER IF BIN_OP VAR NUMBER NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR VAR... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
ans = []
flag = 0
for i in range(n):
z = list(map(int, input().split()))
ans.append(z)
if i == 0:
fin = z[0]
else:
fin = fin ^ z[0]
flag = 0
if fin:
flag = 1
print("TAK")
for i in range(n):
print(1, end=" ")
exit()
else:
for i ... | 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER ASSIGN VAR NUMBER IF VAR ASSIGN VAR NUMBER E... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
a.append(list(map(int, input().split())))
x = a[0][m - 1]
for i in range(1, n):
x = x ^ a[i][m - 1]
res = [m] * n
if x == 0:
c = False
for i in range(n):
for j in range(m - 1):
if a[i][j] != a[i][-1]:
res[i] =... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR VAR NUMBER BIN_OP VAR NUMBER FOR VAR FUNC_CALL VAR NUMBER VAR ASSIGN VAR BIN_OP VAR VAR VAR BIN_OP VAR NUMBER ASSIGN VAR BIN_OP LIST VA... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
a = []
for i in range(n):
a.append([int(i) for i in input().split()])
c = [0] * n
def check():
ans = 0
for i in range(n):
ans ^= a[i][c[i]]
return ans
while check() == 0:
flag = 0
for i in range(n):
if c[i] + 1 < m:
flag = 1
if... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR BIN_OP LIST NUMBER VAR FUNC_DEF ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR VAR VAR RETURN VAR WHILE FUNC_CALL VAR NUMBER ASSIGN VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = [int(i) for i in input().split()]
A = []
C = []
for i in range(n):
B = [int(j) for j in input().split()]
A.append(B)
C.append(sorted(list(set(B))))
xor = 0
ans = []
for i in range(n):
xor ^= A[i][0]
ans.append(1)
if xor == 0:
found = 0
for trial in range(n - 1, -1, -1):
newxor... | ASSIGN VAR VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR LIST ASSIGN VAR LIST FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR VAR VAR FUNC_CALL FUNC_CALL VAR EXPR FUNC_CALL VAR VAR EXPR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR LIST FOR VAR FUNC_CALL VAR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def check(M, n, m):
A = []
xxor = 0
for i in range(n):
xxor ^= M[i][0]
A.append(1)
if xxor != 0:
print("TAK")
print(*A)
return
for i in range(n):
for j in range(1, m):
if M[i][j] != M[i][0]:
A[i] = j + 1
prin... | FUNC_DEF ASSIGN VAR LIST ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR VAR VAR VAR NUMBER EXPR FUNC_CALL VAR NUMBER IF VAR NUMBER EXPR FUNC_CALL VAR STRING EXPR FUNC_CALL VAR VAR RETURN FOR VAR FUNC_CALL VAR VAR FOR VAR FUNC_CALL VAR NUMBER VAR IF VAR VAR VAR VAR VAR NUMBER ASSIGN VAR VAR BIN_OP VAR NUMBER EXPR FUNC_CALL... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | def cin():
return map(int, input().split())
def cino(test=False):
if not test:
return int(input())
else:
return input()
def cina():
return list(map(int, input().split()))
def ssplit():
return list(input().split())
def printlist(l):
for i in l:
print(i, end=" ")
... | FUNC_DEF RETURN FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF NUMBER IF VAR RETURN FUNC_CALL VAR FUNC_CALL VAR RETURN 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 FUNC_CALL VAR FUNC_DEF FOR VAR VAR EXPR FUNC_CALL VAR VAR STRING FUNC_D... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | m, n = map(int, input().split())
def get_unique(array):
unique_array = []
for value in array:
if value not in unique_array:
unique_array.append(value)
return unique_array
matrix = []
ori_matrix = []
matrix_idx_controller = [0] * m
multiple_n_idx = set()
ans = 0
for i in range(m):
... | ASSIGN VAR VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR FUNC_DEF ASSIGN VAR LIST FOR VAR VAR IF VAR VAR EXPR FUNC_CALL VAR VAR RETURN VAR ASSIGN VAR LIST ASSIGN VAR LIST ASSIGN VAR BIN_OP LIST NUMBER VAR ASSIGN VAR FUNC_CALL VAR ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUN... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | n, m = map(int, input().split())
l = []
temp = 0
for i in range(n):
k = list(map(int, input().split()))
if i == 0:
temp = k[0]
else:
temp = temp ^ k[0]
l.append(k)
if temp > 0:
print("TAK")
for i in range(n):
print(1, end=" ")
else:
count = 0
bo = -2
for i in ... | 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_CALL VAR VAR FUNC_CALL FUNC_CALL VAR IF VAR NUMBER ASSIGN VAR VAR NUMBER ASSIGN VAR BIN_OP VAR VAR NUMBER EXPR FUNC_CALL VAR VAR IF VAR NUMBER EXPR FUNC_CALL VAR STRING FOR ... |
Student Dima from Kremland has a matrix $a$ of size $n \times m$ filled with non-negative integers.
He wants to select exactly one integer from each row of the matrix so that the bitwise exclusive OR of the selected integers is strictly greater than zero. Help him!
Formally, he wants to choose an integers sequence $c... | import sys
m, n = list(map(int, input().split()))
matrix = [list(map(int, input().split())) for i in range(m)]
c = 0
x, y = 0, 0
dupa = 1
for i in range(m):
if dupa == 0:
break
cur = matrix[i][0]
for j in range(n):
if matrix[i][j] != cur:
x = i
y = j
prin... | IMPORT ASSIGN VAR VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR ASSIGN VAR FUNC_CALL VAR FUNC_CALL VAR VAR FUNC_CALL FUNC_CALL VAR VAR FUNC_CALL VAR VAR ASSIGN VAR NUMBER ASSIGN VAR VAR NUMBER NUMBER ASSIGN VAR NUMBER FOR VAR FUNC_CALL VAR VAR IF VAR NUMBER ASSIGN VAR VAR VAR NUMBER FOR VAR FUNC_CALL VAR ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.