TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
import functools
import numpy as np
H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


custom_get_bool = functools.partial(mat, '.')
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


import functools
import numpy as np
H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


custom_get_bool = functools.partial((mat, '.'))
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


import functools
import numpy as np


def get_bool(x, value, axis):
    return np.where(x == value, True, False).all(axis=axis)


H, W = map(int, input().split())
mat = np.array([list(input()) for _ in range(H)])

custom_get_bool = functools.partial(get_bool, mat, '.')
mat = mat[:, ~custom_get_bool(0)]
mat = mat[~custom_get_bool(1)]
print('\n'.join([''.join(row) for row in mat]))


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())


for index, i in enumerate(a):
    if i == '.'*W:
        a.remove('.'*W)


aa = list(map(list, zip(*a)))


for index, i in enumerate(aa):
    if i == ['.']*len(aa[0]):
        aa.remove(tamesi)

aaa = list(map(list, zip(*aa)))

for i in aaa:
    print(''.join(i))

H, W = map(int, input().split())
a = []
ans = []
for i in range(H):
    a.append(input())
    
    if len(set(a[-1])) == 1 and a[-1][0] == '.':
        del a[-1]

if len(a) == 1:
    kotae = a[0]
    kotae = kotae.replace('.', '')
    print(kotae)
else:
    for x in range(W):
        check = []
        for y in range(len(a)):

            if a[y][x] != '.':
                break
            else:
                check.append(a[y][x])
                
        if len(check) == len(a):
            ans.append(x)
            
    
    if len(ans) >= 1:
        re_ans = []
        for i in a:
            kari = list(i)
            for j in ans:
                kari[j] = '0'
           # print(kari)
            re_ans.append(kari)
        
        for i in re_ans:
            moji = ''.join(i)
            mojji = moji.replace('0', '')
            print(mojji)
    else:
        for i in a:
            print(i)

Verdicts: Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w = [int(_) for _ in input().split()]
board = [ list(input())  for _ in range(h)]

goodx = [False] * w
goody = [False] * h

for i in range(w):
  for j in range(h):
    print("i ={}, j ={}".format(i,j))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(w):
  if goodx[i]:
    for j in range(h):
      if goody[j]:
        print(board[i][j], end='')
    print("")

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

goodx = [False] * h
goody = [False] * w

for i in range(h):
  for j in range(w):
#    print("i={}\tj={}\tboard={}".format(i,j,board[i][j]))
    if board[i][j] == '#':
      goodx[i] = True
      goody[j] = True

for i in range(h):
  if goodx[i]:
    for j in range(w):
      if goody[j]:
        print(board[i][j], end='')
    print("")

Verdicts: Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
a = [""] * H
for i in range(H):
    a[i] = input()

row = [False] * H
col = [False] * W
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True
print(row, col)

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end = "")
        print()


H, W = map(int, input().split())
a = [""] * H
for i in range(H):
    a[i] = input()

row = [False] * H
col = [False] * W
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            row[i] = True
            col[j] = True

for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end = "")
        print()


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
# -*- coding: utf-8 -*-
import pprint

H,W = list(map(int, input().rstrip().split()))
a_list=[list(input().rstrip()) for i in range(H)]
#-----

row_del_list=[]
for i,v in enumerate(a_list):
    if v.count(".") == W:
        row_del_list.append(i)

for i in row_del_list[::-1]:
    del a_list[i]
    H -= 1

       
column_del_list=[]
for j in range(W):
    cnt_white=0
    for i in range(H):
        if a_list[i][j] == ".":
            cnt_white += 1
    
    if cnt_white == H:
        column_del_list.append(j)
        
for j in column_del_list[::-1]:
    #print("j",j)
    for i in range(H):
        del a_list[i][j]
        W -= 1


for row in a_list:
    print(*row)


# -*- coding: utf-8 -*-
import pprint

H,W = list(map(int, input().rstrip().split()))
a_list=[list(input().rstrip()) for i in range(H)]
#-----

row_del_list=[]
for i,v in enumerate(a_list):
    if v.count(".") == W:
        row_del_list.append(i)

