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 sys
H_W = list(map(int,input().split()))
H = H_W[0]
W = H_W[1]
b = [[0 for i in range(W)] for j in range(H)]
a = [[str(c) for c in l.strip()] for l in sys.stdin]


for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            b[i][j] = 1


w = [0] * W
h = [0] * H
for i in range(H):
    for j in range(W):
        h[i] = h[i] + b[i][j]
        w[j] = w[j] + b[i][j]

#print(h)
#print(w)

i = 0
c = 0
j = 0
for i in range(H):
    if h[i] == 0:
        del a[j]
        H = H - 1
        j = j - 1
    j = j + 1
#print(a)

k = 0
for i in range(W):
    if w[i] == 0:
        for j in range(H):
            del a[j][k]
            print(a)
        W = W - 1
        k = k - 1
    k = k + 1
#print(a)

for i in range(H):
    flag = 0
    for j in range(W):
        if flag == 0:
            ans = a[i][j]
            flag = 1
        else:
            ans = ans + a[i][j]
    print(ans)
    

import sys
H_W = list(map(int,input().split()))
H = H_W[0]
W = H_W[1]
b = [[0 for i in range(W)] for j in range(H)]
a = [[str(c) for c in l.strip()] for l in sys.stdin]


for i in range(H):
    for j in range(W):
        if a[i][j] == '#':
            b[i][j] = 1


w = [0] * W
h = [0] * H
for i in range(H):
    for j in range(W):
        h[i] = h[i] + b[i][j]
        w[j] = w[j] + b[i][j]

#print(h)
#print(w)

i = 0
c = 0
j = 0
for i in range(H):
    if h[i] == 0:
        del a[j]
        H = H - 1
        j = j - 1
    j = j + 1
#print(a)

k = 0
for i in range(W):
    if w[i] == 0:
        for j in range(H):
            del a[j][k]
        W = W - 1
        k = k - 1
    k = k + 1
#print(a)

for i in range(H):
    flag = 0
    for j in range(W):
        if flag == 0:
            ans = a[i][j]
            flag = 1
        else:
            ans = ans + a[i][j]
    print(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):
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w = map(int, readline().split())
a = [input() for i in range(h)]
ans = []
memo_x = []
memo_y = []
for i in range(h):
    cnt = 0
    print(a[i])
    for j in range(w):
        if a[i][j] == '.':
            cnt += 1
    if cnt == w:
        memo_x.append(i)
for i in range(w):
    cnt = 0
    for j in range(h):
        if a[j][i] == '.':
            cnt += 1
    if cnt == h:
        memo_y.append(i)
for i in range(h):
    if i not in memo_x:
        b = ''
        for j in range(w):
            if j not in memo_y:
                b += a[i][j]
        ans.append(b)
for i in range(len(ans)):
    print(ans[i])


import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

h, w = map(int, readline().split())
a = [readline().rstrip().decode() for i in range(h)]
memo_w = [False] * h
memo_h = [False] * w
for i in range(h):
    flag = True
    for j in range(w):
        if a[i][j] == '#':
            flag = False
            break
    if flag:
        memo_w[i] = True
for i in range(w):
    flag = True
    for j in range(h):
        if a[j][i] == '#':
            flag = False
            break
    if flag:
        memo_h[i] = True
for i in range(h):
    if not memo_w[i]:
        ans = ''
        for j in range(w):
            if not memo_h[j]:
                ans += a[i][j]
        print(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):
H,W = map(int,input().split())
mass = [list(input()) for _ in range(H)]

for i in range(H):
  if "#" not in mass[i]:
    mass.pop(i)
  
H = len(mass)

new_mass = [[] for _ in range(W)]

for j in mass:
  for i, k in enumerate(j):
    new_mass[i].append(k)
    
for l in range(W):
  if "#" not in new_mass[l]:
    new_mass.pop(l)
    
mass = [[] for _ in range(H)]

for n in new_mass:
  for i, m in enumerate(n):
    mass[i].append(m)
    
print(mass)

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

