Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Runtime Error):
for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,o=(a+b)//(min(a,b)+1),"";x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	if a*l<=b:x,y=0,a+b
	elif b*l<=a:x,y=a+b,0
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

Fixed submission:
T=int(input())
for TT in range(T):
	a,b,c,d=map(int,input().split(' '))
	l,x,y=(a+b)//(min(a,b)+1),0,0
	if a*l<=b:
		y=a+b
	elif b*l<=a:
		x=a+b
	else:
		x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	out=""
	for i in range(c,d+1):
		if i<=x:
			out+="AB"[i%(l+1)==0]
		elif a+b-i+1<=y:
			out+="BA"[(a+b-i+1)%(l+1)==0]
		else:
			out+="AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(out)

Buggy python submission (verdict: Runtime Error):
for t in range(int(input())):
	a,b,c,d=map(int,input().split(' '));l,x,y,o=(a+b)//(min(a,b)+1),(a*l-b)//(l-1),(b*l-a)//(l-1),""
	if a*l<=b:x,y=0,a+b
	elif b*l<=a:x,y=a+b,0
	for i in range(c,d+1):o+="AB"[i%(l+1)==0] if i<=x else "BA"[(a+b-i+1)%(l+1)==0] if a+b-i+1<=y else "AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(o)

Fixed submission:
T=int(input())
for TT in range(T):
	a,b,c,d=map(int,input().split(' '))
	l,x,y=(a+b)//(min(a,b)+1),0,0
	if a*l<=b:
		y=a+b
	elif b*l<=a:
		x=a+b
	else:
		x,y=(a*l-b)//(l-1),(b*l-a)//(l-1)
	out=""
	for i in range(c,d+1):
		if i<=x:
			out+="AB"[i%(l+1)==0]
		elif a+b-i+1<=y:
			out+="BA"[(a+b-i+1)%(l+1)==0]
		else:
			out+="AB"[a-x+x//(l+1)-y//(l+1)==0]
	print(out)
Buggy python submission (verdict: Runtime Error):
from math import gcd
MOD = 1000000007
def pw(x, y):
    ans = 1
    while y > 0:
        if y % 2:
            ans = ans * x % MOD
        x = x * x % MOD
        y //= 2
    return ans
H, W, T = map(int, input().split())
HT = gcd(H, T)
WT = gcd(W, T)
H //= HT
W //= WT
print(pw(pw(2, H) + pw(2, W) + pw(2, gcd(H, W)) - 3, HT * WT))

Fixed submission:
from fractions import gcd
MOD = 1000000007
def pw(x, y):
    ans = 1
    while y > 0:
        if y % 2:
            ans = ans * x % MOD
        x = x * x % MOD
        y //= 2
    return ans
H, W, T = map(int, input().split())
HT = gcd(H, T)
WT = gcd(W, T)
H //= HT
W //= WT
print(pw(pw(2, H) + pw(2, W) + pw(2, gcd(H, W)) - 3, HT * WT))
Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
ans = [0 for x in range(n)]
g = [list() for x in range(n)]
for i in range (n - 1) :
    v, u = map(int, input().split())
    v -= 1
    u -= 1
    g[v].append(u)
    g[u].append(v)
for i in range (q):
    p, x = map(int, input().split())
    p -= 1;
    ans[p] += x
def dfs(v, p):
    for u in g[v]:
        if (u != p) :
            ans[u] += ans[v]
            dfs(u, v)
dfs(0, -1)
print(*ans)

Fixed submission:
from collections import deque

n, q = map(int, input().split())
ans = [0 for x in range(n)]
g = [list() for x in range(n)]
for i in range (n - 1) :
    v, u = map(int, input().split())
    v -= 1
    u -= 1
    g[v].append(u)
    g[u].append(v)
for i in range (q):
    p, x = map(int, input().split())
    p -= 1;
    ans[p] += x
dq = deque()
dq.append((0, -1))
while (len(dq)) :
    v, p = dq.pop()
    for u in g[v]:
        if (u != p) :
            ans[u] += ans[v]
            dq.append((u, v))
print(*ans)

Buggy python submission (verdict: Runtime Error):
n, q = map(int, input().split())
ans = [0 for x in range(n)]
g = [list() for x in range(n)]
for i in range (n - 1) :
    v, u = map(int, input().split())
    v -= 1
    u -= 1
    g[v].append(u)
    g[u].append(v)
for i in range (q):
    p, x = map(int, input().split())
    p -= 1;
    ans[p] += x
def dfs(v, p):
    for u in g[v]:
        if (u != p) :
            ans[u] += ans[v]
            dfs(u, v)
dfs(0, -1)
for x in ans:
    print(x, end = ' ')

Fixed submission:
from collections import deque

n, q = map(int, input().split())
ans = [0 for x in range(n)]
g = [list() for x in range(n)]
for i in range (n - 1) :
    v, u = map(int, input().split())
    v -= 1
    u -= 1
    g[v].append(u)
    g[u].append(v)
for i in range (q):
    p, x = map(int, input().split())
    p -= 1;
    ans[p] += x
dq = deque()
dq.append((0, -1))
while (len(dq)) :
    v, p = dq.pop()
    for u in g[v]:
        if (u != p) :
            ans[u] += ans[v]
            dq.append((u, v))
print(*ans)
Buggy python submission (verdict: Runtime Error):
a,b = map(int, input(),split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

Fixed submission:
a,b = map(int, input().split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

Buggy python submission (verdict: Runtime Error):
a,b = map(int, input())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)

Fixed submission:
a,b = map(int, input().split())
ans = max(a + b, 2*a-1, 2*b-1)
print(ans)
Buggy python submission (verdict: Runtime Error):
n = int(input())
l = [int.input() for i in range(n)]
s = sorted(l)
sum_of_s = sum(s)
if sum_of_s > 2 * s[-1]:
  print('Yes')
else:
  print('No')

Fixed submission:
n = input()
L = list(map(int, input().split()))
print('Yes' if sum(L) > 2 * max(L) else 'No')
Buggy python submission (verdict: Runtime Error):
c,a,b = map(int,input().split())
area = c*a//2
print(ans)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)

Buggy python submission (verdict: Runtime Error):
c,a,b = map(int,input().split())
area = c * a // 2
print(ans)

Fixed submission:
a,b,c=map(int,input().split())
print(a*b//2)
Buggy python submission (verdict: Runtime Error):
import math
n, k = map(int, input().split())
h = list(map(int, input().split()))

def frog(n, k, h):
    d = [math.inf] * n
    d[0] = 0
    
    for i in range(1, n):
        
        d[i] = min(d[j] + abs(h[i] - h[j]) for j in range(max(i-k, 0), i))
    return d[n-1]
    
print(frog(n, k, h))

Fixed submission:
n, k = map(int, input().split())
h = list(map(int, input().split()))

def frog(n, k, h):
    import math
    d = [float('inf')] * n
    d[0] = 0
    
    for i in range(1, n):
        
        d[i] = min(d[j] + abs(h[i] - h[j]) for j in range(max(i-k, 0), i))
    return d[n-1]
    
print(frog(n, k, h))
Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)
 

Fixed submission:
n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p)//2)