for i in row_del_list[::-1]:
    del a_list[i]
    H -= 1

       
column_del_list=[]
for j in range(W):
    cnt_white=0
    for i in range(H):
        if a_list[i][j] == ".":
            cnt_white += 1
    
    if cnt_white == H:
        column_del_list.append(j)
        
for j in column_del_list[::-1]:
    for i in range(H):
        del a_list[i][j]
        W -= 1


for row in a_list:
    print(*row,sep="")


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
import numpy as np
h,w=map(int,input().split())

icon=[''] * h
for i in range(h):
    a[i]=input()


row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if icon[i][j]=='#':
            row[i]=True
            col[j]=True

for  i in range(h):
    if row[i]==True:
        for j in range(w):
            if col[j]==True:
                print(icon[i][j],end='')
        print()  


import numpy as np
h,w=map(int,input().split())
icon=list()
for i in range(h):
    icon.append(list(input().split()))

row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if icon[i][j]=='#':
            row[i]=True
            col[j]=True

for  i in range(h):
    if row[i]==True:
        for j in range(w):
            if col[j]==True:
                print(icon[i][j],end='')
        print()  

import numpy as np
h,w=map(int,input().split())

icon=[''] * h
for i in range(h):
    icon[i]=input()


row=[False]*h
col=[False]*w

for i in range(h):
    for j in range(w):
        if icon[i][j]=='#':
            row[i]=True
            col[j]=True

for  i in range(h):
    if row[i]==True:
        for j in range(w):
            if col[j]==True:
                print(icon[i][j],end='')
        print()  

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
lst = []
for i in range(H):
    lst.append(list(input()))
for i in range(H-1, -1, -1):
    if '#' not in lst[i]:
        del lst[i]
for j in range(W-1, -1, -1):
    cnt = 0
    for i in range(len(lst)):
        if lst[i][j] == '#':
            cnt += 1
    if cnt == 0:
        for i in range(len(lst)):
            del lst[i][j]
for i in lst:
    print(*i)

H, W = map(int, input().split())
lst = []
for i in range(H):
    lst.append(list(input()))
for i in range(H-1, -1, -1):
    if '#' not in lst[i]:
        del lst[i]
for j in range(W-1, -1, -1):
    cnt = 0
    for i in range(len(lst)):
        if lst[i][j] == '#':
            cnt += 1
    if cnt == 0:
        for i in range(len(lst)):
            del lst[i][j]
for i in lst:
    print(''.join(i))

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h, w = map(int, input().split())
a = [[input()] for _ in range(h)]
row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end='')
        print()


h, w = map(int, input().split())
a = [[input().split()] for _ in range(h)]
row = [False] * h
col = [False] * w
for i in range(h):
    for j in range(w):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(h):
    if row[i]:
        for j in range(w):
            if col[j]:
                print(a[i][j], end='')
        print()


h, w = map(int, input().split())
a = [''] * h
for i in range(h):
	a[i] = input()

row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if a[i][j] == '#':
			row[i] = True
			col[j] = True

for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j], end = '')
		print()


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(input())
H=[]
W=[]
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            H.append(i)
            W.append(j)
for j in H:
    ans=[]
    for i in W:
        ans.append(a[j][i])
print("".join(ans))


h,w=map(int,input().split())
a=[]
for i in range(h):
    a.append(input())
H=[]
W=[]
for i in range(h):
    for j in range(w):
        if a[i][j]=="#":
            H.append(i)
            W.append(j)
H=set(H)
W=set(W)
for j in H:
    ans=[]
    for i in W:
        ans.append(a[j][i])
    print("".join(ans))
    


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
# -*- coding: utf-8 -*-
H, W = map(int, input().split(' '));

board = []
flags = [ True for x in range(W)]
for i in range(H):
    line = list(input())
    if ( '#' in line ):
        board.append(line)
        flags = [ f and s == '.' for s,f in zip(line, flags) ]

j = 0
for i, flag in enumerate(flags):
    if flag:
        for b in board:
            b.pop(i-j)
            j += 1
for b in board:
    print(''.join(b))

# -*- coding: utf-8 -*-
import sys
H, W = map(int, input().split(' '));

