Problem:


Score : 800 points

Problem Statement

There is a square grid with N rows and M columns.
Each square contains an integer: 0 or 1. The square at the i-th row from the top and the j-th column from the left contains a_{ij}.

Among the 2^{N+M} possible pairs of a subset A of the rows and a subset B of the columns, find the number of the pairs that satisfy the following condition, modulo 998244353:

The sum of the |A||B| numbers contained in the intersection of the rows belonging to A and the columns belonging to B, is odd.

Constraints

1 \leq N,M \leq 300

0 \leq a_{i,j} \leq 1(1\leq i\leq N,1\leq j\leq M)

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N M
a_{11} ... a_{1M}
:
a_{N1} ... a_{NM}

Output

Print the number of the pairs of a subset of the rows and a subset of the columns that satisfy the condition, modulo 998244353.

Sample Input 1

2 2
0 1
1 0

Sample Output 1

6

For example, if A consists of the first row and B consists of both columns, the sum of the numbers contained in the intersection is 0+1=1.

Sample Input 2

2 3
0 0 0
0 1 0

Sample Output 2

8



Sample input:
2 2
0 1
1 0


Sample output:
6

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    is_all_zero_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            is_all_zero_set.add(i)
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    row = -1
    for i in range(min(N, M)):
        if i in is_all_zero_set:
            continue
        row += 1
        for j in range(row+1, N):
            if ((A_[j] >> row) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[row]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M - all_zero_count)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    is_all_zero_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_all_zero_set.add(j)
                    is_set.add(j)
                    break

    row = -1
    for i in range(min(N, M)):
        if i in is_all_zero_set:
            continue
        row += 1
        for j in range(row+1, N):
            if ((A_[j] >> row) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[row]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M - all_zero_count)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    is_all_zero_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_all_zero_set.add(j)
                    is_set.add(j)
                    break

    row = -1
    for i in range(min(N, M)):
        if i in is_all_zero_set:
            break
        row += 1
        for j in range(row+1, N):
            if ((A_[j] >> row) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[row]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M - all_zero_count)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    is_all_zero_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_all_zero_set.add(j)
                    is_set.add(j)
                    break

    row = 0
    for i in range(min(N, M)):
        if i in is_all_zero_set:
            break
        row += 1
        for j in range(row+1, N):
            if ((A_[j] >> row) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[row]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M - all_zero_count)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if ((A_[j] >> i) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    all_zero_count = 0
    for i in range(max(M, N)):
        is_all_zero = True
        for j in range(N):
            if (A[j] & (0x01 << i)) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            all_zero_count += 1
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if ((A_[j] >> i) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M - all_zero_count)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if ((A_[j] >> i) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - min(r, M)
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if ((A_[j] >> i) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - r
    count1 = 1L
    for i in range(M-1):
        count1 = (count1 * 2L)%998244353
    count2 = 1L
    for i in range(N):
        count2 = (count2 * 2L)%998244353
    count3 = 1L
    for i in range(k):
        count3 = (count3 * 2L)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if ((A_[j] >> i) & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = N - r
    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if (A_[j] >> i & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    r = 0
    for i in range(N):
        if A_[i] != 0:
            r += 1
    k = M - r
    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if (A_[j] >> i & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    k = 0
    for i in range(N):
        if A_[i] == 0:
            k += 1
    k = N - k
    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if (A_[j] >> i & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    k = 0
    for i in range(N):
        if A_[i] == 0:
            k += 1

    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 998244353

for i in range(n):
    for j in range(m):
        a[i][j] = a[i][j] % 2

# 掃き出し法
rank = 0
for i in range(n):
    target = -1
    for j in range(rank, m):
        if a[i][j]:
            target = j
            break

    if target == -1:
        continue

    if target != rank:
        for k in range(n):
            a[k][rank], a[k][target] = a[k][target], a[k][rank]

    for k in range(rank+1, n):
        if a[k][rank]:
            for j in range(rank, m):
                a[k][j] ^= a[rank][j]

    rank += 1


def modpow(a, n, mod=mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

print(modpow(2, m-1) * (modpow(2, n) - modpow(2, n-rank)) % mod)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if (A_[i] >> i & 0x01) > 0:
                A_[j] = A_[j] ^ A_[i]
    k = 0
    for i in range(N):
        if A_[i] == 0:
            k += 1

    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 998244353

for i in range(n):
    for j in range(m):
        a[i][j] = a[i][j] % 2

# 掃き出し法
rank = 0
for i in range(n):
    target = -1
    for j in range(rank, m):
        if a[i][j]:
            target = j
            break

    if target == -1:
        continue

    if target != rank:
        for k in range(rank, n):
            a[k][rank], a[k][target] = a[k][target], a[k][rank]

    for k in range(rank+1, n):
        if a[k][rank]:
            for j in range(rank, m):
                a[k][j] ^= a[rank][j]

    rank += 1


def modpow(a, n, mod=mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

print(modpow(2, m-1) * (modpow(2, n) - modpow(2, n-rank)) % mod)

Submission status: Wrong Answer

Solution code:
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline

def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [N, M] = [long(input_raw[0]), long(input_raw[1])]
    A = []
    for i in range(N):
        input_raw = read_func().strip().split()
        a = 0
        for j in range(M):
            a += int(input_raw[j]) << j
        A.append(a)
    is_set = set([])
    A_ = [0 for i in range(N)]
    for i in range(N):
        is_all_zero = True
        for j in range(N):
            if (A[j] & 0x01 << i) > 0 and j not in is_set:
                A_[i] = A[j]
                is_set.add(j)
                is_all_zero =False
                break
        if is_all_zero == True:
            for j in range(N):
                if j not in is_set:
                    A_[i] = A[j]
                    is_set.add(j)
                    break

    for i in range(min(N, M)):
        for j in range(i+1, N):
            if (A[i] >> i & 0x01) > 0:
                A[j] = A[j] ^ A[i]
    k = 0
    for i in range(N):
        if A[i] == 0:
            k += 1

    count1 = 1
    for i in range(M-1):
        count1 = (count1 * 2)%998244353
    count2 = 1
    for i in range(N):
        count2 = (count2 * 2)%998244353
    count3 = 1
    for i in range(k):
        count3 = (count3 * 2)%998244353
    count = (count1 * ((count2 - count3) %998244353))%998244353
    print count



if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
import numpy as np
MOD = 998244353
n, m = map(int, input().split())
a = np.array([list(map(int, input().split())) for _ in [0]*n])
#a[:, [0, 1]] = a[:, [1, 0]]
#print(a)
r = 0
for i in range(min(m, n)):
	if a[i][i] != 1:
		for j in range(i+1, m):
			if a[i][j] == 1:
				a[:, [i, j]] = a[:, [j, i]]
				break
#		else:
#			for j in range(i+1, n):
#				if a[j][i] == 1:
#					a[[i, j]] = a[[j, i]]
#				break
#			else:
#				break
	if a[i][i] == 0:
		continue

	r += 1
	for j in range(i+1, m):
		a[:, j] += a[i][j] * a[:, i]
		a[:, j] %= 2
	for j in range(i+1, n):
		a[j] += a[j][i] * a[i]
		a[j] %= 2
#print(r)
print((pow(2, n+m-1, MOD) - pow(2, n+m-r-1, MOD)) % MOD)

Submission status: Wrong Answer

Solution code:
import numpy as np
MOD = 998244353
n, m = map(int, input().split())
a = np.array([list(map(int, input().split())) for _ in [0]*n])
#a[:, [0, 1]] = a[:, [1, 0]]
#print(a)
r = 0
for i in range(min(m, n)):
	if a[i][i] != 1:
		for j in range(i+1, m):
			if a[i][j] == 1:
				a[:, [i, j]] = a[:, [j, i]]
				break
		else:
			for j in range(i+1, n):
				if a[j][i] == 1:
					a[[i, j]] = a[[j, i]]
				break
			else:
				break
	if a[i][i] == 0:
		continue

	r += 1
	for j in range(i+1, m):
		a[:, j] += a[i][j] * a[:, i]
		a[:, j] %= 2
	for j in range(i+1, n):
		a[j] += a[j][i] * a[i]
		a[j] %= 2
#print(r)
print((pow(2, n+m-1, MOD) - pow(2, n+m-r-1, MOD)) % MOD)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 998244353

for i in range(n):
    for j in range(m):
        a[i][j] = a[i][j] % 2

# 掃き出し法
rank = 0
for i in range(n):
    target = -1
    for j in range(rank, m):
        if a[i][j]:
            target = j
            break

    if target == -1:
        continue

    if target != rank:
        for k in range(rank, n):
            a[k][rank], a[k][target] = a[k][target], a[k][rank]

    for k in range(rank+1, n):
        if a[k][rank]:
            for j in range(rank, m):
                a[k][j] -= a[rank][j]

    rank += 1


def modpow(a, n, mod=mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

print(modpow(2, m-1) * (modpow(2, n) - modpow(2, n-rank)) % mod)

Submission status: Wrong Answer

Solution code:
n, m = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(n)]

mod = 998244353

for i in range(n):
    for j in range(m):
        a[i][j] = a[i][j] % 2

# 掃き出し法
rank = 0
for i in range(n):
    target = -1
    for j in range(rank, m):
        if a[i][j]:
            target = j
            break

    if target == -1:
        continue

    if target != rank:
        for k in range(rank, n):
            a[k][rank], a[k][target] = a[k][target], a[k][rank]

    for k in range(rank+1, n):
        if a[k][rank]:
            for j in range(rank, m):
                a[k][j] -= a[rank][j]

    rank += 1


def modpow(a, n, mod=mod):
    res = 1
    while n > 0:
        if n & 1:
            res = res * a % mod
        a = a * a % mod
        n >>= 1
    return res

print(modpow(2, m-1) * (modpow(2, n) - modpow(2, n-rank) % mod))