Buggy python submission (verdict: Runtime Error):
n = int(input())
p = [int(input()) for in range(n)]
print(sum(p) - max(p)//2)



Fixed submission:
n = int(input())
p = [int(input()) for i in range(n)]
print(sum(p) - max(p)//2)
Buggy python submission (verdict: Runtime Error):
x = input()

print('YES" if x in '753' else 'NO')


Fixed submission:
x = input()
 
print('YES' if x in '753' else 'NO')
Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input().split())
ans1 = max(a+b, a-b)
ans = max(ans1, a * b)
print(ans)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))

Buggy python submission (verdict: Runtime Error):
a,b,c = map(int, input())
ans1 = max(a+b, a-b)
ans = max(ans1, a * b)
print(ans)

Fixed submission:
a,b=map(int,input().split())
print(max(a+b,a-b,a*b))
Buggy python submission (verdict: Runtime Error):
print(input().count('1))

Fixed submission:
print(input().count("1"))
Buggy python submission (verdict: Runtime Error):
s = input()
sum_of_digits = sum(map(int, s))
if int(s) % sum_of_digts == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')

Buggy python submission (verdict: Runtime Error):
s = input()
sum_of_digits = sum(map(int, s))
if (int)s % sum_of_digits == 0:
  print('Yes')
else:
  print('No')

Fixed submission:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')

Buggy python submission (verdict: Runtime Error):
s = input()
sum_of_digits = sum(map(int, s))
if (int)s % sum_of_digits:
  print('Yes')
else:
  print('No')

Fixed submission:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')

Buggy python submission (verdict: Runtime Error):
x = input()
sum_of_digits = sum(map(int, x))
check = (int)x % sum_of_digits
print('No' if check else 'Yes')

Fixed submission:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')

Buggy python submission (verdict: Runtime Error):
x = input()
n = (int)x
sum_of_digits = sum(map(int, x))
check = n % sum_of_digits
print('No' if check else 'Yes')



Fixed submission:
x = input()
sum_of_digits = sum(map(int, x))
check = int(x) % sum_of_digits
print('No' if check else 'Yes')
Buggy python submission (verdict: Runtime Error):
a, b = int(input().split())
print((a-1) * (b - 1))

Fixed submission:
n,m=map(int,input().split())
print((n-1)*(m-1))
Buggy python submission (verdict: Runtime Error):
l = [int(input()) for _ in range(3)]
s = sorted(l)[::-1]
ans = s[0] + s[1]
print(ans)

Fixed submission:
a,b,c = sorted(map(int, input().split()))
ans = a + b
print(ans)
Buggy python submission (verdict: Runtime Error):
a, b = map(int, input().split())
sum = a + b
if sum >= 10:
  print('error')
else:
  print(ans)

Fixed submission:
a, b = map(int, input().split())
temp_ans = a + b
if temp_ans >= 10:
  print('error')
else:
  print(temp_ans)
Buggy python submission (verdict: Runtime Error):
a,b,c,d = map(int, input().split())
rectangle1 = a * b
rectangel2 = c * d
ans = max(rectangle1, rectangle2)
print(ans)

Fixed submission:
a,b,c,d = map(int, input().split())
rectangle1 = a * b
rectangle2 = c * d
ans = max(rectangle1, rectangle2)
print(ans)
Buggy python submission (verdict: Runtime Error):
n, l = map(int(input().split()))
l = [for i in range(n)]
s = sorted(l)
print(*s,sep = "")

Fixed submission:
n, l = map(int , input().split())
s = sorted([input() for i in range(n)])
print(*s, sep = "")

# 1次元リストをアンパックを使用して出力する場合、print(*リスト名)で出力する。

Buggy python submission (verdict: Runtime Error):
n, l = map(int(input()))
l = [for i in range(n)]
s = sorted(l)
print(*s,sep = "")

Fixed submission:
n, l = map(int , input().split())
s = sorted([input() for i in range(n)])
print(*s, sep = "")

# 1次元リストをアンパックを使用して出力する場合、print(*リスト名)で出力する。
Buggy python submission (verdict: Runtime Error):
from sys import stdin
input = stdin.readline

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x=0, y=0):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

N = int(input().rsplit())
if N < 1000:
  print("ABC")
else:
  print("ABD")


Fixed submission:
from sys import stdin
input = stdin.readline

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

def Decimal(x):
  print("{0:.10f}".format(x))

class Pair:
  def __init__(self, x=0, y=0):
    self.first = x
    self.second = y

  def __repr__(self):
    return '{0} {1}'.format(self.first, self.second)

  def __lt__(self, pi):
    return self.first < pi.second

def POW(x, n):
  ret = 1
  while n:
    if n&1:
      ret *= x
    x *= x
    n >>= 1
  return ret

N = int(input().rstrip())
if N < 1000:
  print("ABC")
else:
  print("ABD")
Buggy python submission (verdict: Time Limit Exceeded):
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()

DEF_MIN = max(h)-min(h)

for i in range(n-k+1):
    tmp = max(h[i:i+k])-min(h[i:i+k])
    DEF_MIN = min(DEF_MIN, tmp)

print(DEF_MIN)

Fixed submission:
n, k = map(int, input().split())
h = [int(input()) for _ in range(n)]

h.sort()

DEF_MIN = max(h)-min(h)

for i in range(n-k+1):
    tmp = h[i+k-1]-h[i]
    DEF_MIN = min(DEF_MIN, tmp)

print(DEF_MIN)
Buggy python submission (verdict: Runtime Error):
import math

n,m = map(int, input().split())
s = input()
t = input()

gcd = math.gcd(n,m)
lcm = n*m//gcd

a = lcm//n
b = lcm//m

flag=0
le = min(n,m)//(min(n,m)//gcd)

for i in range(le):
    # print(i*b, i*a)
    if s[i*b]!=t[i*a]:
        flag=1

if flag==1:
    print(-1)
else:
    print(lcm)

Fixed submission:
def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

n,m = map(int, input().split())
s = input()
t = input()

gcd_ = gcd(n,m)
lcm = n*m//gcd_

a = lcm//n
b = lcm//m

flag=0
le = min(n,m)//(min(n,m)//gcd_)

for i in range(le):
    if s[i*b]!=t[i*a]:
        flag=1

if flag==1:
    print(-1)
else:
    print(lcm)
Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())