board = []
flags = [ True for x in range(W)]
for i in range(H):
    line = list(input())
    if ( '#' in line ):
        board.append(line)
        flags = [ f and s == '.' for s,f in zip(line, flags) ]

j = 0
for b in board:
    for l,flag in zip(b,flags):
        if not flag:
            sys.stdout.write(l)
    print()

Verdicts: Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]
print(a)

a = list(zip(*[i for i in a if "#" in i]))
print(a)
a = list(zip(*[j for j in a if "#" in j]))
print(a)

for n in range(len(a)):
    print("".join(a[n]))

H, W = map(int, input().split())
a = [list(input()) for _ in range(H)]

a = list(zip(*[i for i in a if "#" in i]))
a = list(zip(*[j for j in a if "#" in j]))

for n in range(len(a)):
    print("".join(a[n]))

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
import numpy as np
h, w = map(int, input().split())

grid = [list(input()) for _ in range(h)]
grid = [row for row in grid if row.count(".") != len(row)]
grid = [row for row in np.rot90(grid, k=1) if np.count_nonzero(row == ".") != len(row)]
[print(row) for row in np.rot90(grid, k=-1)]

import numpy as np

h, w = map(int, input().split())
grid = np.array([[j for j in input()] for i in range(h)])
grid = np.array([x for x in grid if "#" in x])
grid = np.array([x for x in grid.T if "#" in x])

[print("".join(x)) for x in grid.T]

  
    

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w=map(int,input().split())
a=[[j for j in input()] for i in range(h)]
b=[x for x in a if "#" in x]
c=zip(*[y for y in zip(*b) if "#" in y])
for d in zip(*c):print("".join(d))

h,w=map(int,input().split())
a=[]
for i in range(h):
    x = input()
    if "#" in x:
        a.append(x)
a=list(zip(*a))
print(a)
b=[]
for y in a:
    if "#" in y:
        b.append(y)
b=list(zip(*b))
print(b)
for c in b:
    print("".join(c))

h,w=map(int,input().split())
for a in zip(*[y for y in zip(*[x for x in [[j for j in input()] for i in range(h)] if "#" in x]) if "#" in y]):print("".join(a))

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
import numpy as np

H, W = list(map(int, input().split()))
arr = np.array([list(input()) for i in range(H)])
arr = arr[(np.apply_along_axis(lambda line: '#' in line, 1, arr))]
arr = arr[:, (np.apply_along_axis(lambda line: '#' in line, 0, arr))]
print(arr)


import numpy as np

H, W = list(map(int, input().split()))
arr = np.array([list(input()) for i in range(H)])
arr = arr[(np.apply_along_axis(lambda line: '#' in line, 1, arr))]
arr = arr[:, (np.apply_along_axis(lambda line: '#' in line, 0, arr))]
for l in arr.tolist():
    print(''.join(l))


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w=map(int,input().split())
a=[[i for i in input()] for j in range(h)]

x=[False]*w
y=[False]*h

for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            x[j]=True
            y[i]=True


for i in range(h):
    li=[]
    for j in range(w):
        if x[j]==True and y[i]==True:
            li+=a[i][j]
    if li!=[]:
        print(*li)


h,w=map(int,input().split())
a=[[i for i in input()] for j in range(h)]

x=[False]*w
y=[False]*h

for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            x[j]=True
            y[i]=True


for i in range(h):
    li=[]
    for j in range(w):
        if x[j]==True and y[i]==True:
            li+=a[i][j]
    if li!=[]:
        print(''.join(li))


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
STAGE = [input() for _ in range(H)]

#print("")

ccheck = 0
for l in STAGE:
	if "#" not in l:
		STAGE.remove(l)
	else:
		ccheck |= int(l.replace("#", "1").replace(".", "0"), 2)

#print(bin(ccheck))

for l in STAGE:
	print(l)



H, W = map(int, input().split())
STAGE = [input() for _ in range(H)]

ccheck = 0
for i, l in enumerate(STAGE):
	ccheck |= int(l.replace("#", "1").replace(".", "0"), 2)

