TnT/Multi_CodeNet4Repair huggingface dataset:
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N i = map(int, input().split())
print(N-i+1)

N,i = map(int, input().split())
print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
a,b = map(int,input().split())
print(b-a+1)

a,b = map(int,input().split())
print(a-b+1)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, i = map(int, input().split())

print((n-i)+1 if n%2 == 1 else n-i)


n, i = map(int, input().split())

print(n-i+1)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int,input().split())

print(N + i - 1)

N, i = map(int,input().split())

print(N + 1 - i)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,i=map(int, input().split())
print(L-i+1)

N,i=map(int, input().split())
print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
# coding: utf-8
# Your code here!

N,A=map(int,input()split())
print(N-A+1)

# coding: utf-8
# Your code here!

N,A=map(int,input().split())
print(N-A+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, i = map(int, input())

print(n-i+1)

n, i = map(int, input().split())

print(n-i+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,i = map(int,input().split())
ans = N - i + 1-2
print(ans)


N,i = map(int,input().split())
ans = N - i + 1
print(ans)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N = int(input())
i = int(input())
print(int(N+1-i))


N = int(input())
i = int(input())
print(N+1-i)

n,i = map(int,input().split(" "))
print(n+1-i)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, I=map(int, input(). split())
print(N-i+1)


N, i=map(int, input(). split())
print(N-i+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N = int(input())
i = int(input())

print u N-i+1

N = int(input())
i = int(input())

print N-i+1

N = int(input())
i = int(input())

print u N-i+1

N = int(input())
i = int(input())

print(N-i+1)

N = int(input())
i = int(input())

print u N-i+1

n, i = map(int,input().split())
print (n+i-1)


n, i = map(int,input().split())
print (N+i-1)

N, i = map(int,input().split())

print(N-i+1)

Verdicts: Runtime Error

Runtime Error

Runtime Error

Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
l = list(map(input().split()))
print(l[0]-l[1]+1)

l = list(map(int,input().split()))
print(l[0]-l[1]+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i = map(int,input().spllit())
print(n-i+1)

n,i = map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i = map(int, input())
print(n-i+1)

n,i = map(int, input().split())
print(n-i+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n ,k = map(int(input().split()))

print(n-k+1)

n ,k = map(int,input().split())

print(n-k+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n =int(input("enter number of car_train. "))
i = int(input("enter ith from the front  of train . "))
def train(n ,i):
    if n == i:
        print (1)
    else :
        print ((n-i)+1)



train(n,i)

n=int(input())


a=int(input())


print(int(n-a+1))

a,b=map(int,input().split())
c="Wingardium Leviosa"
print(a-b+1)

Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n.i=map(int,input().split())
print(n-i+1)

n,i=map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int, input().split())
print(i - N + 1)

N, i = map(int(x), input().split())
print(i - N + 1)

N, i = map(int, input().split())
print(N - i + 1)

Verdicts: Wrong Answer

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i=list(map(int,input().split()))
print(n-i)

n,i=list(map(int,input().split()))
print(n-i+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
a, b = map(int, input().split())
print(b - a + 1)

a, b = map(int, input().split())
print(a - b + 1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,I=map(int,input().split())
print(N-I+


n,i=map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,i =map(int(),input().split())
print(N-i+1)

N,i = map(int,input().split())
print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i =map(int,input().split())
ans=0
ans=n-i+1

n,i =map(int,input().split())
ans=0
ans=n-i+1
print(ans)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = input().split(" ")
print(N - i + 1)

N, i = (int(i) for i in input().split(" "))
print(N - i + 1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,k = map(int,input().split())
x = list(map(int,input().split()))

l = 0
r = k-1
mnm = 1000100010
while r<n:
    a = abs(x[l])+abs(x[l]-x[r])
    b = abs(x[r])+abs(x[r]-x[l])
    if a<=b:
        if a < mnm:
            mnm = a
    else:
        if b < mnm:
            mnm = b
    l += 1
    r += 1
print(mnm)

n,i = map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
print(eval("-".join(input())))

print(eval("-".join(input())+"+1"))

print(eval(input().replace(" ","-"))+1)

Verdicts: Wrong Answer

Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
s=list(map(int,input().split()))
    print(s[0]-s[1]+1)

a,b=map(int,input().split())
print(a+1-b)
//Source code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 charactersSource code should be longer than 50 characters

def train(n,m):
    return n-m
n,m= map(int,input().split())
train(n,m)

N= int(input())
i= int(input())

j=N-i+1

print (j)
    


def train(n,m):
    return (n-m)+1
n,m= map(int,input().split())
train(n,m)

x=input()
y=x.split()
y = list(map(int,y))
print(y[0]-y[1]+1)


Verdicts: Runtime Error

Runtime Error

Wrong Answer

Runtime Error

Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, i = map(int,input().split())

print(n - i)


n, i = map(int,input().split())

print(n - i + 1)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
a, b = map(int, input().split())
print(a - b - 1)

a, b = map(int, input().split())
print(a - b + 1)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N, i = map(int, input().split())
print(N - i +　1)

N, i = map(int, input().split())
print(N - i + 1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
a, b=map(int, input().split())
print(a+b-1)

a, b=map(int, input().split())
print(a-b+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
i,j=map(int, input())
print(i-j+1)

i,j=map(int, input().split())
print(i-j+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i = (map,int(input()))
print(n-i+1)


n,i = map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
s = input()
s_list = list(s)
print(s_list)
l = len(s_list) - 2
a = s_list[0] + str(l) + s_list[-1]
print(a)


d = list(map(int, input().split()))
N = d[0]
i = d[1]
print(N-i+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
def main():
    N = int(input())
    i = int(input())
    output = solve(N, i)
    print(output)
    return

#________________________________________
#  Solve
#________________________________________
def solve(N, i):
    
    return N - i + 1
#________________________________________


if __name__ == "__main__":
    main()

def main():
    N, i = list(map(int, input().split(" ")))
    output = solve(N, i)
    print(output)
    return

#________________________________________
#  Solve
#________________________________________
def solve(N, i):
    
    return N - i + 1
#________________________________________


if __name__ == "__main__":
    main()

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n, k = map(int, input().split())
if n%k:
    print(1)
else:
    print(0)


n, i = map(int, input().split())
print(n-i+1)


Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
# WIP (WA: 1_01.txt, 1_06.txt, 1_07.txt)
import sys
input_s = sys.stdin.readline

N, K = map(int, input_s().split())
xxx = list(map(int, input_s().split()))

min_elapsed_time =  float("inf")
for left, right in zip(xxx, xxx[K - 1:]):
    elapsed_time = right - left + min(abs(left), abs(right))
    """
    right - left : a section distance
    min(abs(left), abs(right)) : a start point to move the section
    """
    min_elapsed_time = \
        elapsed_time if elapsed_time < min_elapsed_time else min_elapsed_time

print(min_elapsed_time)


n, i = map(int, input().split())
print(n-i+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
a,b = map(int,input().split())
return a - b + 1

a,b = map(int,input().split())
print(a-b+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N,i = map(int,input(),split())

print(N-i+1)

N,i = map(int,input().split())

print(N-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i=map(int,input(),split())
print(n-i+1)

n,i=map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
print(1 - eval(input().replace(" ", "-")))

print(1 + eval(input().replace(" ", "-")))

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n,i=map(int、input().split())
print(n-i+1)


n,i=map(int,input().split())
print(n-i+1)

Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
# ABC107 A - Train 
n,i = map(int,input().split())
print(n-1+1)

# ABC107 A - Train 
n,i = map(int,input().split())
print(n-i+1)

Verdicts: Wrong Answer

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
n i = map(int,input().split())
print(n - i + 1)

n i = map(int,input().split())
print((n - i) + 1)


n, i = map(int,input().split())
print((n - i) + 1)


Verdicts: Runtime Error

Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
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))


n,i = input().split()
print(int(n)-int(i)+1)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):



def main(n, i):
    print(n - i + 1)


if __name__ == '__main__':
    main(map(int, input().split(' ')))





def main(n, i):
    print(n - i + 1)


if __name__ == '__main__':
    n, i = map(int, input().split(' '))
    main(n, i)


Verdicts: Runtime Error

Accepted
Problem: There is an N-car train.  You are given an integer i. Find the value of j such that the following statement is true: "the i-th car from the front of the train is the j-th car from the back."

Submission attempts (in order):
N=int(input())
A=list(map(int,input().split()))
median_len=N*(N+1)//2
median=median_len//2+1
a=1
medin_rank=1
for i in range(1,N):
    a=i*(i+1)//2
    b=(i+2)*(i+1)//2
    if a<=median and b>median:
        medin_rank=i
        break
rank_index=median-a
median_list=[]
l=medin_rank//2
for i in range(N-medin_rank):
    median_list.append(A[l+i])
print(median_list[rank_index])


N,i=map(int,input().split())
print(N-i+1)

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

newGrid = []
for i in range(h):
    a = list(input())
    for j,a_j in enumerate(a):
        if a_j == "#":
            newGrid.append(a)
            break
        else:
            continue

ans = []
for j in range(w):
    for i in range(len(newGrid)):
        if newGrid[i][j] == "#":
            ans.append([newGrid[k][j] for k in range(len(newGrid))])
            break
        else:
            continue
            
print(ans)

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

newGrid = []
for i in range(h):
    a = list(input())
    for j,a_j in enumerate(a):
        if a_j == "#":
            newGrid.append(a)
            break
        else:
            continue

ans = []
for j in range(w):
    for i in range(len(newGrid)):
        if newGrid[i][j] == "#":
            ans.append([newGrid[k][j] for k in range(len(newGrid))])
            break
        else:
            continue
            
for ansi in ans:
    print("".join(ansi))

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

newGrid = []
for i in range(h):
    a = list(input())
    for j,a_j in enumerate(a):
        if a_j == "#":
            newGrid.append(a)
            break
        else:
            continue

ans = []
for j in range(w):
    for i in range(len(newGrid)):
        if newGrid[i][j] == "#":
            ans.append([newGrid[k][j] for k in range(len(newGrid))])
            break
        else:
            continue
            
for ansi in list(zip(*ans)):
    print("".join(ansi))

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
h , w = map(int,input().split())
a = [''] * h 
for i in range(n):
    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()

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

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

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

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


Verdicts: Runtime Error

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

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

a = [''] * 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])
        print()

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

Verdicts: Wrong Answer

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

Submission attempts (in order):
h,w=map(int,input().split())
grid=[]
for i in range(h):
  grid.append(list(map(int,input().split())))
for i in range(grid):
  if grid[i].count('.')==len(grid[i]):
    grid.pop(i)
for j in range(grid[0]):
  for i in range(len(grid)):
    if grid[i][j]!='#':
      break
  for i in range(len(grid)):
    grid[i].pop(j)
for i in grid:
  print(' '.join(map(str,i)))

h,w=map(int,input().split())
grid=[]
grid2=[]
grid3=[]
for i in range(h):
  grid.append(list(input().replace(" ","")))
for i in range(len(grid)):
  if grid[i].count('.')==len(grid[i]):
    pass
  else:
    grid2.append(grid[i])
for i in grid2:
  grid3.append([])
for j in range(len(grid2[0])):
  for i in range(len(grid2)):
    if grid2[i][j]=='#':
      for k in range(len(grid3)):
        grid3[k].append(grid2[k][j])
      break
for i in grid3:
  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())
A = [None] * h
for i in range(h):
  A[i] = list(input())

while ('.' * w in A):
  A.remove('.' * w)

B = [''.join(col) for col in zip(*A)]

while ('.' * len(A) in B):
  B.remove('.' * len(A))

A = [''.join(col) for col in zip(*B)]

for a in A:
  print(''.join(a))


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

while ('.' * w in A):
  A.remove('.' * w)

B = [''.join(col) for col in zip(*A)]

while ('.' * len(A) in B):
  B.remove('.' * len(A))


A = [''.join(col) for col in zip(*B)]

for a in A:
  print(''.join(a))


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())
a=np.array([ list(input()) for i in range(h)])
count=0
d_w=[]
d_h=[]
for i in range(0,h):
  count=0
  for j in range(0,w):
    if a[i][j]==".":
      count+=1
  if count==w:
    d_w.append(i)
for i in range(0,w):
  count=0
  for j in range(0,h):
    if a[j][i]==".":
      count+=1
  if count==h:
    d_h.append(i)
a=np.delete(a,d_w,0)
a=np.delete(a,d_h,1)
for i in a:
  print(*i)

import numpy as np
h,w=map(int,input().split())
a=np.array([ list(input()) for i in range(h)])
count=0
d_w=[]
d_h=[]
for i in range(0,h):
  count=0
  for j in range(0,w):
    if a[i][j]==".":
      count+=1
  if count==w:
    d_w.append(i)
for i in range(0,w):
  count=0
  for j in range(0,h):
    if a[j][i]==".":
      count+=1
  if count==h:
    d_h.append(i)
a=np.delete(a,d_w,0)
a=np.delete(a,d_h,1)
for i in a:
  print(*i)

import numpy as np
h,w=map(int,input().split())
a=np.array([ list(input()) for i in range(h)])
count=0
d_w=[]
d_h=[]
for i in range(0,h):
  count=0
  for j in range(0,w):
    if a[i][j]==".":
      count+=1
  if count==w:
    d_w.append(i)
for i in range(0,w):
  count=0
  for j in range(0,h):
    if a[j][i]==".":
      count+=1
  if count==h:
    d_h.append(i)
a=np.delete(a,d_w,0)
a=np.delete(a,d_h,1)
for i in a:
  print("".join(i))

Verdicts: Wrong Answer

Wrong Answer

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

Submission attempts (in order):
h,w = map(int, input().split())
a = [''] * h
print(a)
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()

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

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

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

Verdicts: Wrong Answer

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

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


for i in range(w):
	tmp=0
	for j in range(h):
		if a[j][i]=="#":
			tmp=1
	if tmp==0:
		for j in range(h):
			a[j][i]="0"


for i in range(h):
	if not "#" in a[i][:]:
		a[i][:]=[0]*w

for i in range(h):
	tmpl=[]
	for j in range(w):
		if not a[i][j]=="0":
			tmpl.append(a[i][j])
	if "#" in tmpl or "." in tmpl:
		print(" ".join(tmpl))		

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


for i in range(w):
	tmp=0
	for j in range(h):
		if a[j][i]=="#":
			tmp=1
	if tmp==0:
		for j in range(h):
			a[j][i]="0"


for i in range(h):
	if not "#" in a[i][:]:
		a[i][:]=[0]*w

for i in range(h):
	tmpl=[]
	for j in range(w):
		if not a[i][j]=="0":
			tmpl.append(a[i][j])
	if "#" in tmpl or "." in tmpl:
		print(" ".join(tmpl))

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


for i in range(w):
	tmp=0
	for j in range(h):
		if a[j][i]=="#":
			tmp=1
	if tmp==0:
		for j in range(h):
			a[j][i]="0"


for i in range(h):
	if not "#" in a[i][:]:
		a[i][:]=[0]*w

for i in range(h):
	tmpl=[]
	for j in range(w):
		if not a[i][j]=="0":
			tmpl.append(a[i][j])
	if "#" in tmpl or "." in tmpl:
		print("".join(tmpl))		

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

for i in range(w):
	tmp=0
	for j in range(h):
		if a[j][i]=="#":
			tmp=1
	if tmp==0:
		for j in range(h):
			a[j][i]="0"


for i in range(h):
	if not "#" in a[i][:]:
		a[i][:]=[0]*w

for i in range(h):
	tmpl=[]
	for j in range(w):
		if not a[i][j]=="0":
			tmpl.append(a[i][j])
	if "#" in tmpl or "." in tmpl:
		print("".join(tmpl))		

Verdicts: Runtime Error

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):
import numpy as np

a1, a2 = map(int, input().split())
mx = [[list(i) for i in input().split()] for i in range(a1)]
mx = np.reshape(mx,-1)
mx = [0 if i == '.' else 1 for i in mx]
mx = np.reshape(mx,[a1,a2])

w = min(np.append(sum(mx,1),sum(mx,0)))

while w == 0:
    mx = mx[np.sum(mx,1) > 0]
    mx = mx.T[np.sum(mx.T,1) > 0].T
    w = min(np.append(sum(mx,1),sum(mx,0)))

res = np.where(mx == 0 ,".","#")

print(res)

import numpy as np

a1, a2 = map(int, input().split())
mx = [[list(i) for i in input().split()] for i in range(a1)]
mx = np.reshape(mx,-1)
mx = [0 if i == '.' else 1 for i in mx]
mx = np.reshape(mx,[a1,a2])

w = min(np.append(sum(mx,1),sum(mx,0)))

while w == 0:
    mx = mx[np.sum(mx,1) > 0]
    mx = mx.T[np.sum(mx.T,1) > 0].T
    w = min(np.append(sum(mx,1),sum(mx,0)))

res = np.where(mx == 0 ,".","#")

for x in zip(*res):
    print(''.join(x))

import numpy as np

a1, a2 = map(int, input().split())
mx = [[list(i) for i in input().split()] for i in range(a1)]
mx = np.reshape(mx,-1)
mx = [0 if i == '.' else 1 for i in mx]
mx = np.reshape(mx,[a1,a2])

w = min(np.append(sum(mx,1),sum(mx,0)))

while w == 0:
    mx = mx[np.sum(mx,1) > 0]
    mx = mx.T[np.sum(mx.T,1) > 0].T
    w = min(np.append(sum(mx,1),sum(mx,0)))

res = np.where(mx == 0 ,".","#")

for x in res:
    print(''.join(x))

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())
s = [list(input()) for i in range(h)]
for i in s:print(i)
s=[i for i in s if '#' in i]
count=0
while count<len(s[0]):
    check=0
    for i in s:
        if i[count]=='#':
            check=1
    if check==0:
        for i in s:
            i.pop(count)
    else:count+=1
for i in s:print(''.join(i))

h,w=map(int, input().split())
s = [list(input()) for i in range(h)]
s=[i for i in s if '#' in i]
count=0
while count<len(s[0]):
    check=0
    for i in s:
        if i[count]=='#':
            check=1
    if check==0:
        for i in s:
            i.pop(count)
    else:count+=1
for i in s:print(''.join(i))

Verdicts: Wrong Answer

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

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

res=[]
for i in range(h):
    if "#" not in a[i]:
      res.append(i)
for i in res:
  a.pop(i)
res=[]
h=len(a)
for i in range(w):
    for j in range(len(a)):
      if a[j][i]=="#":
        break
    else:
      res.append(j)
for i in res:
  for j in range(len(a)):
    a[j]=a[j][:i]+a[j][i+1:]
for i in a:
  print(*i)

h,w=map(int,input().split())
a=[input() for _ in range(h)]
res=[]
for i in range(h):
    if "#" not in a[i]:
      res.append(i)

resh=[]
h=len(a)
for i in range(w):
    for j in range(len(a)):
      if a[j][i]=="#":
        break
    else:
      resh.append(i)
for i in range(h):
  for j in range(w):
    if i not in res and j not in resh:
      print(a[i][j],end="")
  if i not in res:
    print("")

Verdicts: Runtime Error

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

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

A = [list(input()) for _ in range(h)]

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 = '')

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

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

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


Verdicts: Wrong Answer

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

Submission attempts (in order):
def transpose(A):
    B = []
    for j in range(len(A[0])):
        C = [A[i][j] for i in range(len(A))]
        B.append(C)
    return B

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

for i in reversed(range(H)):
    if A[i] == ['.']*W:
        A.pop(i)
        
H = len(A)        
A = transpose(A)
for j in reversed(range(W)):
    if A[j] == ['.']*H:
        A.pop(j)

A = transpose(A)
for i in range(len(A)):
 	print(*A[i])

def transpose(A):
    B = []
    for j in range(len(A[0])):
        C = [A[i][j] for i in range(len(A))]
        B.append(C)
    return B

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

for i in reversed(range(H)):
    if A[i] == ['.']*W:
        A.pop(i)
        
H = len(A)        
A = transpose(A)
for j in reversed(range(W)):
    if A[j] == ['.']*H:
        A.pop(j)

A = transpose(A)
for i in range(len(A)):
 	print(*A[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())
ahw = [strlist for strlist in [[s for s in input()] for i in range(H)] if "#" in strlist]
tenti = []
for h in range(H-1):
   m =  [ah for ah in ahw[h]]
   if "#" in m:
       tenti.append(m)
for ahwnum in range(len(ahw)):
    print("".join([num for num in tenti[ahwnum]]))

H,W = map(int,input().split())
ahw = [strlist for strlist in [[s for s in input()] for i in range(H)] if "#" in strlist]
tenti = []
for h in range(W):
   m =  [ah[h] for ah in ahw]
   if "#" in m:
       tenti.append(m)
for ahwnum in range(len(ahw)):
    print("".join([num[ahwnum] for num in tenti]))

Verdicts: Runtime Error

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

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

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

Verdicts: Wrong Answer

Accepted