ma = m//n
re = m%n

flag=0

if re==0:
    while(flag==0):
        if m%ma==0:
            print(ma)
            flag = 1
        ma -=1
else:
    flag2=0
    while(flag==0):
        if m%ma==0:
            print(ma)
            flag = 1
            
        if flag2==0:
            ma -=1
            if ma%re==0:
                flag2=1
        
        else:
            ma -= re

Fixed submission:
n,m = map(int, input().split())
 
ma = m//n
 
flag=0
 
while(flag==0):
    if m%ma==0:
        print(ma)
        flag = 1
    ma -=1

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

ma = m//n

flag=0

while(flag==0):
    if m%ma==0:
        print(ma)
        flag = 1
    ma -=1


Fixed submission:
n,m = map(int, input().split())
 
ma = m//n
 
flag=0
 
while(flag==0):
    if m%ma==0:
        print(ma)
        flag = 1
    ma -=1
Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    if i==99:
        break
    i +=1
    
if k<i:
    print(1)
else:
    print(s[i])

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

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    i +=1
    
if k<i:
    print(1)
else:
    print(s[i])

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

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])

Buggy python submission (verdict: Runtime Error):
s = input()
k = int(input())

i=0
while(s[i]=="1"):
    i +=1
print(s[i])

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

i=0
while(s[i]=="1"):
    if i==(len(s)-1):
        break
    i +=1
    