for l in STAGE:
	if "#" not in l:
		continue
	for f, c in zip(format(ccheck, "b").zfill(W), l):
		if "1" == f:
			print(c, end="")
	print("")


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
import numpy as np

H,W = map(int,input().split())
MAP = []
for _ in range(H):
    tmp = tuple(input())
    MAP.append(tmp)

MAP = np.array(MAP)
L = []
for i in range(H):
    if all(MAP[i,:] == '.'):
        L.append(i)

MAP = np.delete(MAP,L,0)

L = []
for i in range(W):
    if all(MAP[:,i] == '.'):
        L.append(i)

MAP = np.delete(MAP,L,1)
for m in MAP:
    print(*m)

import numpy as np
 
H,W = map(int,input().split())
MAP = []
for _ in range(H):
    tmp = tuple(input())
    MAP.append(tmp)
 
MAP = np.array(MAP)
L = []
for i in range(H):
    if all(MAP[i,:] == '.'):
        L.append(i)
 
MAP = np.delete(MAP,L,0)
L = []
for i in range(W):
    if all(MAP[:,i] == '.'):
        L.append(i)
 
MAP = np.delete(MAP,L,1)
for m in MAP:
    print(''.join(m))


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = list(map(int, input().split()))  
A = list(input() for i in range(H)) 
#A = [input() for _ in range(H)]

B = [False] * H
C = [False] * W

print(A)
for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            B[i] = True
            C[j] = True

for i in range(H):
	if B[i]:
		for j in range(W):
			if C[j]:
				print(A[i][j], end = '')
		print()

H, W = list(map(int, input().split()))  
A = list(input() for i in range(H)) 
#A = [input() for _ in range(H)]

B = [False] * H
C = [False] * W

for i in range(H):
    for j in range(W):
        if A[i][j] == "#":
            B[i] = True
            C[j] = True

for i in range(H):
	if B[i]:
		for j in range(W):
			if C[j]:
				print(A[i][j], end = '')
		print()

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w=input().split()
cnt=0
b=[]
for i in range(int(h)):
  a=input()
  if a.count('.') < int(w):
    b.append(a)

for i in range(len(b)):
    print(b[i])

print(len(b))

c=[]
for j in range(len(b[0])):
  for i in range(len(b)):
    c.append(b[i][j])
  
print(c)

import numpy as np

h,w=input().split()
h=int(h)
w=int(w)

list1 =[input() for i in range(h)]
#print(list1)

list2=[]
for i in range(h):
  if list1[i].count('#') > 0:
    list2.append(list1[i])
#print(list2)
list2_num=len(list2)

list4=[]
for i in range(list2_num):
  list3=(list(list2[i]))
  list4.append(list3)
#print(list4)
list4=np.array(list4).T
#print(list4)

list4=list4.tolist()
list5=[]
for i in range(w):
  if list4[i].count('#') > 0:
    list5.append(list4[i])
#print(list5)

list5=np.array(list5).T
#print(list5)
list5=list5.tolist()
#print(list5)
for i in range(len(list5)):
  for j in range(len(list5[0])):
    print(list5[i][j], end='')
  print('')

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
a,b=map(int,input().split())
c=[]
for i in range(a):
  g=input()
  if "#" not in g:
    continue
  d=list(g)
  c.append(d)
l=len(c)
p=[]
for i in range(b):
  for j in range(l):
    if c[j][i]=="#":
      p.append(i)
      continue
for i in range(l):
  for j in range(len(p)):
    if j == len(p)-1:
      print(c[i][p[j]])
      continue
    print(c[i][p[j]],end="")

a,b=map(int,input().split())
c=[]
for i in range(a):
  g=input()
  if "#" not in g:
    continue
  d=list(g)
  c.append(d)
l=len(c)
p=[]
for i in range(b):
  for j in range(l):
    if c[j][i]=="#":
      p.append(i)
      break
for i in range(l):
  for j in range(len(p)):
    if j == len(p)-1:
      print(c[i][p[j]])
    else:
      print(c[i][p[j]],end="")



Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w = map(int,input().split())
mat = []
for i in range(h):
  g = list(input().split())
  if g.count(".") != w:
    mat.append(g)