for j in range(H):
  for k in range(W):
    if A[j][k] == "#":
      row[j] = True
      col[k] = True
      
for l in range(H):
  if row[l]:
    for m in range(W):
      if col[m]:
        print(A[l][m], 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 = [input() for i in range(H)]

y = [False]*H
x = [False]*W

for i in range(H):
    for j in range(W):
        print(a[i][j])
        if a[i][j] == "#":
            y[i] = True
            x[j] = True
            
for i in range(H):
    if y[i] == True:
        for j in range(W):
            if x[j] == True:
                print(a[i][j],end="")
        print()

H,W = map(int,input().split())

a = [input() for i in range(H)]

y = [False]*H
x = [False]*H

for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            y[i] == True
            x[j] == True
            
for i in range(H):
    if y[i] == True:
        for j in range(W):
            if x[j] == True:
                print(a[i][j],end="")
        print()

H,W = map(int,input().split())

a = [input() for i in range(H)]

y = [False]*H
x = [False]*W

for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            y[i] == True
            x[j] == True
            
for i in range(H):
    if y[i] == True:
        for j in range(W):
            if x[j] == True:
                print(a[i][j],end="")
        print()

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

y = [False]*H
x = [False]*W

for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            y[i] = True
            x[j] = True
            
for i in range(H):
    if y[i] == True:
        for j in range(W):
            if x[j] == True:
                print(a[i][j],end="")
        print()

Verdicts: Wrong Answer

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):
import numpy as np
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

a = np.array(a).reshape(h, w)
a = [i for i in a if "#" in i]

a = np.array(a).T
a = [i for i in a if "#" in i]

a = np.array(a).T
for i in a:
    print(*i)


import numpy as np
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

a = np.array(a).reshape(h, w)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a)
for i, v in enumerate(a):
    if "#" not in v:
        a = np.delete(a, i, 0)

a = np.rot90(a, 3)
for i in a:
    print(*i)

import numpy as np
h, w = map(int, input().split())
a = [list(input()) for _ in range(h)]

a = np.array(a).reshape(h, w)
a = [i for i in a if "#" in i]

a = np.array(a).T
a = [i for i in a if "#" in i]

a = np.array(a).T
for i in a:
    print("".join(i))


Verdicts: Wrong Answer

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):
from collections import Counter
import numpy as np
H, W = map(int, input().split())
a = []
r_idx = []
c_idx = []
#a.shape = (H, W)
for i in range(H):
    line = list(input())
    ct = Counter(line).most_common()
    if ct[0][1] != W and ct[0][0]==".":
        r_idx.append(i)
    a.append(line)
a = np.array(a).T
#a.shape = (W, H)
b = []
for i in range(W):
    ct = Counter(a[i]).most_common()
    if ct[0][1] == H and ct[0][0]==".":
        continue
    b.append(a[i])

b = np.array(b).T
c = []
for idx in r_idx:
    c.append(b[idx])

for i in range(len(c)):
    print("".join(c[i]))


from collections import Counter
import numpy as np
H, W = map(int, input().split())
a = []
r_idx = []
c_idx = []
#a.shape = (H, W)
for i in range(H):
    line = list(input())
    ct = Counter(line).most_common()
    if not (ct[0][1] == W and ct[0][0] == "."):
        r_idx.append(i)
    a.append(line)
a = np.array(a).T
#a.shape = (W, H)
b = []
for i in range(W):
    ct = Counter(a[i]).most_common()
    if ct[0][1] == H and ct[0][0]==".":
        continue
    b.append(a[i])

b = np.array(b).T
c = []
for idx in r_idx:
    c.append(b[idx])