if k<(i+1):
    print(1)
else:
    print(s[i])
Buggy python submission (verdict: Time Limit Exceeded):
n,m,Q = list(map(int, input().split()))

l=[]
r=[]
for j in range(m):
    l_tmp, r_tmp = list(map(int, input().split()))
    l.append(l_tmp)
    r.append(r_tmp)

p=[]
q=[]
for k in range(Q):
    p_tmp, q_tmp = list(map(int, input().split()))
    p.append(p_tmp)
    q.append(q_tmp)
    

for qi in range(Q):
    out = 0
    for i in range(m):
        if(l[i]>=p[qi] and r[i]<=q[qi]):
            out += 1
    print(out)

Fixed submission:
n,m,Q = list(map(int, input().split()))

l=[]
r=[]
for j in range(m):
    l_tmp, r_tmp = list(map(int, input().split()))
    l.append(l_tmp)
    r.append(r_tmp)

p=[]
q=[]
for k in range(Q):
    p_tmp, q_tmp = list(map(int, input().split()))
    p.append(p_tmp)
    q.append(q_tmp)
    
su = [[0 for _ in range(n+1)] for __ in range(n+1)]

def sumTable(L, R):
    for i in range(m):
        su[L[i]][R[i]] += 1
    
    for i in range(1,n+1):
        for j in range(1, n+1):
            su[i][j] += su[i-1][j]
            su[i][j] += su[i][j-1]
            su[i][j] -= su[i-1][j-1]

def getSum(ll,rr):
    ans = su[rr][rr] - su[rr][ll-1] -su[ll-1][rr] + su[ll-1][ll-1]
    return ans
  
