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):
h,w=map(int,input().split())
l=[]
for i in range(h):
    l.append(list(input()))
wl=[]
for i in range(h):
    wf=0
    for j in range(w):
        if l[i][j]=='.':
            wf+=1
    if wf<w:
        wl.append(i)
    
hl=[]
for i in range(w):
    hf=0
    for j in range(h):
        if l[j][i]=='.':
            hf+=1
    if hf<h:
        hl.append(i)
for i in hl:
    for j in wl:
        print(l[i][j],end='')
    print(/n)

h,w=map(int,input().split())
l=[]
for i in range(h):
    l.append(list(input()))
wl=[]
for i in range(h):
    wf=0
    for j in range(w):
        if l[i][j]=='.':
            wf+=1
    if wf<w:
        wl.append(i)
    
hl=[]
for i in range(w):
    hf=0
    for j in range(h):
        if l[j][i]=='.':
            hf+=1
    if hf<h:
        hl.append(i)
for i in hl:
    for j in wl:
        print(l[i][j],end='')
    print()


h,w=map(int,input().split())
l=[]
for i in range(h):
    l.append(list(input()))
wl=[]
for i in range(h):
    wf=0
    for j in range(w):
        if l[i][j]=='.':
            wf+=1
    if wf<w:
        wl.append(i)
    
hl=[]
for i in range(w):
    hf=0
    for j in range(h):
        if l[j][i]=='.':
            hf+=1
    if hf<h:
        hl.append(i)
for i in wl:
    for j in hl:
        print(l[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):
p,q= input().split()
a,b =(int(p), int(q))
a_list = []
count_row = 0
for i in range(a):
    c = input()
    
    if c == '.'*b:
        count_row+=1
    else:
        a_list.append(c)
for i in range(b):
    count_clm = 0
    
    for j in range(a-count):
        if a_list[j][i] == '.':
            count_clm+=1
        else:
            break
    if count_clm == (b-count_clm):
        for j in range(a-count_row):
            a_list[j].pop(i)
            
            
for i in range(a-count_row):
    print(a_list[i])

p,q= input().split()
a,b =(int(p), int(q))
a_list = []
count_row = 0
b_h ='.'*b

for i in range(a):
    c = input()
    
    if c == b_h:
        count_row+=1
    else:
        a_list.append(c)

ans_list=[]
for i in range(b):
    count_clm = 0
    
    for j in range(a-count_row):
        if a_list[j][i] == '.':
            count_clm+=1
    
    
    if count_clm == b:        
        ans_list.append(i)



for j in range(a-count_row):
    total=''
    for i in range(b):
        if i in ans_list:
            ds = 0
        else:
            total +=a_list[j][i]
            
    print(total)

p,q= input().split()
a,b =(int(p), int(q))
a_list = []
count_row = 0
b_h ='.'*b

for i in range(a):
    c = input()
    
    if c == b_h:
        count_row+=1
    else:
        a_list.append(c)

ans_list=[]
for i in range(b):
    count_clm = 0
    
    for j in range(a-count_row):
        if a_list[j][i] == '.':
            count_clm+=1
    
    
        if count_clm == (a-count_row):        
            ans_list.append(i)



for j in range(a-count_row):
    total=''
    for i in range(b):
        if i in ans_list:
            ds = 0
        else:
            total +=a_list[j][i]
            
    print(total)

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());b=[input()for i in range(h)];a=[]
for i in b:
  if i!="."*w:a.append(i)
b=[]
for i in range(w):
  s=""
  for j in a:s+=j[i]
  if s!="."*len(a):b.append(s)
for i in b:print(i)

h,w=map(int,input().split());b=[input()for i in range(h)];a=[]
for i in b:
  if i!="."*w:a.insert(0,i)
b=[]
for i in range(w):
  s=""
  for j in a:s=j[i]+s
  if s!="."*len(a):b.insert(0,s)
c=[]
for i in range(len(a)):
  s=""
  for j in b:
    s=j[i]+s
  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_list = [input() for nesya in range(h)]

gyo = [False]*h
retsu = [False]*w
for i in range(h):
  for j in range(w):
    if a_list[i][j] == '#':
      gyo[i] = True
      retsu[j] = True
for k range(h):
  if gyo[k]:
    for l in range(w):
      if retsu[l]:
        print(a_list[k][l], end='')
    print()

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

