Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split(()))
ls=list(map(int,input().split()))
l=len('{:b}'.format(k))
r=0
for i in range(l-1,-1,0):
    c=0
    for j in ls:
        if j>>i & 1:
            c+=1
    if c<n//2:
    p=1<<i
    if r+p<=k:
        r=r+p
sum=0
for i in ls:
    sum+=i^r
print(sum)

Fixed submission:
n, k = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
s=0
l = len(bin(k)) - 2
b = n / 2
x = 0
for i in range(l, -1, -1):
    count = sum([(a >> i) & 1 for a in a_list])
    if count < b:
        temp = 1 << i
        if x + temp <= k:
            x += temp
print(sum([x ^ a for a in a_list]))

Buggy python submission (verdict: Runtime Error):
n,k=map(int,input().split(()))
ls=list(map(int,input().split()))
l=len('{:b}'.format(k))
r=0
for i in range(l-1,-1,0):
  c=0
  for j in ls:
    if j>>i & 1:
      c+=1
  if c<n//2:
    p=1<<i
    if r+p<=k:
      r=r+p
sum=0
for i in ls:
  sum+=i^r
print(sum)
    


Fixed submission:
n, k = [int(x) for x in input().split()]
a_list = [int(x) for x in input().split()]
s=0
l = len(bin(k)) - 2
b = n / 2
x = 0
for i in range(l, -1, -1):
    count = sum([(a >> i) & 1 for a in a_list])
    if count < b:
        temp = 1 << i
        if x + temp <= k:
            x += temp