sumTable(l,r)

import copy
ss = copy.copy(su)

for qi in range(Q):
    su = copy.copy(ss)
    print(getSum(p[qi], q[qi]))

Buggy python submission (verdict: Runtime Error):
for qi in range(Q):
    out = 0
    for i in range(m):
        if(l[i]>=p[qi] and r[i]<=q[qi]):
            out += 1
    print(out)

Fixed submission:
n,m,Q = list(map(int, input().split()))

l=[]
r=[]
for j in range(m):
    l_tmp, r_tmp = list(map(int, input().split()))
    l.append(l_tmp)
    r.append(r_tmp)

p=[]
q=[]
for k in range(Q):
    p_tmp, q_tmp = list(map(int, input().split()))
    p.append(p_tmp)
    q.append(q_tmp)
    
su = [[0 for _ in range(n+1)] for __ in range(n+1)]

def sumTable(L, R):
    for i in range(m):
        su[L[i]][R[i]] += 1
    
    for i in range(1,n+1):
        for j in range(1, n+1):
            su[i][j] += su[i-1][j]
            su[i][j] += su[i][j-1]
            su[i][j] -= su[i-1][j-1]

def getSum(ll,rr):
    ans = su[rr][rr] - su[rr][ll-1] -su[ll-1][rr] + su[ll-1][ll-1]
    return ans
  
sumTable(l,r)

import copy
ss = copy.copy(su)

for qi in range(Q):
    su = copy.copy(ss)
    print(getSum(p[qi], q[qi]))
Buggy python submission (verdict: Runtime Error):
N = int(input())
ts = fetch_Hosu(N)

le = len(ts)
numl = [0]* 15

for i in range(15):
    tmp = int(ts[2*i+1:2*i+3])
    
    if tmp ==1:
        numl[i]  += 11
    elif tmp ==11:
        if i>1:
            numl[i-1]  += 11
        numl[i]  += 1
    else:
        numl[i]  += tmp
    
#     print(numl)

# print(numl)

for j in range(len(numl)):
    if numl[14-j]==21:
        numl[13-j]  += 11
        numl[14-j]  = 1

    if numl[14-j]==12:
        numl[14-j]  = 0
    
    if numl[14-j]==22:
        numl[14-j]  = 10
    
# print(numl)
outttt = ["{0:02d}".format(i) for i in numl]
# print(outttt)
ttt=""
for k in range(len(outttt)):
    ttt += outttt[k]

ttt += ts[-1]

if int(ttt)==0:
    print(0)
else:
    tetee = str(ttt)
    tpl = tetee[2:].find("1")
    print(tetee[tpl+2:])

Fixed submission:
N=int(input())

lr = ""
i=1

if N==0:
    print(0)

else:    
    while N!=0:
        if N%(2**i)!=0:
            lr = "1" + lr
            N = N - (-2)**(i-1)
        else:
            lr = "0" + lr

        i+=1

    print(lr)

Buggy python submission (verdict: Runtime Error):
N = int(input())
ts = fetch_Hosu(N)

le = len(ts)
numl = [0]* 15

for i in range(15):
    tmp = int(ts[2*i+1:2*i+3])
    
    if tmp ==1:
        numl[i]  += 11
    elif tmp ==11:
        if i>1:
            numl[i-1]  += 11
        numl[i]  += 1
    else:
        numl[i]  += tmp
    
#     print(numl)

# print(numl)

for j in range(len(numl)):
    if numl[14-j]==21:
        numl[13-j]  += 11
        numl[14-j]  = 1

    if numl[14-j]==12:
        numl[14-j]  = 0
    
    if numl[14-j]==22:
        numl[14-j]  = 10
    
# print(numl)
outttt = ["{0:02d}".format(i) for i in numl]
# print(outttt)
ttt=""
for k in range(len(outttt)):
    ttt += outttt[k]

ttt += ts[-1]

# print(ttt)
tetee = str(ttt)
tpl = tetee[2:].find("1")
print(tetee[tpl+2:])

Fixed submission:
N=int(input())

lr = ""
i=1

if N==0:
    print(0)