for i in range(len(c)):
    print("".join(c[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())
M=[list(input()) for i in range(H)]
for i in range(H):
    if not'#'in M[i]:
        s=[]
        for x in range(W):
            t=[M[y][x] for y in range(H)]
            if not'#'in t: s.append(M[i][x])
        print(''.join(s))

H,W=map(int,input().split())
M=[list(input()) for i in range(H)]
for i in range(H):
    if '#'in M[i]:
        s=[]
        for x in range(W):
            t=[M[y][x] for y in range(H)]
            if '#'in t: s.append(M[i][x])
        print(''.join(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):

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() 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()

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=[[j for j in input()] for i in range(h)]
for i in range(h):
  if a[i].count('.')==w:
    a[i]=[]
while [] in a:
  a.remove([])
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=='.':
      c+=1
  if c==len(a):
    for j in range(len(a)):
      a[j][i]='!'
for i in range(len(a)):
  while '!' in a[i]:a
    a[i].remove('!')
for i in a:
  print(*i,sep='')

h,w=map(int,input().split())
a=[[j for j in input()] for i in range(h)]
for i in range(h):
  if a[i].count('.')==w:
    a[i]=[]
while [] in a:
  a.remove([])
for i in range(w):
  c=0
  for j in range(len(a)):
    if a[j][i]=='.':
      c+=1
  if c==len(a):
    for j in range(len(a)):
      a[j][i]='!'
for i in range(len(a)):
  while '!' in a[i]:
    a[i].remove('!')
for i in a:
  print(*i,sep='')

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(i) for i in input().split())
a,b = [],["" for i in range(w)]
for _ in range(h):
	s = input()
	if s.count("#")!=0:
		a.append(s)
		for i in range(w): b[i]+=s[i]
num,ans = [True for i in range(w)],["" for i in range(len(a))]
for i in range(w):
	if b[i].count("#")==0: num[i] = False
for i in range(len(a)):
	for j in range(w):
		if num[j]: ans[i]+=a[i][j]
for i in ans: print(ans)

h,w = (int(i) for i in input().split())
a,b = [],["" for i in range(w)]
for _ in range(h):
	s = input()
	if s.count("#")!=0:
		a.append(s)
		for i in range(w): b[i]+=s[i]
num,ans = [True for i in range(w)],["" for i in range(len(a))]
for i in range(w):
	if b[i].count("#")==0: num[i] = False
for i in range(len(a)):
	for j in range(w):
		if num[j]: ans[i]+=a[i][j]
for i in ans: print(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())
a = [list(input()) for i 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]:
        ans = ""
        for j in range(w):
            if col[j]:
                ans.join(a[i][j])
        print(ans)

h, w = map(int, input().split())
a = [list(input()) for i 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]:
        ans = ""
        for j in range(w):
            if col[j]:
                ans.join(a[i][j])
        if "#" in ans:
            print(ans)

h, w = map(int, input().split())
a = [list(input()) for i 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()

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):
h,w = map(int,input().split())
li = []
for i in range(h):
    a = list(input().split())
    li.append(a)
li2 = li.copy()
c = 0
for i in range(h):
    for j in range(w):
        c = 0
        if li[i][j] == ".":
            continue
        elif li[i][j] == "#":
            c = 1
            break
    if c == 0:
        li[i] = ["a"] * w
d = 0
n = []
for i in range(w):
    for j in range(h):
        d = 0
        if li[j][i] == "." or li[j][i] == "a":
            continue
        else:
            d = 1
            break
    if d == 0:
        n.append(i)
for i in n:
    for j in range(h):
        li[j][i] = "a"

for i in range(h):
    grid = ""
    for x in li[i]:
        if x != "a":
            grid += x
    print(grid)

h,w = map(int,input().split())
li = []
for i in range(h):
    a = list(input())
    li.append(a)
li2 = li.copy()
c = 0
for i in range(h):
    for j in range(w):
        c = 0
        if li[i][j] == ".":
            continue
        elif li[i][j] == "#":
            c = 1
            break
    if c == 0:
        li[i] = ["a"] * w
d = 0
n = []
for i in range(w):
    for j in range(h):
        d = 0
        if li[j][i] == "." or li[j][i] == "a":
            continue
        else:
            d = 1
            break
    if d == 0:
        n.append(i)
for i in n:
    for j in range(h):
        li[j][i] = "a"

for i in range(h):
    grid = ""
    for x in li[i]:
        if x != "a":
            grid += x
    if grid != "":
        print(grid)

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())
maps = []
for i in range(h):
	maps.append(str(input()))
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if maps[i][j] == '#':
			row[i] = True
			col[j] = True

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


h, w = map(int, input().split())
maps = []
for i in range(h):
	maps.append(str(input()))
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if maps[i][j] == '#':
			row[i] = True
			col[j] = True

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


h,w = map(int,input().split())
M = []
for i in range(h):
        k = str(input())
        if "
                M.append(k)

N = []
for i in range(w):
        s = ""
        for j in range(len(M)):
                s += M[j][i]
        if "#" not in s:
                N.append(i)

for i in range(len(N)):
        for j in range(len(M)):
                M[j] = M[j][0:N[i]]+M[j][N[i]+1:]
                
for i in range(len(M)):
        print(M[i])

h, w = map(int, input().split())
maps = []
for i in range(h):
	maps.append(str(input()))
row = [False] * h
col = [False] * w
for i in range(h):
	for j in range(w):
		if maps[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(maps[i][j], end = '')
		print()


Verdicts: Runtime Error

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):
h, w = map(int, input().split())

arr_all = []
arr_del = []
for i in range(h):
    arr_w = input()
    if list(set(arr_w)) == ["."]:
        continue
    else:
        arr_all.append(arr_w)
        arr_del.append([])

print(arr_all)

d = []
for i in range(w):
    for j in range(len(arr_all)):
        if arr_all[j][i] == ".":
            if i == w - 1:
                break
            else:
                continue
        else:
            d.append(i)
            break

for j in range(len(arr_all)):
    for i in d:
        arr_del[j] += arr_all[j][i]

print(arr_del)

for i in range(len(arr_all)):
    print(''.join(arr_del[i]))

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

arr_all = []
arr_del = []
for i in range(h):
    arr_w = input()
    if list(set(arr_w)) == ["."]:
        continue
    else:
        arr_all.append(arr_w)
        arr_del.append([])


d = []

for i in range(w):
    for j in range(len(arr_all)):
        if arr_all[j][i] == ".":
            if j == w - 1:
                break
            else:
                continue
        else:
            d.append(i)
            break

for j in range(len(arr_all)):
    for i in d:
        arr_del[j] += arr_all[j][i]


for i in range(len(arr_all)):
    print(''.join(arr_del[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):
import numpy as np
h, w = map(int, input().split())
f = np.array([list(input()) for _ in range(h)])

f = f[~np.all(f=='.', axis=1)]
f = f[:, ~np.all(f=='.', axis=0)]

for x in f:
    print(*x)

import numpy as np
h, w = map(int, input().split())
f = np.array([list(input()) for _ in range(h)])

while True:
    f_shape = f.shape
    f = f[~np.all(f=='.', axis=1)]
    f = f[:, ~np.all(f=='.', axis=0)]
    if f.shape == f_shape:
        break

for x in f:
    print(*x)

import numpy as np
h, w = map(int, input().split())
f = np.array([list(input()) for _ in range(h)])

f = f[~np.all(f=='.', axis=1), :]
f = f[:, ~np.all(f=='.', axis=0)]

print('\n'.join(''.join(row) for row in f))

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())

l=[]
for i in range(H):
  x=input()
  if x!='.'*W:
    l.append(x)

rm=[]
for i in range(W):
  f=True
  for j in range(len(l)):
    if l[j][i]=='#':
      f=False

  if f:
    rm.append(i)
print()
a=[]
print(l)
print(rm)
for x in l:
  for i in rm[::-1]:
    print(i)
    x=x[:i]+x[i+1:]
  a.append(''.join(x))

print()
for i in range(len(a)):
  print(''.join(a[i]))


H,W=map(int,input().split())

l=[]
for i in range(H):
  x=input()
  
  if x!='.'*W:
    l.append(x)

rm=[]
for i in range(W):
  
  f=True
  for j in range(len(l)):
    if l[j][i]=='#':
      f=False

  
  if f:
    rm.append(i)

a=[]
for x in l:
  for i in rm[::-1]:
    x=x[:i]+x[i+1:]
  a.append(''.join(x))


for i in range(len(a)):
  print(''.join(a[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())
G = []

for i in range(H):
  line = input()
  if line != '.' * W:
    G.append(line)

H = len(G)
ans = []

for i in range(W):
  flg = False
  tmp = ''
  for j in range(H):
    if G[j][i] == '.':
      flg = False
    else:
      flg = True
    tmp += G[j][i]
  if flg == True:
    ans.append(tmp)

print(ans)

H, W = map(int, input().split())
G = []

for i in range(H):
  line = input()
  if line != '.' * W:
    G.append(line)

H = len(G)
ans = []

for i in range(W):
  flg = False
  tmp = ''
  for j in range(H):
    if G[j][i] == '.':
      flg = False
    else:
      flg = True
    tmp += G[j][i]
  if tmp != '.' * H:
    ans.append(tmp)

for i in range(H):
  tmp = ''
  for j in range(len(ans)):
    tmp += ans[j][i]
  print(tmp)

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())
hw=[]
for _ in range(H):
    hw.append(input())

yoko_list=[]
tate_list=[]
for i in range(H):
    for j in range(W):
        if hw[i][j]=="#":
            break
        elif j==W-1:
            yoko_list.append(i)

for i in range(W):
    for j in range(H):
        if hw[j][i]=="#":
            break
        elif j==H-1:
            tateH,W=map(int,input().split())

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

yoko_list=[]
tate_list=[]
for i in range(H):
    for j in range(W):
        if hw[i][j]=="#":
            break
        elif j==W-1:
            yoko_list.append(i)

for i in range(W):
    for j in range(H):
        if hw[j][i]=="#":
            break
        elif j==H-1:
            tate_list.append(i)

for i in range(H):
    if not i in yoko_list:
        p=0
        for j in range(W):
            if not j in tate_list:
                p+=1
                if p==W-len(tate_list):
                    print(hw[i][j])
                else:
                    print(hw[i][j],end="")

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())
rs = [input() for _ in range(h)]
rows = []


for r in rs:
  if '#' in r: rows.append(r)

print(rows)
ansrows = zip(*[c for c in zip(*rows) if '#' in c])

for r in list(ansrows):
  print(''.join(r))

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


for r in rs:
  if '#' in r: rows.append(r)

ansrows = zip(*[c for c in zip(*rows) if '#' in c])

for r in list(ansrows):
  print(''.join(r))

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() )

h_set = set()
w_set = set()
B = [input() for i in range(H)]
for i in range(H):
  for j in range(W):
    if B[i][j] == '#':
      w_set.add(j)
      h_set.add(i)

for i in range(H):
  if i in h_set:
    for j in range(W):
      t = ""
      if j in w_set:
        t += B[i][j]
    print(t)

H, W = map( int, input().split() )

h_set = set()
w_set = set()
for i in range(H):
  r = input()
  for j in range(W):
    if r[j] == '#':
      w_set.add(j)
      h_set.add(i)
print( len(h_set) * len(w_set) )

H, W = map( int, input().split() )

h_set = set()
w_set = set()
B = [input() for i in range(H)]
for i in range(H):
  for j in range(W):
    if B[i][j] == '#':
      w_set.add(j)
      h_set.add(i)
      
for i in range(H):
  if i in h_set:
    t = ""
    for j in range(W):
      if j in w_set:
        t += B[i][j]
    print(t)

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):
input = get_input(INPUT)

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

