Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [[] for _ in range(n+1)]
s = [0 for _ in range(n+1)]
ll = []
for i in range(n-1):
  ai,bi = map(int,input().split())
  l[ai].append([bi,i])
  l[bi].append([ai,i])
  s[ai] += 1
  s[bi] += 1
mx = 0
for i in range(1,n+1):
  if s[i] > mx:
    mx = s[i]
    mxi = i
print(mx)
ans = [0 for _ in range(n-1)]
def dfs(a,b,c):
  i = 1
  for h,j in l[a]:
    if h != b:
      if i == c:
        i += 1
      ans[j] = i
      dfs(h,a,i)
      i += 1
  return
dfs(mxi,0,0)
for a in ans:
  print(a)

Fixed submission:
import sys
import resource
sys.setrecursionlimit(10**5)
n = int(input())
l = [[] for _ in range(n+1)]
s = [0 for _ in range(n+1)]
ll = []
for i in range(n-1):
  ai,bi = map(int,input().split())
  l[ai].append([bi,i])
  l[bi].append([ai,i])
  s[ai] += 1
  s[bi] += 1
mx = 0
for i in range(1,n+1):
  if s[i] > mx:
    mx = s[i]
    mxi = i
print(mx)
ans = [0 for _ in range(n-1)]
def dfs(a,b,c):
  i = 1
  for h,j in l[a]:
    if h != b:
      if i == c:
        i += 1
      ans[j] = i
      dfs(h,a,i)
      i += 1
  return
dfs(mxi,0,0)
for x in ans:
  print(x)

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = [[] for _ in range(n+1)]
s = [0 for _ in range(n+1)]
ll = []
for _ in range(n-1):
  ai,bi = map(int,input().split())
  l[ai].append(bi)
  l[bi].append(ai)
  ll.append([ai,bi])
  s[ai] += 1
  s[bi] += 1
mx = 0
for i in range(1,n+1):
  if s[i] > mx:
    mx = s[i]
    mxi = i
print(mx)
ans = [[0 for _ in range(n+1)] for _ in range(n+1)]
def dfs(a,b,c):
  i = 1
  for h in l[a]:
    if h != b:
      if i == c:
        i += 1
      ans[a][h] = i
      ans[h][a] = i
      dfs(h,a,i)
      i += 1
  return
dfs(mxi,0,0)
for xx in ll:
  print(ans[xx[0]][xx[1]])

Fixed submission:
import sys
import resource
sys.setrecursionlimit(10**5)
n = int(input())
l = [[] for _ in range(n+1)]
s = [0 for _ in range(n+1)]
ll = []
for i in range(n-1):
  ai,bi = map(int,input().split())
  l[ai].append([bi,i])
  l[bi].append([ai,i])
  s[ai] += 1
  s[bi] += 1
mx = 0
for i in range(1,n+1):
  if s[i] > mx:
    mx = s[i]
    mxi = i
print(mx)
ans = [0 for _ in range(n-1)]
def dfs(a,b,c):
  i = 1
  for h,j in l[a]:
    if h != b:
      if i == c:
        i += 1
      ans[j] = i
      dfs(h,a,i)
      i += 1
  return
dfs(mxi,0,0)
for x in ans:
  print(x)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
d = []
for _ in range(m):
  l,r,c = map(int,input().split())
  d.append([l,r,c])
d.sort(key=lambda x:x[0])
g = [float("inf") for _ in range(n+1)]
g[1] = 0
f = 1
for i in range(m):
  if d[i][0] > f:
    print(-1)
    exit()
  f = max(f,d[i][1])
  sm = d[i][2]+g[d[i][0]]
  if g[d[i][1]] > sm:
    g[d[i][1]] = sm
    j = d[i][1]-1
    while g[j] > sm:
      g[j] = sm
      j -= 1
if g[n] != float("inf"):
  print(g[n])
else:
  print(-1)

Fixed submission:
n,m = map(int,input().split())
d = []
for _ in range(m):
  l,r,c = map(int,input().split())
  d.append([l,r,c])