gyo = [False]*h
retsu = [False]*w
for i in range(h):
  for j in range(w):
    if a_list[i][j] == '#':
      gyo[i] = True
      retsu[j] = True
for k in range(h):
  if gyo[k]:
    for l in range(w):
      if retsu[l]:
        print(a_list[k][l], 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().strip().split(" "))

row = []
for i in range(H):
    line = input()
    if line.count(".") == W:
        continue
    row.append(line)

print(row)
row_count = len(row)
ans = [[] for i in range(row_count)]
for i in range(W):
    tmp = []
    for j in range(row_count):
        tmp.append(row[j][i])
    if tmp.count(".") == row_count:
        continue
    else:
        for index, c in enumerate(tmp):
            ans[index].append(c)
for i in ans:
    print("".join(i))


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

row = []
for i in range(H):
    line = input()
    if line.count(".") == W:
        continue
    row.append(line)

row_count = len(row)
ans = [[] for i in range(row_count)]
for i in range(W):
    tmp = []
    for j in range(row_count):
        tmp.append(row[j][i])
    if tmp.count(".") == row_count:
        continue
    else:
        for index, c in enumerate(tmp):
            ans[index].append(c)
for i in ans:
    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())
X = []
res = []
F = [True] * W

for i in range(H):
  x = list(input())
   
  if x.count("#") != 0:
    X.append(x)

  for j in range(W):
    if x[j] == "#":
      F[j] = False
      break

for k in range(len(X)):
  r = ""
  for l in range(W):
    if not F[l]:
      r += (X[k][l])
  print(r)

H, W = map(int, input().split())
X = []
res = []
F = [True] * W

for i in range(H):
  x = list(input())
   
  if x.count("#") != 0:
    X.append(x)

  for j in range(W):
    if x[j] == "#":
      F[j] = False

for k in range(len(X)):
  r = ""
  for l in range(W):
    if not F[l]:
      r += (X[k][l])
  print(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())
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[i] = 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):
import numpy as np
H,W = map(int,input().split())
L = []
for i in range(H):
    L.append(list(input()))
L = np.array(L)
L = [x for x in L if "#" in x]
L = np.rot90(L)
L = [x for x in L if "#" in x]
L = np.rot90(L,3)

for i in range(len(L)):
    print(*L[i])

h,w = map(int,input().split())
L = []
for i in range(h):
    L.append(list(input()))