for i in range(h)[::-1]:
    if "#" not in a[i]:
        del a[i]
        h -= 1

n = []
for j in range(w):
    m = ["".join(t[j] for t in a)]
    if "#" in m[0]:
        n += m

for k in range(h):
    print("".join(u[k] for u in n))

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

for i in range(h)[::-1]:
    if "#" not in a[i]:
        del a[i]
        h -= 1

n = []
for j in range(w):
    m = ["".join(t[j] for t in a)]
    if "#" in m[0]:
        n += m

for k in range(h):
    print("".join(u[k] for u in n))


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):
from collections import defaultdict
d = defaultdict(int)
H, W = map(int, input().split())
L = []
for i in range(H):
    L.append(input())
cl = L[:]

al = []
for i in cl:
    if ('#' in i):
        al.append(i)
# print(al)

if (len(al) == 0):
    print()
    exit()

for i in range(W):
    d[i] = True

for i, v in enumerate(al):
    for k, j in enumerate(v):
        if (j == '.'):
            continue
        else:
            d[k] = False
for i, v in d.items():
    if (v):
        for j, k in enumerate(al):
            if (i == 0):
                al[j] = ' ' + k[1:]
            elif ((i == len(al) - 1) and (len(al) != 1)):
                al[j] = k[:i - 1] + ' '
            else:
                al[j] = k[:i] + ' ' + k[i + 1:]

