Problem p02614 (python)

Fixed submission:
H,W,K = map(int,input().split())
C = [0]*H
 
for i in range(H):
    C[i] = list(str(input()))
    
 
    
def gyotsubushi(n,E):
    if I[n] == 1:
        E[n] = ['R']*W
        #print('GYO')
        
def retsutsubushi(n,E):
    if J[n] == 1:
        for i in range(H):
            E[i][n] = 'R'
stock = []
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                if I+J in stock:
                                                    break
                                                stock.append(I+J)
                                                D = copy.deepcopy(C)
                                                #print(D,I,J)
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                                #print(D)
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '#':
                                                            count += 1
                                                if count == K:
                                                    counter += 1
 
    
print(counter)

Buggy submission (verdict: Runtime Error):
    for i in range(H+W):
        summ += lis[i]*num
        num *= 2
    return(summ)
    
            
stock = []
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                
                                                if I+j in stock:
                                                    break
                                                stock.append(I+J)
                                                D = copy.deepcopy(C)
                                                
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                               
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '#':
                                                            count += 1
                                                            
                                                if count == K:
                                                    counter += 1

    
print(counter)

Buggy submission (verdict: Runtime Error):
H,W,K = map(int,input().split())
C = [0]*H

for i in range(H):
    C[i] = list(str(input()))
    

    
def gyotsubushi(n,E):
    if I[n] == 1:
        E[n] = ['R']*W
        #print('GYO')
        
def retsutsubushi(n,E):
    if J[n] == 1:
        for i in range(H):
            E[i][n] = 'R'
            
def ango(lis):
    num = 1
    summ = 0
    for i in range(H+W):
        summ += lis[i]*num
        num *= 2
    return(summ)
    
            
stock = []
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                
                                                if I+j in stock:
                                                    break
                                                stock.append(I+J)
                                                D = copy.deepcopy(C)
                                                
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                               
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '#':
                                                            count += 1
                                                            
                                                if count == K:
                                                    counter += 1

    
print(counter)

Buggy submission (verdict: Runtime Error):
H,W,K = map(int,input().split())
C = [0]*H

for i in range(H):
    C[i] = list(str(input()))
    

    
def gyotsubushi(n,E):
    if I[n] == 1:
        E[n] = ['R']*W
        #print('GYO')
        
def retsutsubushi(n,E):
    if J[n] == 1:
        for i in range(H):
            E[i][n] = 'R'
            
def ango(lis):
    num = 1
    summ = 0
    for i in range(H+W):
        summ += lis[i]*num
        num *= 2
    return(summ)
    
            
stock = []
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                
                                                if I+j in stock:
                                                    break
                                                stock.append(I+J)
                                                D = copy.deepcopy(C)
                                                
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                               
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '#':
                                                            count += 1
                                                            if count > K:
                                                                break
                                                            else:
                                                                continue
                                                            break
                                                        else:
                                                            continue
                                                        break
                                                    else:
                                                        continue
                                                    break
                                                if count == K:
                                                    counter += 1

    
print(counter)

Buggy submission (verdict: Runtime Error):
H,W,K = map(int,input().split())
C = [0]*H

for i in range(H):
    C[i] = list(str(input()))
    

    
def gyotsubushi(n,E):
    if I[n] == 1:
        E[n] = ['R']*W
        #print('GYO')
        
def retsutsubushi(n,E):
    if J[n] == 1:
        for i in range(H):
            E[i][n] = 'R'
            
def ango(lis):
    num = 1
    summ = 0
    for i in range(H+W):
        summ += lis[i]*num
        num *= 2
    return(summ)
    
            
stock = [0]*1024
counter = 0
import copy
for i0 in range(2):
    for i1 in range(2):
        for i2 in range(2):
            for i3 in range(2):
                for i4 in range(2):
                    for i5 in range(2):
                        for j0 in range(2):
                            for j1 in range(2):
                                for j2 in range(2):
                                    for j3 in range(2):
                                        for j4 in range(2):
                                            for j5 in range(2):
                                                preI = [i0,i1,i2,i3,i4,i5]
                                                preJ = [j0,j1,j2,j3,j4,j5]
                                                I = preI[0:H]
                                                J = preJ[0:W]
                                                
                                                if stock[ango(I+J)]==1:
                                                    break
                                                stock[ango(I+J)]=1
                                                D = copy.deepcopy(C)
                                                #print(D,I,J)
                                                for i in range(H):
                                                    gyotsubushi(i,D)
                                                for j in range(W):
                                                    retsutsubushi(j,D)
                                                #print(D)
                                                count = 0
                                                for i in range(H):
                                                    for j in range(W):
                                                        if D[i][j] == '#':
                                                            count += 1
                                                if count == K:
                                                    counter += 1

    
print(counter)