else:    
    while N!=0:
        if N%(2**i)!=0:
            lr = "1" + lr
            N = N - (-2)**(i-1)
        else:
            lr = "0" + lr

        i+=1

    print(lr)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
s = input()

MIN = n
for i in range(n):
    tmp = s[:i].count("W") + s[i+1:].count("E")
    MIN = min(MIN, tmp)
print(MIN)

Fixed submission:
n = int(input())
s = input()

num = [0 for _ in range(n)]

num[0] = s[1:].count("E")
for i in range(1,n):
    num[i] = num[i-1] + int(s[i-1]=="W") - int(s[i]=="E")

print(min(num))
Buggy python submission (verdict: Runtime Error):
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
ss = [["." for i in range(w+2)] for j in range(h+2)]

for i in range(w):
    for j in range(h):
        ss[i+1][j+1]=s[i][j]

flag = 1

for i in range(h):
    for j in range(w):
        if ss[i+1][j+1]=="#":
            if ss[i][j+1]=="." and ss[i+2][j+1]=="." and ss[i+1][j]=="." and ss[i+1][j+2]==".":
                flag = 0
                break
                
if flag==1:
    print("Yes")
else:
    print("No")

Fixed submission:
h, w = list(map(int, input().split()))
s = [list(input()) for i in range(h)]
ss = [["." for i in range(w+2)] for j in range(h+2)]

for i in range(h):
    for j in range(w):
        ss[i+1][j+1]=s[i][j]

flag = 1

for i in range(h):
    for j in range(w):
        if ss[i+1][j+1]=="#":
            if ss[i][j+1]=="." and ss[i+2][j+1]=="." and ss[i+1][j]=="." and ss[i+1][j+2]==".":
                flag = 0
                break
                
if flag==1:
    print("Yes")
else:
    print("No")
Buggy python submission (verdict: Runtime Error):
for i in range(100000):
    price_new = i*2*c + max(0, x-i)*a + max(0, y-i)*b
    if i==0:
        price = price_new
    else:
        price = min(price, price_new)

print(price)

Fixed submission:
a,b,c,x,y = list(map(int,input().split()))
for i in range(100001):
    price_new = i*2*c + max(0, x-i)*a + max(0, y-i)*b
    if i==0:
        price = price_new
    else:
        price = min(price, price_new)

print(price)
Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())
x = list(map(int, input().split()))

for i in range(n):
    tmp = x[:i]+x[i+1:]
#     print(tmp)
    print(sorted(tmp)[(n-1)//2])    

Fixed submission:
n = int(input())
x = list(map(int, input().split()))

x_s = sorted(x)
med2 = x_s[n//2]
med1 = x_s[n//2-1]
for i in range(n):
    if x[i]<=med1:
        print(med2)
    else:
        print(med1)
Buggy python submission (verdict: Runtime Error):

import sys
import numpy as np
from collections import Counter


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    max = A[-1]
    count = Counter(A)
    S = list(count.keys())
    C = []
    for s in S:
        if count[s] > 1:
            continue
        else:
            C.append(s)

    is_prime = np.ones(max + 1, np.bool)
    for a in A:
        if is_prime[a]:
            is_prime[a * 2 :: a] = 0
        else:
            continue
    answer = 0
    for c in C:
        if is_prime[c]:
            answer += 1
        else:
            continue
    print(answer)


if __name__ == "__main__":
    main()


Fixed submission:
import sys
import numpy as np
from collections import Counter


def input():
    return sys.stdin.readline().strip()


sys.setrecursionlimit(20000000)

MOD = 10 ** 9 + 7
INF = float("inf")


def main():
    N = int(input())
    A = list(map(int, input().split()))
    A.sort()
    max = A[-1]
    count = Counter(A)
    S = list(count.keys())
    C = []
    for s in S:
        if count[s] > 1:
            continue
        else:
            C.append(s)

    is_prime = np.ones(max + 1, np.bool)
    for a in A:
        if is_prime[a]:
            is_prime[a * 2 :: a] = 0
        else:
            continue
    answer = 0
    for c in C:
        if is_prime[c]:
            answer += 1
        else:
            continue
    print(answer)


if __name__ == "__main__":
    main()