print(sum([x ^ a for a in a_list]))
Buggy python submission (verdict: Runtime Error):
a, b = input().split()
print(max(0, int(b) - 2*int(a))

Fixed submission:
a, b = input().split()
print(max(0, int(a) - 2*int(b)))
Buggy python submission (verdict: Runtime Error):
str = str(input())
n = int(input())

seperation = []
tmp = ""
for x in range(len(str)-1):
  tmp += str[x]
  if str[x] == str[x+1]:
    if tmp == "":
      tmp += str[x]
  else:
    seperation.append(tmp)
    tmp = ""
tmp += str[-1]
seperation.append(tmp)

total = 0

# print(seperation)

if len(seperation) == 1:
  if (len(seperation[0]) == 1):
    return n//2

if (str[0] == str[-1]) and n>1 and len(seperation)>1:
  a = len(seperation[0])//2
  b = len(seperation[-1])//2
  # print("a,b:",a,b)
  total += a
  total += b
  seperation[0] += seperation[-1]
  a = seperation[0]
  print(a,len(a),len(a)//2, n-1)
  c = (len(a)//2)*(n-1)
  # print("c:",c)
  total += c
  seperation = seperation[1:-1]

# print(total)
# print(seperation)

for x in seperation:
  total += (len(x)//2)*n

print(total)

Fixed submission:
s = str(input())
k = int(input())

def main(s, k):
  separation = []
  tmp = ""
  for x in range(len(s)-1):
    tmp += s[x]
    if s[x] == s[x+1]:
      if tmp == "":
        tmp += s[x]
    else:
      separation.append(tmp)
      tmp = ""
  tmp += s[-1]
  separation.append(tmp)

  total = 0

  if len(separation) == 1:
    if (len(separation[0]) == 1):
      return k//2
    else:
      return (len(separation[0])*k)//2

  if (s[0] == s[-1]) and k>1 and len(separation)>1:
    a = len(separation[0])//2
    b = len(separation[-1])//2
    total += a
    total += b
    separation[0] += separation[-1]
    a = separation[0]
    c = (len(a)//2)*(k-1)
    total += c
    separation = separation[1:-1]

  # print(separation)

  for x in separation:
    total += (len(x)//2)*k

  return total

print(main(s,k))
Buggy python submission (verdict: Runtime Error):
args = []
a = input()
while a:
  for x in a.split():
    args.append(int(x))
  a = input()

b = [x for x in args[2:] if x >= args[1]]
print(len(b))

Fixed submission:
args = input().split()
heights = input().split()

b = [x for x in heights if int(x) >= int(args[1])]
print(len(b))
Buggy python submission (verdict: Runtime Error):
input_line = input()
inputs = input_line.split(' ')
inputs = [int(input) for input in inputs]

A = inputs[0]
B = inputs[1]

dual_B = 2 * B

res = 0
if A > dual_b:
    res = A - dual_B
else: 
    res = 0

print(0)

Fixed submission:
input_line = input()
inputs = input_line.split(' ')
inputs = [int(input) for input in inputs]

A = inputs[0]
B = inputs[1]

dual_B = 2 * B

res = 0
if A > dual_B:
    res = A - dual_B
else:
    res = 0

print(res)

Buggy python submission (verdict: Runtime Error):
def o(a,b):
  if a>2*b:
    return a-2*b
  return 0
 
a=int(imput())
b=int(imput())
print(o(a,b))


Fixed submission:
a,b=map(int, input().split())
if a>2*b:
  print(a-2*b)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
def o(a,b):
  if a>2*b:
    return a-2*b
  return 0
 
a=imput()
b=imput()
print(o(a,b))

Fixed submission:
a,b=map(int, input().split())
if a>2*b:
  print(a-2*b)
else:
  print(0)

Buggy python submission (verdict: Runtime Error):
def o(a,b):
  if a>2*b:
    return a-2*b
  return 0

a=imput()
b=imput()
print(a,b)

Fixed submission:
a,b=map(int, input().split())
if a>2*b:
  print(a-2*b)
else:
  print(0)
Buggy python submission (verdict: Runtime Error):
v=int(input())
#文字列
s=[0]*v
x=0
for i in range(v):
    x=int(input())
    s[x-1]=i+1
for i in range(v-1):
    print(s[i]," ",sep="",end="")
print(s[v-1])

Fixed submission:
def o(a):
    for i in range(len(a)):
        a[i]=[a[i],i+1]
    return a             

n = int(input())
a = list(map(int, input().split()))

a=o(a)

q=[0]*n

for i in range(len(a)):
    q[a[i][0]-1]=a[i][1]

for i in q:
    print(i," ",end='')
Buggy python submission (verdict: Time Limit Exceeded):
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: -x, A))

heapq.heapify(A)
#print(A)

for i in range(M):
    A[0] = -(-A[0] // 2)
    heapq.heapify(A)

ans = - sum(A)
print(ans)





Fixed submission:
import heapq

N, M = map(int, input().split())
A = list(map(int, input().split()))
A = list(map(lambda x: -x, A))

heapq.heapify(A)
#print(A)

for i in range(M):
    n = - (-heapq.heappop(A) // 2)
    heapq.heappush(A, n)

ans = - sum(A)
print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [input() for _ in range(N)]

for i in range(N):
    s[i] = ''.join(sorted(s[i])) # 文字列をソートすると配列になる

ans = 0
for i in range(N): # iは0からN-1まで
    ans += (s.count(s[i]) - 1)/2

print(int(ans))

Fixed submission:
N = int(input())
s = [input() for _ in range(N)]

Dict = {} # 空の辞書を用意(集合ともみれるが)
ans = 0

for i in range(N):
    s[i] = ''.join(sorted(s[i])) # 文字列をソートすると配列になる
    if s[i] in Dict:
        ans += Dict[s[i]] # あったら過去にあった個数をansに代入
        Dict[s[i]] += 1 # 値に1追加
    else:
        Dict[s[i]] = 1 # なかったら辞書にキー(文字列)と値1を格納

print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = [input() for _ in range(N)]

for i in range(N):
    s[i] = ''.join(sorted(s[i])) # 文字列をソートすると配列になる

ans = 0
for i in range(N): # iは0からN-2まで
    ans += (s.count(s[i]) - 1)/2

print(int(ans))

Fixed submission:
N = int(input())
s = [input() for _ in range(N)]

Dict = {} # 空の辞書を用意(集合ともみれるが)
ans = 0

for i in range(N):
    s[i] = ''.join(sorted(s[i])) # 文字列をソートすると配列になる
    if s[i] in Dict:
        ans += Dict[s[i]] # あったら過去にあった個数をansに代入
        Dict[s[i]] += 1 # 値に1追加
    else:
        Dict[s[i]] = 1 # なかったら辞書にキー(文字列)と値1を格納

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = [input() for _ in range(N)]

for i in range(N):
    s[i] = sorted(s[i]) # 2次元配列になる

ans = 0
for i in range(N-1): # iは0からN-2まで
    for j in range(i+1, N): # jはi+1からN-1まで
        if s[i] == s[j]:
            ans += 1

print(ans)

Fixed submission:
N = int(input())
s = [input() for _ in range(N)]

Dict = {} # 空の辞書を用意(集合ともみれるが)
ans = 0

for i in range(N):
    s[i] = ''.join(sorted(s[i])) # 文字列をソートすると配列になる
    if s[i] in Dict:
        ans += Dict[s[i]] # あったら過去にあった個数をansに代入
        Dict[s[i]] += 1 # 値に1追加
    else:
        Dict[s[i]] = 1 # なかったら辞書にキー(文字列)と値1を格納

print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    minh = min(H[i+1:]) # i+1以降のリストをスライス
    if H[i] - minh >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')

"""
# よく考えたら最大だけじゃダメだった
m = H.index(max(H)) # 複数の候補がある場合は最初のインデックスを返す
print(m)
for i in range(m+1, N):
    if H[m] - H[i] >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')
"""

Fixed submission:
A, B, C = map(int, input().split())

ans = max(0, C-(A-B))

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    minh = min(H[i+1:]) # i+1以降のリストをスライス
    if H[i] - minh >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')

"""
# よく考えたら最大だけじゃダメだった
m = H.index(max(H)) # 複数の候補がある場合は最初のインデックスを返す
print(m)
for i in range(m+1, N):
    if H[m] - H[i] >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')
"""

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

highest = 0
for i in range(N-1):
    highest = max(highest, H[i])
    if highest - 1 <= H[i+1]:
        continue
    else:
        print('No')
        break
else:
    print('Yes')

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
H = list(map(int, input().split()))

for i in range(N-1):
    h = H[i+1:] # i+1以降のリストをスライス
    minh = min(h)
    if H[i] - minh >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')

"""
# よく考えたら最大だけじゃダメだった
m = H.index(max(H)) # 複数の候補がある場合は最初のインデックスを返す
print(m)
for i in range(m+1, N):
    if H[m] - H[i] >= 2:
        print('No')
        break
    else:
        continue
else:
    print('Yes')
"""

Fixed submission:
N = int(input())
H = list(map(int, input().split()))

highest = 0
for i in range(N-1):
    highest = max(highest, H[i])
    if highest - 1 <= H[i+1]:
        continue
    else:
        print('No')
        break
else:
    print('Yes')
Buggy python submission (verdict: Time Limit Exceeded):
import copy

N = int(input())
A = [int(input()) for _ in range(N)]

B = copy.copy(A) # B=AとするだけではAを変更した時にBも変更してしまう
for i in range(N):
    A[i] = 0
    print(max(A))
    A[i] = B[i]

Fixed submission:
#import copy

N = int(input())
A = [int(input()) for _ in range(N)]

B = sorted(A, reverse=True)
m1 = B[0]
m2 = B[1]

for i in range(N):
    if A[i] == m1:
        print(m2)
    else:
        print(m1)

"""
# TLE
B = copy.copy(A) # B=AとするだけではAを変更した時にBも変更してしまう
for i in range(N):
    A[i] = 0
    print(max(A))
    A[i] = B[i]
"""
Buggy python submission (verdict: Runtime Error):
L, R = map(int, input().split())

MOD = 2019
ans = 2018

if R - L + 1 >= 2019:
    print(0)
else:
    for i in range(L, R):
        for j in range(i+1, R+1):
            n = (i*j)%MOD
            ans = min(n, ans)
    print(ans)

"""
# TLEギリギリ
R = min(R, L+(2019)) # 長さを制限しても同じ2019をyoutube通りに2019*2にするとTLE
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)



Fixed submission:
L, R = map(int, input().split())

R = min(R, L+(2019)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

R = min(R, L+(2019*2)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)



Fixed submission:
L, R = map(int, input().split())

R = min(R, L+(2019)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

R = min(R, L+2019*2) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = i*j%MOD
        ans = min(n, ans)

print(ans)



Fixed submission:
L, R = map(int, input().split())

R = min(R, L+(2019)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
L, R = map(int, input().split())

R = min(R, L+2019*2) # 長さを制限しても同じ
MOD = 2019
ans = 2020

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = ((i%MOD) * (j%MOD))%MOD
        if n < ans:
            ans = n

print(ans)



Fixed submission:
L, R = map(int, input().split())

R = min(R, L+(2019)) # 長さを制限しても同じ
MOD = 2019
ans = 2018

for i in range(L, R): # iはLからR-1まで
    for j in range(i+1, R+1): # jはi+1からRまで
        n = (i*j)%MOD
        ans = min(n, ans)

print(ans)
Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
#print(A)

b = [0.5 for _ in range(N)]
B0 = np.diag(b)
b.pop()
B1 = np.diag(b, k=1)
B = B0 + B1
B[N-1][0] = 0.5
#print(B)

#x = np.linalg.solve(B, A)
Binv = np.linalg.inv(B)
x = np.dot(Binv, A)
x = map(int, x)
ans = ' '.join(map(str, x))
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

x = 0
for i in range(N): # x_0の値を得る
    if i % 2 == 0:
        x += A[i]
    else:
        x -= A[i]

for i in range(N):
    print(x, end=' ') # x_iをprint
    x = 2 * A[i] - x # x_(i+1)を得る

Buggy python submission (verdict: Runtime Error):
import numpy as np

N = int(input())
A = np.array(list(map(int, input().split())))
#print(A)

b = [0.5 for _ in range(N)]
B0 = np.diag(b)
b.pop()
B1 = np.diag(b, k=1)
B = B0 + B1
B[N-1][0] = 0.5
#print(B)

x = np.linalg.solve(B, A)
x = map(int, x)
ans = ' '.join(map(str, x))
print(ans)

Fixed submission:
N = int(input())
A = list(map(int, input().split()))

x = 0
for i in range(N): # x_0の値を得る
    if i % 2 == 0:
        x += A[i]
    else:
        x -= A[i]

for i in range(N):
    print(x, end=' ') # x_iをprint
    x = 2 * A[i] - x # x_(i+1)を得る
Buggy python submission (verdict: Runtime Error):
from scipy.special import comb

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

MOD = 10**9 + 7

for i in range(1, K+1):
    a = comb(N-K+1, i)%MOD
    b = comb(K-1, i-1)%MOD
    ans = (a*b)%MOD
    print(int(ans))



Fixed submission:
N, K = map(int, input().split())

MOD = 10**9 + 7

dp = [[0]*(N+1) for _ in range(N+1)]
dp[0][0] = 1
for i in range(N):
    for j in range(i+1):
        dp[i+1][j] += dp[i][j]
        dp[i+1][j+1] += dp[i][j]

for i in range(1, K+1):
    a = dp[N-K+1][i]
    b = dp[K-1][i-1]
    ans = (a * b) % MOD
    print(ans)
Buggy python submission (verdict: Runtime Error):
import math

A, B, C, D = map(int, input().split())

def lcm(x, y):
    return((x * y) // math.gcd(x, y))

n = B - A + 1
cn = B // C - (A - 1) // C
dn = B // D - (A - 1) // D
cdn = B // lcm(C, D) - (A - 1) // lcm(C, D)

ans = n - (cn + dn - cdn)
print(ans)

Fixed submission:
import fractions

A, B, C, D = map(int, input().split())

def lcm(x, y):
    return((x * y) // fractions.gcd(x, y))

n = B - A + 1
cn = B // C - (A - 1) // C
dn = B // D - (A - 1) // D
cdn = B // lcm(C, D) - (A - 1) // lcm(C, D)

ans = n - (cn + dn - cdn)
print(ans)
Buggy python submission (verdict: Runtime Error):
N, M = map(int, input().split())
a = [int(input()) for _ in range(M)] # a_0...a_(M-1)

def fib(x): # フィボナッチ数列
    a, b = 1, 1
    if x == 0:
        return a
    elif x == 1:
        return b
    else:
        for i in range(x-1):
            a, b = b, a + b
        return b
"""
# 再帰だとTLEとかREとかになるよ
def fib(x): # フィボナッチ数列
    if x == 0:
        return(1)
    elif x == 1:
        return(1)
    else:
        return(f(x-1) + f(x-2))
"""

ans = 0
MOD = 10**9 + 7

if M == 0:
    ans += fib(N) % MOD
    print(ans)
else:
    ans += fib((a[0]-1) - 0) % MOD # 0段目からa_0-1段目に上る(その後a_0段目を飛ばしてa_0+1段目に上る)
    for i in range(1, M): # iは1からM-1
        stair = (a[i] - 1) - (a[i-1] + 1) # 登る段数
        if stair >= 0:
            ans *= fib(stair) % MOD # a_(i-1)+1段目からa_i-1段目に上る(その後a_i段目を飛ばしてa_i+1段目に上る)
        else:
            ans = 0
            break
    ans *= fib(N - (a[M-1] + 1)) % MOD # a_M-1段目からN段目に上る
    print(ans % MOD)


Fixed submission:
P, Q, R = map(int, input().split())

ans = min(P+Q, Q+R, R+P)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]

A = sorted(A)
BC = sorted(BC, key=lambda x: x[1], reverse=True)

D = []
for i in range(M):
    for j in range(BC[i][0]):
        D.append(BC[i][1])

n = min(len(D), N)

for i in range(n):
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break

ans = sum(A)

print(ans)


Fixed submission:
N, M = map(int, input().split())
A = list(map(int, input().split())) # 要素数N
BC = [list(map(int, input().split())) for _ in range(M)] # 要素数M

A = sorted(A) # 計算量NlogN
BC = sorted(BC, key=lambda x: x[1], reverse=True) # 計算量MlogM

D = []
for i in range(M): # 計算量N(len(D)<Nまでなので)
    for j in range(BC[i][0]):
        D.append(BC[i][1])
        if len(D) == N:
            break
    else:
        continue
    break

n = min(len(D), N)
for i in range(n): # 計算量N
    if A[i] < D[i]:
        A[i] = D[i]
    else:
        break

ans = sum(A)

print(ans)
Buggy python submission (verdict: Time Limit Exceeded):
N, K = map(int, input().split())
S = input()

l = []
now = 1 # 今見ている数(1から見る配列を作りたいので1で初期化)
cnt = 0

# lには(1の個数),(0の個数),(1の個数),(0の個数),...(1の個数)という感じのリストを入れたい(両端が0から始まるとしても1が0こあるとしてカウントしたい)
for i in range(N):
    if int(S[i]) == now:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        now = 1 - now # 0と1を切り替える(now ^= 1でも良い)
if cnt != 0:
    l.append(cnt)
if len(l) % 2 == 0: # (1の個数),(0の個数),(1の個数),(0の個数),...(0の個数)となってしまっていたら最後に0を入れておく
    l.append(0)
# print(l)

ans = 0
width = 2 * K + 1

for i in range(0, len(l), 2):
    tmp = 0
    left = i
    right = min(i + width, len(l))
    for j in range(left, right): # leftからright-1まで
        tmp += l[j]
    ans = max(ans, tmp)

print(ans)


Fixed submission:
N, K = map(int, input().split())
S = input()

l = []
now = 1 # 今見ている数(1から見る配列を作りたいので1で初期化)
cnt = 0

# lには(1の個数),(0の個数),(1の個数),(0の個数),...(1の個数)という感じのリストを入れたい(両端が0から始まるとしても1が0こあるとしてカウントしたい)
for i in range(N):
    if int(S[i]) == now:
        cnt += 1
    else:
        l.append(cnt)
        cnt = 1
        now = 1 - now # 0と1を切り替える(now ^= 1でも良い)
if cnt != 0:
    l.append(cnt)
if len(l) % 2 == 0: # (1の個数),(0の個数),(1の個数),(0の個数),...(0の個数)となってしまっていたら最後に0を入れておく
    l.append(0)
# print(l)

ans = 0
width = 2 * K + 1

left = 0
right = 0
tmp = 0 # [left, right)の総和
for i in range(0, len(l), 2):
    nextleft = i # 0,2,4,...
    nextright = min(i + width, len(l)) # 0+width,2+width,...
    while nextleft > left:
        tmp -= l[left]
        left += 1
    while nextright > right:
        tmp += l[right]
        right += 1
    ans = max(ans, tmp)

"""
# 愚直に足し算を繰り返すとTLE
for i in range(0, len(l), 2): # ここを2ごとにすることで1の個数を数えられる
    tmp = 0
    left = i
    right = min(i + width, len(l))
    for j in range(left, right): # leftからright-1まで
        tmp += l[j]
    ans = max(ans, tmp)
"""

print(ans)
Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

s.insert(0, ['.']*W)
s.append(['.']*W)
for i in range(W+2):
    s[i].insert(0, '.')
    s[i].append('.')
#print(s)

if H == W == 1:
    print('Yes')
else:
    flag = False
    for i in range(1, H+1):
        for j in range(1, W+1):
            if s[i][j] == '#':
                if s[i][j-1] == s[i][j+1] == s[i-1][j] == s[i+1][j] == '.':
                    print('No')
                    flag = True
                    break
        if flag:
            break
    else:
        print('Yes')

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

flag = False
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if (j-1 >= 0 and s[i][j-1] == '.') and (j+1 < W and s[i][j+1] == '.') and (i-1 >= 0 and s[i-1][j] == '.') and (i+1 < H and s[i+1][j] == '.'):
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')

Buggy python submission (verdict: Runtime Error):
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

s.insert(0, ['.']*W)
s.append(['.']*W)
for i in range(W+2):
    s[i].insert(0, '.')
    s[i].append('.')
#print(s)

flag = False
for i in range(1, H+1):
    for j in range(1, W+1):
        if s[i][j] == '#':
            if s[i][j-1] == s[i][j+1] == s[i-1][j] == s[i+1][j] == '.':
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')

Fixed submission:
H, W = map(int, input().split())
s = [list(input()) for _ in range(H)]

flag = False
for i in range(H):
    for j in range(W):
        if s[i][j] == '#':
            if (j-1 >= 0 and s[i][j-1] == '.') and (j+1 < W and s[i][j+1] == '.') and (i-1 >= 0 and s[i-1][j] == '.') and (i+1 < H and s[i+1][j] == '.'):
                print('No')
                flag = True
                break
    if flag:
        break
else:
    print('Yes')
Buggy python submission (verdict: Runtime Error):
S = input()
T = input()

N, M = len(S), len(T)

# N>=Mのとき
for i in range(max(0,N-M), -1, -1):
    # 今着目しているSの部分
    now = S[i:i+M]

    # nowにTを入れられるかチェック
    for j in range(M):
        if now[j] == '?' or now[j] == T[j]:
            continue
        else:
            break
    else:
        # 入れられるならその部分をTに置換
        S = S[0:i] + T + S[i+M:N]
        # 残った?をaに置換
        S = S.replace('?', 'a')
        print(S)
        break
else:
    # どこにもTを入れられなかったら
    print('UNRESTORABLE')


Fixed submission:
S = input()
T = input()

N, M = len(S), len(T)

if N < M:
    print('UNRESTORABLE')
else:
    for i in range(max(0,N-M), -1, -1):
        # 今着目しているSの部分
        # 後ろから探査
        now = S[i:i+M]

        # nowにTを入れられるかチェック
        for j in range(M):
            if now[j] == '?' or now[j] == T[j]:
                continue
            else:
                break
        else:
            # 入れられるならその部分をTに置換
            S = S[0:i] + T + S[i+M:N]
            # 残った?をaに置換
            S = S.replace('?', 'a')
            print(S)
            break
    else:
        # どこにもTを入れられなかったら
        print('UNRESTORABLE')
Buggy python submission (verdict: Runtime Error):
N = int(input())

ans = 1
for i in range(7)
    if 2**i < N:
        ans = 2**i
    else:
        break

print(ans)

Fixed submission:
N = int(input())

ans = 1
for i in range(7):
    if 2**i <= N:
        ans = 2**i
    else:
        break

print(ans)
Buggy python submission (verdict: Runtime Error):
N = import()
output = N*N*N
print(output)

Fixed submission:
print((int(input()))**3)
Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

output=0

for i in range(3):
    if int(S[0,i])==int(T[0,i]):
        output=output+1
    else :
        pass
    
print(output)

Fixed submission:
S=input()
T=input()

output=0

for i in range(3):
    if S[i]==T[i]:
        output=output+1
    else :
        pass
    
print(output)

Buggy python submission (verdict: Runtime Error):
S=input()
T=input()

output=0

for i in range(3):
    if S[0,i]==T[0,i]:
        output=output+1
    else :
        pass
    
print(output)
        

Fixed submission:
S=input()
T=input()

output=0

for i in range(3):
    if S[i]==T[i]:
        output=output+1
    else :
        pass
    
print(output)
Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
n=(B-1)/(A-1)

if n>=1:
    if n==int(n):
        output=n
    else :
       output=int(n)+1
else :pass

print(output)   

Fixed submission:
A,B=map(int,input().split())
n=(B-1)/(A-1)
if n>=1:
    if n==int(n):
        output=int(n)
    else :
        output=int(n)+1
elif n<1 and n>0:
    output=1
else:
    output=0
print(output)

Buggy python submission (verdict: Runtime Error):
A,B=map(int,input().split())
#
#B<=n*(A-1)+1
n=(B-1)/(A-1)

if n>=1:
    if n==int(n):
        output=n
    else :
       output=int(n)+1
else :pass

print(output)   

Fixed submission:
A,B=map(int,input().split())
n=(B-1)/(A-1)
if n>=1:
    if n==int(n):
        output=int(n)
    else :
        output=int(n)+1
elif n<1 and n>0:
    output=1
else:
    output=0
print(output)