for i in al:
    print(i.replace(' ', ''))


from collections import defaultdict
d = defaultdict(int)
H, W = map(int, input().split())
L = []
for i in range(H):
    L.append(input())
cl = L[:]

al = []
for i in cl:
    if ('#' in i):
        al.append(i)

if (len(al) == 0):
    print()
    exit()

for i in range(W):
    d[i] = True

for i, v in enumerate(al):
    for k, j in enumerate(v):
        if (j == '.'):
            continue
        else:
            d[k] = False
for i, v in d.items():
    if (v):
        for j, k in enumerate(al):
            if (i == 0):
                al[j] = ' ' + k[1:]
            elif ((i == W - 1) and (W != 1)):
                al[j] = k[:i] + ' '
            else:
                al[j] = k[:i] + ' ' + k[i + 1:]
for i in al:
    print(i.replace(' ', ''))


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 i in range(H)]

v_list = []
reverse_list = [""]*W
h_list = []

for i in range(H):
    if "#" in A[i]:
        v_list.append(A[i])

print(v_list)

for i in range(W):
    for j in range(len(v_list)):
        reverse_list[i] = reverse_list[i] + v_list[j][i]

for i in range(W):
    if "#" in reverse_list[i]:
        h_list.append(reverse_list[i])

result_list = [""]*(len(h_list[0]))