for i in range(w-1, -1, -1):
  count = 0
  for j in range(len(mat)):
    if mat[j][i] == ".":
      count += 1
  if count == len(mat):
    for j in range(len(mat)):
      mat[j].pop(i)

for h in range(len(mat)):
  print(" ".join(mat[h]))
    

h,w = map(int,input().split())
mat = []
for i in range(h):
  g = list(input())
  if g.count(".") != w:
    mat.append(g)


for i in range(w-1, -1, -1):
  count = 0
  for j in range(len(mat)):
    if mat[j][i] == ".":
      count += 1
  if count == len(mat):
    for j in range(len(mat)):
      mat[j].pop(i)

for h in range(len(mat)):
  print(" ".join(mat[h]))
    


h,w = map(int,input().split())
mat = []
for i in range(h):
  g = list(input())
  if g.count(".") != w:
    mat.append(g)


for i in range(w-1, -1, -1):
  count = 0
  for j in range(len(mat)):
    if mat[j][i] == ".":
      count += 1
  if count == len(mat):
    for j in range(len(mat)):
      mat[j].pop(i)

for h in range(len(mat)):
  print("".join(mat[h]))
    


Verdicts: Runtime Error

Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
rows, cols = map(int, input().split())
mat = [input() for _ in range(rows)]

print_row = [False for _ in range(rows)]
print_col = [False for _ in range(cols)]

for i in range(rows):
  for j in range(cols):
    if mat[i][j] == '#':
      print_row[i] = True
      print_col[i] = True
      
for i in range(rows):
  for j in range(cols):
    if print_row[i] or print_col[j]:
      print(mat[i][j], end="")
  print()

rows, cols = map(int, input().split())
mat = [input() for _ in range(rows)]

print_row = [False for _ in range(rows)]
print_col = [False for _ in range(cols)]

for i in range(rows):
  for j in range(cols):
    if mat[i][j] == '#':
      print_row[i] = True
      print_col[j] = True

for i in range(rows):
  print_newline = False
  for j in range(cols):
    if print_row[i] and print_col[j]:
      print(mat[i][j], end="")
      print_newline = True
  if print_newline:
    print()


Verdicts: Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w=map(int,input().split())
a=[""]*h
for i in range(h):
	a[i]=input()

row=[False]*h
col=[False]*w
for i in range(h):
	for i in range(w):
		if a[i][j]=="#":
			row[i]=True
			col[j]=True
			
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j],end='')
				print()

h,w=map(int,input().split())
a=[""]*h
for i in range(h):
	a[i]=input()

row=[False]*h
col=[False]*w
for i in range(h):
	for j in range(w):
		if a[i][j]=="#":
			row[i]=True
			col[j]=True
			
for i in range(h):
	if row[i]:
		for j in range(w):
			if col[j]:
				print(a[i][j],end='')
		print()

Verdicts: Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h, w = map(int, input().split())
a = []
for i in range(h):
	a.append(list(input()))


temp1 = []
temp2 = []
for i in range(len(a)):
	ff = 0
	for j in range(len(a[i])):
		if a[i][0] == '.':
			continue
		ff = 1
	if ff == 0:
		temp1.append(i)
temp1.sort(reverse=True)
for i in range(len(a[0])):
	ff = 0
	for j in range(len(a)):
		if a[0][i] == '.':
			continue
		ff = 1
	if ff == 0:
		temp2.append(i)
temp2.sort(reverse=True)
for i in range(len(temp1)):
	a.pop(temp1[i])
for i in range(len(temp2)):
	for k in range(len(a)):
		a[k].pop(temp2[i])

for i in range(len(a)):
	s = ''
	for j in range(len(a[i])):
		s += a[i][j]
	print(s)


h, w = map(int, input().split())
a = []
for i in range(h):
	a.append(list(input()))


temp1 = []
temp2 = []
for i in range(len(a)):
	ff = 0
	for j in range(len(a[i])):
		if a[i][j] == '.':
			continue
		ff = 1
	if ff == 0:
		temp1.append(i)
