Problem p02614 (python)

Fixed submission:
from itertools import product

h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if (c[row][col] == '#') and ((row_bit[row] == 0) and (col_bit[col] == 0)):
                    cnt += 1   
        if cnt == k:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product

h, w, k = map(int, input().split())
c = [list(input().split()) for _ in range(h)]

ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if (c[row][col] == '#') and ((row_bit[row] == 0) and (col_bit[col] == 0)):
                    cnt += 1   
        if cnt == k:
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
from itertools import product

h, w, k = map(int, input().split())
c = [list(input().split()) for _ in range(h)]

print(c)
ans = 0

for row_bit in product(range(2), repeat=h):
    for col_bit in product(range(2), repeat=w):
        cnt = 0
        for row in range(h):
            for col in range(w):
                if (c[row][col] == '#') and ((row_bit[row] == 0) and (col_bit[col] == 0)):
                    cnt += 1   
        if cnt == k:
            print(row_bit, col_bit)
            ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

H, W, K = map(int, input().split())
c = [list(input().split()) for l in range(H)]

listH = list(range(H))
Hcombi = []
for n in range(H+1):
    a = list(itertools.combinations(listH,n))
    Hcombi.extend(a)

listW = list(range(W))
Wcombi = []
for n in range(W+1):
    a = list(itertools.combinations(listW,n))
    Wcombi.extend(a)

N = 0

for h in Hcombi:
    for w in Wcombi:
        X = np.array(c)
        X[[h],:] = 'n'
        X[:,[w]] = 'n'
        count = np.sum(X == '#')
        if count == K:
            N +=1        
print(str(N))

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

H, W, K = map(int, input().split())
c = [list(input().split()) for l in range(H)]

listH = list(range(H))
Hcombi = []
for n in range(len(listH)+1):
    a = list(itertools.combinations(listH,n))
    Hcombi.extend(a)

listW = list(range(W))
Wcombi = []
for n in range(len(listW)+1):
    a = list(itertools.combinations(listW,n))
    Wcombi.extend(a)

N = 0

for h in Hcombi:
    for w in Wcombi:
        X = np.array(x)
        X[[h],:] = 'n'
        X[:,[w]] = 'n'
        count = np.sum(X == '#')
        if count == K:
            N +=1        
print(str(N))

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

H, W, K = map(int, input().split())
x = [list(input().split()) for l in range(H)]

listH = list(range(H))
Hcombi = []
for n in range(len(listH)+1):
    a = list(itertools.combinations(listH,n))
    Hcombi.extend(a)

listW = list(range(W))
Wcombi = []
for n in range(len(listW)+1):
    a = list(itertools.combinations(listW,n))
    Wcombi.extend(a)

N = 0

for h in Hcombi:
    for w in Wcombi:
        X = np.array(x)
        X[[h],:] = 'n'
        X[:,[w]] = 'n'
        count = np.sum(X == '#')
        if count == K:
            N +=1        
print(str(N))

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

H, W, K = map(int, input().split())
x = [list(input().split()) for l in range(H)]

listH = list(range(H))
Hcombi = []
for n in range(len(listH)+1):
    a = list(itertools.combinations(listH,n))
    Hcombi.extend(a)

listW = list(range(W))
Wcombi = []
for n in range(len(listW)+1):
    a = list(itertools.combinations(listW,n))
    Wcombi.extend(a)

N = 0

for h in Hcombi:
    for w in Wcombi:
        X = np.array(x)
        X[[h],:] = 'n'
        X[:,[w]] = 'n'
        count = np.sum(X == '#')
        if count == K:
            N +=1        
print(str(N))

Buggy submission (verdict: Runtime Error):
import numpy as np
import itertools

H, W, K = map(int, input().split())
x = [list(input().split()) for l in range(H)]

listH = list(range(H))
Hcombi = []
for n in range(len(listH)+1):
    a = list(itertools.combinations(listH,n))
    Hcombi.extend(a)

listW = list(range(W))
Wcombi = []
for n in range(len(listW)+1):
    a = list(itertools.combinations(listW,n))
    Wcombi.extend(a)

N = 0

for h in Hcombi:
    for w in Wcombi:
        X = np.array(x)
        X[[h],:] = 'n'
        X[:,[w]] = 'n'
        count = np.sum(X == '#')
        if count == K:
            N +=1        
print(N)