for i in range(len(h_list[0])):
    for j in range(len(h_list)):
        result_list[i] = result_list[i] + h_list[j][i]

for s in result_list:
    print(s)


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

v_list = []
reverse_list = [""]*W
h_list = []


def delete(h, input, output):
    for i in range(h):
        if "#" in input[i]:
            output.append(input[i])


def reverse(w, h, input, output):
    for i in range(w):
        for j in range(h):
            output[i] = output[i] + input[j][i]

delete(H, A, v_list)

reverse(W, len(v_list), v_list, reverse_list)

delete(W, reverse_list, h_list)

result_list = [""]*(len(h_list[0]))

reverse(len(h_list[0]), len(h_list), h_list, result_list)

for s in result_list:
    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):
H, W = map(int, input().split())
a = []
for i in range(H):
    list = [i for i in input()]
    a.append(list)
column = [int(i) for i in range(W)]
row = [int(i) for i in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            if i in row:
                row.remove(i)
            if j in column:
                column.remove(j)
print(column)
print(row)
for i in range(H):
    printed = False
    for j in range(W):
        if i not in row and j not in column:
            print(a[i][j], end="")
            printed = True
    if printed:
        print("")


H, W = map(int, input().split())
a = []
for i in range(H):
    list = [i for i in input()]
    a.append(list)
column = [int(i) for i in range(W)]
row = [int(i) for i in range(H)]
for i in range(H):
    for j in range(W):
        if a[i][j] == "#":
            if i in row:
                row.remove(i)
            if j in column:
                column.remove(j)
# print(column)
# print(row)
for i in range(H):
    printed = False
    for j in range(W):
        if i not in row and j not in column:
            print(a[i][j], end="")
            printed = True
    if printed:
        print("")


Verdicts: Wrong Answer

Accepted