temp1.sort(reverse=True)
for i in range(len(a[0])):
	ff = 0
	for j in range(len(a)):
		if a[j][i] == '.':
			continue
		ff = 1
	if ff == 0:
		temp2.append(i)
temp2.sort(reverse=True)
for i in range(len(temp1)):
	a.pop(temp1[i])
for i in range(len(temp2)):
	for k in range(len(a)):
		a[k].pop(temp2[i])

for i in range(len(a)):
	s = ''
	for j in range(len(a[i])):
		s += a[i][j]
	print(s)


Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
f=lambda s:zip(*[t for t in s if'#'in t]);
for r in f(f(__import__('sys').stdin)):print(*r)

f=lambda s:zip(*[t for t in s if'#'in t]);
for r in f(f(__import__('sys').stdin)):print(*r,sep='')

Verdicts: Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())
print(a[0][0])
row = [False]*H
col = [False]*W
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end='')
        print()

def main():
    num_lines=int(input())
    H,W=[int(j) for j in input().split()]
    list=[]
    for i in range(H):
        for k in input.split():
            list.append(k) 

H, W = map(int, input().split())
a = []
for i in range(H):
    a.append(input())
row = [False]*H
col = [False]*W
for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            row[i] = True
            col[j] = True
for i in range(H):
    if row[i]:
        for j in range(W):
            if col[j]:
                print(a[i][j], end='')
        print()

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
h,w = map(int,input().split())
a = [""]*h
for i in range(h):
  a[i] = input()

row = [False]*h
column = [False]*w

for i in range(h):
  for j in range(w):
    if a[i][j] = "#":
      row[i] = True
      column[j] = True

for i in range(h):
  if row[i]:
    for j in range(w):
      if column[j]:
        print("a[i][j]",end = "")
    print()
        
    
      


h,w = map(int,input().split())
a = [""]*h
for i in range(h):
  a[i] = input()

row = [False]*h
column = [False]*w

for i in range(h):
  for j in range(w):
    if a[i][j] = "#":
      row[i] = True
      column[j] = True

for i in range(h):
  if row[i]:
    for j in range(w):
      if column[j]:
        print(a[i][j],end = "")
    print()
        
    
      


h,w = map(int,input().split())
a = [""]*h
for i in range(h):
  a[i] = input()

row = [False]*h
column = [False]*w

for i in range(h):
  for j in range(w):
    if a[i][j] == "#":
      row[i] = True
      column[j] = True

for i in range(h):
  if row[i]:
    for j in range(w):
      if column[j]:
        print(a[i][j],end = "")
    print()
        
    
      


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is a grid of squares with H horizontal rows and W vertical columns. The square at the i-th row from the top and the j-th column from the left is represented as (i, j). Each square is black or white. The color of the square is given as an H-by-W matrix (a_{i, j}). If a_{i, j} is `.`, the square (i, j) is white; if a_{i, j} is `#`, the square (i, j) is black.  Snuke is compressing this grid. He will do so by repeatedly performing the following operation while there is a row or column that consists only of white squares:    * Operation: choose any one row or column that consists only of white squares, remove it and delete the space between the rows or columns.  It can be shown that the final state of the grid is uniquely determined regardless of what row or column is chosen in each operation. Find the final state of the grid.

Submission attempts (in order):
H, W = map(int, input().split())
a = [list(input()) for i in range(H)]
a = list(zip(*[i for i in a if "#" in a]))
a = list(zip(*[i for i in a if "#" in a]))
for i in range(len(a)):
    print("".join(a[i]))

H, W = map(int, input().split())
a = [list(input()) for i in range(H)]
a = zip(*[i for i in a if "#" in a])
a = zip(*[i for i in a if "#" in a])
for i in range(len(a)):
    print("".join(a[i]))

H, W = map(int, input().split())
a=[]
for i in range(H):
    x = input()
    if "#" in x:
        a.append(list(x))
b=[i for i in zip(*a)]
c=[]
for i in range(W):
    if "#" in b[i]:
        c.append(b[i])
c=[i for i in zip(*c)]
for i in c:
    print(*i, sep="")

Verdicts: Wrong Answer

Runtime Error

Accepted