L = [x for x in L if "#" in x]
L = [x for x in zip(*L)]
L = [x for x in L if "#" in x]
L = [x for x in zip(*L)]
for i in range(len(L)):
    print(*L[i],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 = [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()


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

a = [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: 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 = input()
    A.append(a)

ansW,ansH = [],[]
for hi in range(H):
    for wi in range(W):
        if A[hi][wi] == "#":
            break
    else:
        ansH.append(hi)
for wi in range(W):
    for hi in range(H):
        if A[hi][wi] == "#":
            break
    else:
        ansW.append(wi)

Ans = []
for hi in range(H):
    if hi not in ansH:
        ans = ""
        for wi in range(W):
            if wi not in ansW:
                ans += A[hi][wi]
        Ans.append(ans)

print(Ans)



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

ansW,ansH = [],[]
for hi in range(H):
    for wi in range(W):
        if A[hi][wi] == "#":
            break
    else:
        ansH.append(hi)
for wi in range(W):
    for hi in range(H):
        if A[hi][wi] == "#":
            break
    else:
        ansW.append(wi)

Ans = []
for hi in range(H):
    if hi not in ansH:
        ans = ""
        for wi in range(W):
            if wi not in ansW:
                ans += A[hi][wi]
        Ans.append(ans)

for ans in Ans:
    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())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
    l.remove([])
t = len(l)
#print(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
for z in range(t):
  l[z].remove("")
print(l)
  

h,w = map(int,input().split())
l = list(list(input()) for i in range(h))
for i in l:
  if i.count('.') ==w:
    i.clear()
l= [i for i in l if i!=[]]
#print(l)
t = len(l)
for i in range(w):
  if all (l[q][i]=="." for q in range(t)):
    for q in range(t):
      l[q][i] =""
if "" in l:
  for z in l:
    z.remove("")
for m in l:
  print("".join(m))



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

for i in range(h):
  if len(set(a[i])) == 1 and a[i][0] == d:
    a.remove(a[i])

at = np.array(a)
tr = at.T

for i in range(w):
  if len(set(tr[i])) == 1 and tr[i][0] == d:
    a.remove(tr[i])
    
att = np.array(tr)
trr = att.T

for j in range(len(trr)):
  print("".join(trr[j]))


import numpy as np

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

for i in a:
  if '#' in i:
    ans1.append(i)
    
gyouretu = np.array(ans1)
gyouretuT = gyouretu.T

for i in gyouretuT:
  if '#' in i:
    ans2.append(i)
    
ans = np.array(ans2)
answer = ans.T

for i in answer:
  print(''.join(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 = map(int, input().split())
mat = [list(map(lambda x: 0 if x == '#' else 1, input())) for _ in range(H)]
print((H - sum(all(row) for row in mat)) * (W - sum(all(row) for row in zip(*mat))))

h, k = map(int, input().split())
mat = [input() for _ in range(h)]
for _  in range(2):
    poplist = []
    for i, row in enumerate(mat):
        for x in row:
            if x == '#':
                break
        else:
            poplist.append(i)
    poplist.reverse()
    for i in poplist:
        mat.pop(i)
    poplist = []
    mat = [x for x in zip(*mat)]
for row in mat:
    print(''.join(row))

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 = (int(i) for i in input().split())
e = [input() for i in range(H)] 

new_e = []
for row in e:
    if row.count("#") > 0:
        new_e.append(row)

not_use_col = list(range(W))
use_col = []
for row in new_e:
    for col in not_use_col:
        if row[col] == "#":
            use_col.append(not_use_col.pop(col))
            break

for row in new_e:
    x=""
    for col in use_col:
        x += row[col]
    print(x)



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

new_e = []
for row in e:
    if row.count("#") > 0:
        new_e.append(row)

use_col = []
for row in new_e:
    for col in range(W):
        if row[col] == "#" and col not in use_col:
            use_col.append(col)
            
for row in new_e:
    x=""
    for col in sorted(use_col):
        x += row[col]
    print(x)



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):
/*  ex5_3
    Graku   */
#include<stdio.h>

int main(void) {
    int height, width;
    scanf("%d %d", &height, &width);
    char matrix[height][width];
    for (int row = 0; row < height; ++row) {
        for (int col = 0; col < width; ++col) {
            scanf(" %c", &matrix[row][col]); //don't read "\n"
        }
    }

    int blank_rows[height], blank_cols[width]; //blank -> 0, not blank -> 1
    for (int row = 0; row < height; ++row) { //find blank rows
        int flag = 0;
        for (int col = 0; col < width; ++col) {
            if ('#' == matrix[row][col]) { //not blank
                flag = 1;
                break;
            }
        }
        blank_rows[row] = flag;
    }
    for (int col = 0; col < width; ++col) { //find blank columns
        int flag = 0;
        for (int row = 0; row < height; ++row) {
            if ('#' == matrix[row][col]) { //not blank
                flag = 1;
                break;
            }
        }
        blank_cols[col] = flag;
    }

    for (int row = 0; row < height; row++) {
        if (blank_rows[row]) { //if row is not blank
            for (int col = 0; col < width; ++col) {
                if (blank_cols[col]) { //if column is not blank
                    printf("%c", matrix[row][col]);
                }
            }
            printf("\n");
        }
    }

    return 0;
}

height, width = map(int, input().split())
lis = [[0 for i in range(width)] for i in range(height)]
for i in range(height):
    lis[i] = input()

blank_rows = []
for row in range(height):
    if not "#" in lis[row]:
        blank_rows.append(row)

blank_cols = []
for col in range(width):
    flag = 1
    for row in range(height):
        if "#" == lis[row][col]:
            flag = 0
            break
    if flag:
        blank_cols.append(col)

for row in range(height):
    out = ""
    if not row in blank_rows:
        for col in range(width):
            if not col in blank_cols:
                out += lis[row][col]
    if not out == "":
	    print(out)

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 = input().split()
H = int(H)
W = int(W)

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

a = [i for i in a if "#" in i]
b = ["".join([for a[i]]) for i in range(H) for j in a]
b = [i for i in b if "#" in i]

a = ["".join([for a[i]]) for i in range(len(b)) for j in b]

for i in a:
  print(i)

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

a = [i for i in As if "#" in i]
b = ["".join(j[i] for j in a) for i in range(W)]
b_ = [i for i in b if "#" in i]
a_ = ["".join(j[i] for j in b_) for i in range(len(b_[0]))]

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 = map(int, input().split())
G = [list(input()) for _ in range(H)]
v = [g for g in G if g.count('.') != W]
print(v)
for i in reversed(range(W)):
    chk = True
    for vv in v:
        if vv[i] == '#':
            chk = False
            break
    if chk:
        for vv in v:
            vv.pop(i)
for vv in v:
    print(''.join(vv))

H, W = map(int, input().split())
G = [list(input()) for _ in range(H)]
v = [g for g in G if g.count('.') != W]
for i in reversed(range(W)):
    chk = True
    for vv in v:
        if vv[i] == '#':
            chk = False
            break
    if chk:
        for vv in v:
            vv.pop(i)
for vv in v:
    print(''.join(vv))

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):
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

#a = [list(input()) for _ in range(n)]

h,w = map(int, input().split())
a = [input() for _ 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]:
        for j in range(w):
            if y[j]:
                print(a[i][j],end="")
        print("")





#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))

#a = [list(input()) for _ in range(n)]

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

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

field=[i for i in field if "#" in i]

field=np.array(field)
#print(field)

field=np.rot90(field,k=1)
field=field.tolist()

field=[i for i in field if "#" in i]

field=np.rot90(field,k=-1)
field=field.tolist()

print(field)

import numpy as np

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

field=[i for i in field if "#" in i]

field=np.array(field)
#print(field)

field=np.rot90(field,k=1)
field=field.tolist()

field=[i for i in field if "#" in i]

field=np.rot90(field,k=-1)
field=field.tolist()

#print(field)
for i in field:
    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())
tmp = True
A = []
B = []
for i in range(H):
    a = list(input())
    if a != ['.']*W:
        A.appned(a)
for i in range(W):
    cnt = 0
    for j in range(len(A)):
        if A[j][i] != '.':
            cnt += 1
    if cnt == 0:
        B.insert(0,i)
for i in range(len(A)):
    for j in range(len(B)):
        del A[i][B[j]]
for i in range(len(A)):
    ans = "".join(A[i])
    print(ans)



H,W = map(int,input().split())
A = []
B = []
for i in range(H):
    a = list(input())
    if a != ["."]*W:
        A.append(a)
for i in range(W):
    cnt = 0
    for j in range(len(A)):
        if A[j][i] != '.':
            cnt += 1
    if cnt == 0:
        B.insert(0,i)
for i in range(len(A)):
    for j in range(len(B)):
        del A[i][B[j]]
for i in range(len(A)):
    ans = "".join(A[i])
    print(ans)



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

matrix = [list(map(int,input().replace("#", "1").replace(".","0"))) for _ in range(H)]

ans = []
temp = []

for row in matrix:
    if sum(row) != 0:
        ans.append(row)

for row in zip(*ans):
    temp.append(row)

ans = []
for row in temp:
    if sum(row) != 0:
        ans.append(row)
        
temp = []
for row in zip(*ans):
    temp.append(row)


for row in temp:
    res = list(map(str,row))
    res = ",".join(res).replace("1","#").replace("0",".").split(",")
    print(*res)
    



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

temp = [list(map(int,input().replace("#", "1").replace(".","0"))) for _ in range(H)]

cnt = 0


while cnt != 2:
    ans = []
    s = 0
    for row in temp:
        if sum(row) != 0:
            ans.append(row)
        else:
            s += 1
    if s == 0:
        cnt += 1
    else:
        cnt = 0
        
            
    temp = []
    for row in zip(*ans):
        temp.append(row)
    
    ans = []
    s = 0
    for row in temp:
        if sum(row) != 0:
            ans.append(row)
        else:
            s += 1
    if s == 0:
        cnt += 1
    else:
        cnt = 0
            
    temp = []
    for row in zip(*ans):
        temp.append(row)


for row in temp:
    res = list(map(str,row))
    res = ",".join(res).replace("1","#").replace("0",".").split(",")
    print(*res)
    



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

temp = [list(map(int,input().replace("#", "1").replace(".","0"))) for _ in range(H)]

cnt = 0


while cnt != 2:
    ans = []
    s = 0
    for row in temp:
        if sum(row) != 0:
            ans.append(row)
        else:
            s += 1
    if s == 0:
        cnt += 1
    else:
        cnt = 0
        
            
    temp = []
    for row in zip(*ans):
        temp.append(row)
    
    ans = []
    s = 0
    for row in temp:
        if sum(row) != 0:
            ans.append(row)
        else:
            s += 1
    if s == 0:
        cnt += 1
    else:
        cnt = 0
            
    temp = []
    for row in zip(*ans):
        temp.append(row)


for row in temp:
    res = list(map(str,row))
    res = ",".join(res).replace("1","#").replace("0",".").split(",")
    print("".join(res))
    



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=[list(input()) for i in range(w)]
answ=[]
ansh=[]
for i in range(w):
  if not all([a=="." for a in A[i]]):
    answ.append(i)
for j in range(h):
  if not all([A[i][j]=="." for i in range(w)]):
    ansh.append(j)
for i in answ:
  for j in ansh:
    print(A[i][j],end="")
  print("\n")
    

h,w=map(int,input().split())
A=[list(input()) for i in range(h)]
answ=[]
ansh=[]
for i in range(h):
  if not all([a=="." for a in A[i]]):
    answ.append(i)
for j in range(w):
  if not all([A[i][j]=="." for i in range(h)]):
    ansh.append(j)
for i in answ:
  for j in ansh:
    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())