d.sort(key=lambda x:x[0])
g = [float("inf") for _ in range(n+1)]
g[1] = 0
f = 1
for i in range(m):
  if d[i][0] > f:
    print(-1)
    exit()
  f = max(f,d[i][1])
  sm = d[i][2]+g[d[i][0]]
  if g[d[i][1]] > sm:
    g[d[i][1]] = sm
    j = d[i][1]-1
    while g[j] > sm:
      g[j] = sm
      j -= 1
if g[n] != float("inf"):
  print(g[n])
else:
  print(-1)
Buggy python submission (verdict: Runtime Error):
n = int(input().split())
d = list(map(int,input().split()))
print((sum(d)**2-sum(d[i]**2 for i in range(n)))//2)

             

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
print((sum(d)**2-sum(d[i]**2 for i in range(n)))//2)

Buggy python submission (verdict: Runtime Error):
n = int(input().split())
d = list(map(int(input().split())))
print((sum(d)**2-sum(d[i]**2 for i in range(n)))//2)

             

Fixed submission:
n = int(input())
d = list(map(int,input().split()))
print((sum(d)**2-sum(d[i]**2 for i in range(n)))//2)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
l.append(0)
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    z = l[i]-l[j]
    if l[j+1] <= z:
      break
    else:
      a = j+1
      b = n+1
      while a+1 < b:
        m = (a+b)//2
        if l[m] > z:
          a = m
        else:
          b = m
      c += a-j
print(c)        
    

Fixed submission:
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
l.append(0)
c = 0
for i in range(n-2):
  for j in range(i+1,n-1):
    z = l[i]-l[j]
    if l[j+1] <= z:
      break
    else:
      a = j+1
      b = n+1
      while a+1 < b:
        m = (a+b)//2
        if l[m] > z:
          a = m
        else:
          b = m
      c += a-j
print(c)
Buggy python submission (verdict: Runtime Error):
s = str(input())
loop = ["Sunny","Cloudy","Rainy"]
i = loop.index(s)
print(loop((i+1)%3))

Fixed submission:
s = str(input())
loop = ["Sunny","Cloudy","Rainy"]
i = loop.index(s)
print(loop[(i+1)%3])
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = list(map(int,input().split()))
sm = sum(a)
a.sort(reverse=True)
a = a[0:min(n,m)]
discount = 0
for i in range(m):
  newa = a[0]//2
  discount += a[0] - newa
  l = len(a)
  if l == 1:
    continue
  ain = a[1:min(l,m-i-1)]
  lin = len(ain)
  if newa > ain[0]:
    a = [newa] + ain
    continue
  j = 0
  k = lin-1
  while j < k:
    mid = (j+k)//2
    if newa <= ain[mid]:
      k = mid
    else:
      j = mid
  a = ain[0:j+1] + [newa] + ain[j+1:]
    
  
  


Fixed submission:
from heapq import heappush, heappop,heapify
n,m = map(int,input().split())
def minusint(x):
  return -int(x)
a = list(map(minusint,input().split()))
heapify(a)
for _ in range(m):
  ai = heappop(a)*(-1)
  heappush(a,-(ai//2))
print(-sum(a))
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
li = [[],[]]
for _ in range(n):
  si = str(input())
  di = {}
  for i in range(10):
    if si[i] in di.keys():
      di[si[i]] += 1
    else:
      di[si[i]] = 1
  frag = True
  for j,st in enumerate(li[0]):
    if di == st:
      li[1][j] += 1
      frag = False
  if frag:
    li[0].append(di)
    li[1].append(1)
sm = 0
for j in li[1]:
  sm += j*(j-1)//2
print(sm)

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
  si = str(input())
  li = [si[i] for i in range(10)]
  li.sort()
  moji = "".join(li)
  if moji in dic.keys():
    dic[moji] += 1
  else:
    dic[moji] = 1
sm = 0
for j in dic.values():
  sm += j*(j-1)//2
print(sm)

Buggy python submission (verdict: Runtime Error):
for _ in range(n):
  si = str(input())
  di = {}
  for i in range(10):
    if si[i] in di.keys():
      di[si[i]] += 1
    else:
      di[si[i]] = 1
  frag = True
  for j,st in enumerate(li[0]):
    if di == st:
      li[1][j] += 1
      frag = False
  if frag:
    li[0].append(di)
    li[1].append(1)
sm = 0
for j in li[1]:
  sm += j*(j-1)//2
print(sm)

Fixed submission:
n = int(input())
dic = {}
for _ in range(n):
  si = str(input())
  li = [si[i] for i in range(10)]
  li.sort()
  moji = "".join(li)
  if moji in dic.keys():
    dic[moji] += 1
  else:
    dic[moji] = 1
sm = 0
for j in dic.values():
  sm += j*(j-1)//2
print(sm)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
li=[[] for _ in range(m)]
for _ in range(n):
  ai,bi = map(int,input().split())
  if ai <= m:
    li[ai-1].append(bi)
pos = []
sm = 0
for i in range(m):
  pos.extend(li[i])
  pos.sort(reverse=True)
  if len(pos) > m-i:
    pos = pos[:m-i]
  if len(pos) > 0:
    s = pos.pop(0)
    sm += s
print(sm)
    
  

Fixed submission:
from heapq import heappush,heappop
n,m = map(int,input().split())
x = []
xa = x.append
for _ in range(n):
  ai,bi = map(int,input().split())
  xa((ai,bi))
x.sort(key=lambda a:a[0])
y = []
count = 0
j = 0
for i in range(1,m+1):
  while x[j][0] == i:
    heappush(y,-x[j][1])
    if j+1 < n:
      j += 1
    else:
      break
  if len(y) != 0:
    count -= heappop(y)
print(count)
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
  if b[i] >= a[i]:
    c += a[i]
  elif b[i]+b[i+1] >= a[i]:
    c += a[i]
    b[i+1] -= a[i]-b[i]
  else:
    c += b[i]+b[i+1]
    b[i+1] = 0
print(c)
  

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = 0
for i in range(n):
  if a[i] >= b[i]:
    c += b[i]
  elif a[i]+a[i+1] >= b[i]:
    c += b[i]
    a[i+1] -= b[i]-a[i]
    continue
  else:
    c += a[i]+a[i+1]
    a[i+1]=0
print(c)
Buggy python submission (verdict: Runtime Error):
import math
n = int(input())
d = int(input())
print(math.ceil(n/(2*d+1)))

Fixed submission:
import math
n,d = map(int,input().split())
print(math.ceil(n/(2*d+1)))
Buggy python submission (verdict: Runtime Error):
n = int(input())
mx = 0
smx = 0
mxi = 0
for i in range(n):
  ai = int(input())
  if a[i] > mx:
    smx = mx
    mx = a[i]
    mxi = i
  elif a[i] > smx:
    smx = a[i]
for j in range(mxi):
  print(mx)
print(smx)
for j in range(mxi+1,n):
  print(mx)
    
  

Fixed submission:
n = int(input())
mx = 0
smx = 0
mxi = 0
for i in range(n):
  ai = int(input())
  if ai > mx:
    smx = mx
    mx = ai
    mxi = i
  elif ai > smx:
    smx = ai
for j in range(mxi):
  print(mx)
print(smx)
for j in range(mxi+1,n):
  print(mx)
Buggy python submission (verdict: Time Limit Exceeded):
import sys
input = sys.stdin.readline
n = int(input())
a1 = int(input())
a = [a1]
for _ in range(n-1):
  ai = int(input())
  if ai <= a[-1]:
    a.append(ai)
  elif ai > a[0]:
    a = [ai]+a[1:]
  else:
    h = 0
    l = len(a)-1
    while l-h>1:
      m = (l+h)//2
      if ai > a[m]:
        l = m
      else:
        h = m
    a = a[:l]+[ai]+a[l+1:]
print(len(a))   

Fixed submission:
def sub():
  import sys
  input = sys.stdin.readline
  n = int(input())
  a1 = int(input())
  a = [a1]
  ap = a.append
  for _ in range(n-1):
    ai = int(input())
    if ai <= a[-1]:
      ap(ai)
    elif ai > a[0]:
      a[0] = ai
    else:
      h = 0
      l = len(a)-1
      while l-h>1:
        m = (l+h)//2
        if ai > a[m]:
          l = m
        else:
          h = m
      a[l] = ai
  print(len(a))   
sub()
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
x = [[] for _ in range(n+1)]
for _ in range(n-1):
  a,b = map(int,input().split())
  x[a].append(b)
  x[b].append(a)
ans = k
def search(i):
  l = len(x[i])
  if l == 0:
    return
  global ans
  for j in range(l):
    ans = (ans*(k-2-j))%1000000007
  for child in x[i]:
    x[child].remove(i)
    search(child)
l1 = len(x[1])
for j in range(l1):
  ans = (ans*(k-1-j))%1000000007
for child1 in x[1]:
  x[child1].remove(1)
  search(child1)
print(ans)

Fixed submission:
import sys
sys.setrecursionlimit(100000)
n,k = map(int,input().split())
x = [[] for _ in range(n+1)]
for _ in range(n-1):
  a,b = map(int,input().split())
  x[a].append(b)
  x[b].append(a)
ans = k
def search(i):
  l = len(x[i])
  if l == 0:
    return
  global ans
  for j in range(l):
    ans = (ans*(k-2-j))%1000000007
  for child in x[i]:
    x[child].remove(i)
    search(child)
l1 = len(x[1])
for j in range(l1):
  ans = (ans*(k-1-j))%1000000007
for child1 in x[1]:
  x[child1].remove(1)
  search(child1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
way = [1 for _ in range(n+1)]
b1 = 1
b2 = 1
count = 1
ai = int(input())
if ai == 1:
  b2 = 0
  ai = int(input())
  count += 1
for i in range(2,n+1):
  if i == ai:
    b1 = b2
    b2 = 0
    if count < m:
      ai = int(input())
      count+=1
  else:
    tmp = b2
    b2 = (b1 + tmp)%1000000007
    b1 = tmp
print(b2)    

Fixed submission:
n,m = map(int,input().split())
way = [1 for _ in range(n+1)]
for i in range(m):
  ai = int(input())
  way[ai] = 0
for i in range(2,n+1):
  if way[i] != 0:
    way[i] = (way[i-1]+way[i-2])%1000000007
print(way[n])
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
ben = n*(n-1)//2
ans = [ben]
a = []
b = []
for _ in range(m):
  ai,bi = map(int,input().split())
  a.append(ai)
  b.append(bi)
a.reverse()
b.reverse()
con = [[i] for i in range(n+1)]
for i in range(m-1):
  ai = a[i]
  bi = b[i]
  if bi in con[ai]:
    ans.append(ben)
  else:
    ben -= len(con[ai])*len(con[bi])
    ans.append(ben)
    x = list(set(con[ai]+con[bi]))
    for s in x:
      con[s] = x
for j in range(m):
  print(ans[m-1-j])
  

Fixed submission:
n,m = map(int,input().split())
ben = n*(n-1)//2
ans = [ben]
a = []
b = []
for _ in range(m):
  ai,bi = map(int,input().split())
  a.append(ai)
  b.append(bi)
a.reverse()
b.reverse()
class UnionFind:
    def __init__(self, n):
        self.par = [i for i in range(n+1)]
        self.rank = [0] * (n+1)
    def find(self, x):
        if self.par[x] == x:
            return x
        else:
            self.par[x] = self.find(self.par[x])
            return self.par[x]
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if self.rank[x] < self.rank[y]:
            self.par[x] = y
        else:
            self.par[y] = x
            if self.rank[x] == self.rank[y]:
                self.rank[x] += 1
    def same_check(self, x, y):
        return self.find(x) == self.find(y)
u = UnionFind(n)
size = [1 for _ in range(n+1)]
for i in range(m):
  ai = a[i]
  bi = b[i]
  if u.same_check(ai,bi):
    ans.append(ben)
    u.union(ai,bi)
  else:
    x = u.find(ai)
    y = u.find(bi)
    ben -= size[x]*size[y]
    ans.append(ben)
    if u.rank[x] < u.rank[y]:
      size[y] = size[x]+ size[y]
    else:
      size[x] = size[x]+size[y]
    u.union(ai,bi)
    
for j in range(m):
  print(ans[m-1-j])
Buggy python submission (verdict: Runtime Error):
n = int(input())
h = list(map(int,input().split()))
a = [0 for _ in range(n)]
a[1] = abs(h[1]-h[0])
for i in range(2,n):
  a[i] = min(a[i-1]+abs(h[i]-h[i-1]),a[i-2]+abs(h[i]-h[i-2]))
print(a[n])
  
  

Fixed submission:
n = int(input())
h = list(map(int,input().split()))
a = [0 for _ in range(n)]
a[1] = abs(h[1]-h[0])
for i in range(2,n):
  a[i] = min(a[i-1]+abs(h[i]-h[i-1]),a[i-2]+abs(h[i]-h[i-2]))
print(a[n-1])
Buggy python submission (verdict: Runtime Error):
n = int(input())
x = [list(map(int,input().split())) for _ in range(n)]
a = 0
b = 0
c = 0
for i in range(n):
  pa = a
  pb = b
  pc = c
  x = x[i]
  a = max(pb,pc)+x[0]
  b = max(pc,pa)+x[1]
  c = max(pa,pb)+x[2]
  
print(max(a,b,c))
  


Fixed submission:
n = int(input())
x = [list(map(int,input().split())) for _ in range(n)]
a = 0
b = 0
c = 0
for i in range(n):
  pa = a
  pb = b
  pc = c
  X = x[i]
  a = max(pb,pc)+X[0]
  b = max(pc,pa)+X[1]
  c = max(pa,pb)+X[2]
  
print(max([a,b,c]))
Buggy python submission (verdict: Runtime Error):
n,k = map(int,input().split())
a = list(map(int,input().split()))
s = [False]*(k+1)
for i in range(k+1):
  for aj in a:
    if i - aj >=0:
      if s[i-aj] == False:
        s[i] = True
        break
if a[k]==True:
  print("First")
else:
  print("Second")
  
  



Fixed submission:
n,k = map(int,input().split())
a = list(map(int,input().split()))
tf = ["" for _ in range(k+1)]
tf[0] = False
for i in range(1,k+1):
  j = 0
  flag = 0
  while j < n and i - a[j] >= 0:
    if tf[i-a[j]] == False:
      tf[i] = True
      flag = 1
      break
    j += 1
  if flag ==0:
    tf[i] = False
if tf[k]:
  print("First")
else:
  print("Second")
Buggy python submission (verdict: Runtime Error):
x = int(input())
if any(x==3,x==5,x==7):
  print("YES")
else:
  print("NO")
  

Fixed submission:
x = int(input())
if any([x==3,x==5,x==7]):
  print("YES")
else:
  print("NO")
Buggy python submission (verdict: Runtime Error):
s = str(input())
m = abs(753,int(s[0])*100+int(s[1])*10+int(s[2]))
for i in range(1,len(s)-2):
  a = int(s[i])*100+int(s[i+1])*10+int(s[i+2])
  m = min(m,abs(753,a))
  
print(m)
  


Fixed submission:
s = str(input())
m = abs(753-int(s[0])*100-int(s[1])*10-int(s[2]))
for i in range(1,len(s)-2):
  a = int(s[i])*100+int(s[i+1])*10+int(s[i+2])
  m = min(m,abs(753-a))
  
print(m)

Buggy python submission (verdict: Runtime Error):
s = str(input())
m = abs(753,s[0]*100+s[1]*10+s[2])
for i in range(1,len(s)-2):
  a = s[i]*100+s[i+1]*10+s[i+2]
  m = min(m,abs(753,a))
  
print(m)
  


Fixed submission:
s = str(input())
m = abs(753-int(s[0])*100-int(s[1])*10-int(s[2]))
for i in range(1,len(s)-2):
  a = int(s[i])*100+int(s[i+1])*10+int(s[i+2])
  m = min(m,abs(753-a))
  
print(m)
Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
g = 1
for i in range(int(m/n),1,-1):
  if m%i == 0:
    g = i
    break
    
      
print(g)
  

Fixed submission:
n,m = map(int,input().split())
g = 1
def fact(k):
  a = []
  for i in range(1,int(k **(0.5))+1):
    if k%i ==0:
      a.append(i)
      a.append(int(k/i))
  b = list(set(a))
  b.sort()
  return b

g = fact(m)
for i in range(len(g)):
  if g[len(g)-i-1] <= m/n:
    print(g[len(g)-i-1])
    break

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
g = 1
for i in range(1,int(1+m/n)):
  if m%i == 0:
    if int(m/i) >= n:
      g = i
    else:
      break
      
print(g)
  

Fixed submission:
n,m = map(int,input().split())
g = 1
def fact(k):
  a = []
  for i in range(1,int(k **(0.5))+1):
    if k%i ==0:
      a.append(i)
      a.append(int(k/i))
  b = list(set(a))
  b.sort()
  return b

g = fact(m)
for i in range(len(g)):
  if g[len(g)-i-1] <= m/n:
    print(g[len(g)-i-1])
    break

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int,input().split())
g = 1
for i in range(1,m):
  if m%i == 0:
    if int(m/i) >= n:
      g = i
    else:
      break
      
print(g)
  

Fixed submission:
n,m = map(int,input().split())
g = 1
def fact(k):
  a = []
  for i in range(1,int(k **(0.5))+1):
    if k%i ==0:
      a.append(i)
      a.append(int(k/i))
  b = list(set(a))
  b.sort()
  return b

g = fact(m)
for i in range(len(g)):
  if g[len(g)-i-1] <= m/n:
    print(g[len(g)-i-1])
    break

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
g = 1
for i in range(m):
  if m%i == 0:
    if int(m/i) >= n:
      g = int(m/i)
    else:
      break
      
print(g)
  

Fixed submission:
n,m = map(int,input().split())
g = 1
def fact(k):
  a = []
  for i in range(1,int(k **(0.5))+1):
    if k%i ==0:
      a.append(i)
      a.append(int(k/i))
  b = list(set(a))
  b.sort()
  return b

g = fact(m)
for i in range(len(g)):
  if g[len(g)-i-1] <= m/n:
    print(g[len(g)-i-1])
    break
Buggy python submission (verdict: Runtime Error):
n = int(input())
k = 0
if int(n/111) == n/111:
  k = n/111
else k = int(n/111) + 1
print(111*k)

Fixed submission:
n = int(input())
k = 0
if int(n/111) == n/111:
  k = int(n/111)
else:
  k = int(n/111) + 1
print(111*k)
Buggy python submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a%2 == 1 and b%2 ==1:
  print(Yes)
else:
  print(No)

Fixed submission:
a,b = map(int,input().split())
if a%2 == 1 and b%2 ==1:
  print("Yes")
else:
  print("No")
Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = [""]*h
for i in range(h):
  a[i] = input()

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

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

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


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

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

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

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

Buggy python submission (verdict: Runtime Error):
h,w = map(int,input().split())
a = [""]*h
for i in range(h):
  a[i] = input()

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

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

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


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

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

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

for i in range(h):
  if row[i]:
    for j in range(w):
      if column[j]:
        print(a[i][j],end = "")
    print()
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = [1,2,3,5,6,9,10,13,17]
if n in a:
  print(No)
else:
  print(Yes)

Fixed submission:
n = int(input())
a = [1,2,3,5,6,9,10,13,17]
if n in a:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
if n ==0:
  print(0)
else:
  while n != 0:
  if n%2 ==0:
    n = n/(-2)
    a.append("0")
  else:
    n = (n-1)/(-2)
    a.append("1")
    
b = ""
for i in range(len(a)):
  b += a[len(a)-i-1]

print(b)

  
  

Fixed submission:
n = int(input())
a = []
if n ==0:
  print(0)
else:
  while n != 0:
    if n%2 ==0:
      n = n/(-2)
      a.append("0")
    else:
      n = (n-1)/(-2)
      a.append("1")
    
  b = ""
  for i in range(len(a)):
    b += a[len(a)-i-1]

  print(b)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
while n > 0:
  if n%2 ==0:
    n = n/(-2)
    a.append("0")
  else:
    n = (n-1)(-2)
    a.append("1")
    
b = ""
for i in range(len(a)):
  b += a[len(a)-i-1]
  
print(b)
  
  

Fixed submission:
n = int(input())
a = []
if n ==0:
  print(0)
else:
  while n != 0:
    if n%2 ==0:
      n = n/(-2)
      a.append("0")
    else:
      n = (n-1)/(-2)
      a.append("1")
    
  b = ""
  for i in range(len(a)):
    b += a[len(a)-i-1]

  print(b)

Buggy python submission (verdict: Runtime Error):
n = int(input())
a = []
while n > 0:
  if n%2 ==0:
    n = n/(-2)
    a.append("0")
  else:
    n = (n-1)(-2)
    a.append("1")
    
b = ""
for i in range(len(a)):
  b += a[len(a)-i-1]
  
print("b")
  
  

Fixed submission:
n = int(input())
a = []
if n ==0:
  print(0)
else:
  while n != 0:
    if n%2 ==0:
      n = n/(-2)
      a.append("0")
    else:
      n = (n-1)/(-2)
      a.append("1")
    
  b = ""
  for i in range(len(a)):
    b += a[len(a)-i-1]

  print(b)
Buggy python submission (verdict: Runtime Error):
s = input()
check = 0
if s[0] == "A":
  if s[2:len(s)-1].count("C") == 1:
    if s[1].lower() == s[1] and s[len(s)-1].lower() == s[len(s)-1]:
      s.lstrip("C")
      if s[1:len(s)].lower() == s[1:len(s)]:
        check = 1
        
if check = 0:
  print("WA")
else:
  print("AC")
      
    
    
    

Fixed submission:
s = input()
check = 0
if s[0] == "A":
  if s[2:len(s)-1].count("C") == 1:
    if s[1].lower() == s[1] and s[len(s)-1].lower() == s[len(s)-1]:
      t = s.replace("C","")
      if t[1:len(s)].lower() == t[1:len(s)]:
        check = 1
        
if check == 0:
  print("WA")
else:
  print("AC")
Buggy python submission (verdict: Runtime Error):
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check == 0:
  print("No")
else:
  print("Yes")
    
  
  

Fixed submission:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)-1] + a[0:len(a)-1]
    
if check == 0:
  print("No")
else:
  print("Yes")

Buggy python submission (verdict: Runtime Error):
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a = b:
    check = 1
    break
  else:
    a = a[len(a)] + a[0:len(a)]
    
if check = 0:
  print("No")
else:
  print("Yes")
    
  
  

Fixed submission:
a = str(input())
b = str(input())
check = 0
for i in range(len(a)):
  if a == b:
    check = 1
    break
  else:
    a = a[len(a)-1] + a[0:len(a)-1]
    
if check == 0:
  print("No")
else:
  print("Yes")
Buggy python submission (verdict: Runtime Error):
n = int(input())
a = list(map(int,input().split())
print(sum(a)-n)
        

         

Fixed submission:
n = int(input())
a = list(map(int,input().split()))
print(sum(a)-n)