grid=[list(input())  for i in range(h)]
tag=[]
for i in range(w):
    a=[grid[j][i] for j in range(h)]
    if not "#" in a:tag.append(i)
for i in tag[::-1]:
    for j in range(h):
        grid[j].pop(i)
for i in grid:
    if "#" in i:print(*i)
        

h,w=map(int,input().split())
d=[list(input())  for i in range(h)]
for i in range(w)[::-1]:
    if not "#" in [d[j][i] for j in range(h)]:
        for j in range(h):del d[j][i]
for i in d:
    if "#" in i:print(*i,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())
l=[]
n=0
m=0
cou=0
for i in range(h):
    x=input()
    if x==("."*w):
        cou+=1
        continue
    l.append(list(x))
for i in range(w):
    k=0
    for j in range(h-cou-1):
        if l[j][i]=="#":
            break
        else:
            k+=1
    if k==h-cou:
        for d in range(h-cou):
            del l[d][i]
for i in range(h-cou):
    l[i]="".join(l[i])
    print(l[i])



h,w=map(int,input().split())
a=[list(input()) for i in range(h)]
#print(a)
H=[]
W=[]
for i in range(h):
    count=0
    for j in range(w):
        if a[i][j]==".":
            count+=1
    if count==w:
        H.append(i)
for i in range(w):
    count=0
    for j in range(h):
        if a[j][i]==".":
            count+=1
    if count==h:
        W.append(i)
for i in range(1,len(H)+1):
    for j in range(w):
        a[H[-1*i]][j]=""
for i in range(1,len(W)+1):
    for j in range(h):
        a[j][W[-1*i]]=""

for i in range(h):
    if not ("." in a[i] or "#" in a[i]):
        continue
    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 = list(map(int, input().strip().split(" ")))

field = []
hist = [0 for w in range(W)]

def shrink():
    newField = []
    for h in range(H):
        line = []
        for w in range(W):
            if(hist[w] != H):
                line.append(field[h][w])
        newField.append(line)        
    return newField            

for h in range(H):
    line = list(input().strip())
    if(line.count(".") != len(line)):
        field.append(list(line))
        for w in range(W):
            hist[w] += 1 if field[-1][w] == "." else 0 
H = len(field)

newField = shrink()

for h in newField:
 "".join(h)

H, W = list(map(int, input().strip().split(" ")))

field = []
hist = [0 for w in range(W)]

def shrink():
    newField = []
    for h in range(H):
        line = []
        for w in range(W):
            if(hist[w] != H):
                line.append(field[h][w])
        newField.append(line)        
    return newField            

for h in range(H):
    line = list(input().strip())
    if(line.count(".") != len(line)):
        field.append(list(line))
        for w in range(W):
            hist[w] += 1 if field[-1][w] == "." else 0 
H = len(field)

newField = shrink()

for h in newField:
    print("".join(h))

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)]
low = [False]*H
col= [False]*W
for l in range(H):
    for c in range(W):
        if A[l][c] == "#":
            low[l] = True
            col[c] = True
for l in range(H):
    if low[l] ==True:
        for c in range(W):
            if col[c]==True:
                print("#",end="")
        print()



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

row = [False]*H
col = [False]*W
for i in range(H):
    for j in range(W):
        if glid[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(glid[i][j],end="")

        print()

Verdicts: Wrong Answer

Accepted