Harryxun/GPT-100-sft-dataset huggingface dataset:
Problem p02795 (python)

Fixed submission:
h = int(input())
w = int(input())
n = int(input())

a = 0
ans = 0

if h < w:
    a = w
else:
    a = h

ans = n // a
# int(ans)
if n % a > 0:
    ans += 1

print(ans)

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0

list=[]

for i in range(k):
    list.append(s)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")

Buggy submission (verdict: Runtime Error):
h=(int)input()
w=(int)input()
n=(int)input()

if h < w:
    a =w
else:
    a=h

ans=n/a
if n%a > 0:
    ans+=1

print(ans)

Buggy submission (verdict: Runtime Error):
h=input()
w=input()
n=input()

if h < w:
    a =w
else:
    a=h

ans=n/a
if n%a > 0:
    ans+=1

print(ans)
Problem p02797 (python)

Fixed submission:
n,k,s = map(int,input().split())
a=0
b=0

list=[]

for i in range(k):
    list.append(s)

if len(list) < n:
    for i in range(n-len(list)):
        if s == 1:
            list.append(s+1)
        else:
            list.append(s-1)

for i in list:
    print(i,end=" ")

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0
if s % 2 == 1:
    a=(s-1)/2
    b=a+1
else:
    a=s/2
    b=s/2

if a==b:
    a-=1
    b+=1

a=int(a)
b=int(b)

list=[]
while k!=0:
    if k == 1:
        list.append(s)
        k-=1
    elif k >= 2:
        list.append(a)
        list.append(b)
        k-=1
    print(list,k)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")

Buggy submission (verdict: Runtime Error):
n,k,s = map(int,input().split())
a=0
b=0
if s % 2 == 1:
    a=(s-1)/2
    b=a+1
else:
    a=s/2
    b=s/2

a=int(a)
b=int(b)

list=[]
while k!=0:
    if k == 1:
        list.append(s)
        k-=1
    elif k >= 2:
        list.append(a)
        list.append(b)
        k-=1
    print(list,k)

if len(list) < n:
    for i in range(n-len(list)):
        list.append(s-1)

for i in list:
    print(i,end=" ")
Problem p02818 (python)

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

if A <= K :
    K -= A
    A = 0
    if B <= K :
        K -= B
        B = 0
    else:
        B -= K
else:
    A -= K

print("{} {}".format(A,B))

Buggy submission (verdict: Runtime Error):
A,B,K = input().split()

for i in range(K):
    if A != 0:
        A -= 1
    elif B != 0:
        B -= 1
    else:
        pass

print(A+" "+B)
Problem p02830 (python)

Fixed submission:
n=int(input())
a,b=input().split()
str=""
for i in range(n):
    str+=a[i]+b[i]
print(str)

Buggy submission (verdict: Runtime Error):
n=int(input())
a,b=input().split()
str=""
for i in range(n):
  str+=a[i]+b[i]
  
 print(str)
Problem p02999 (python)

Fixed submission:
A = list(map(int, input().split(" ")))
print([10, 0][A[0] < A[1]])

Buggy submission (verdict: Runtime Error):
A = map(int, input().split(" "))
print([10, 0][A[0] < A[1]])
Problem p03145 (python)

Fixed submission:
a = sorted(list(map(int,input().split())))
print(int(a[0]*a[1]/2))

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split())).sorted()
print(a[0]*a[1]/2)
Problem p03210 (python)

Fixed submission:
print(["NO","YES"][input() in "357"])

Buggy submission (verdict: Runtime Error):
print(["NO","YES"][x in input()])
Problem p03262 (python)

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


def allgcd(d):
    if len(d) == 1:
        return d
    ret_gcd = d[0]
    for i in d:
        ret_gcd = gcd(ret_gcd, i)
    return ret_gcd


def maxNumVisitCity(N, X, x):
    if len(x) == 1:
        return abs(x[0] - X)

    d = []
    for i in x:
        d.append(abs(i - X))
    return allgcd(d)


def main():
    N, X = map(int, input().split())
    x = list(map(int, input().split()))
    print(maxNumVisitCity(N, X, x))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
def gcd(a, b):
    if a > b:
        a, b = b, a
    while b > 0:
        a, b = b, a % b
    return a


def allgcd(d):
    if len(d) == 1:
        return d
    ret_gcd = d[0]
    for i in d:
        ret_gcd = gcd(ret_gcd, i)
    return ret_gcd


def maxNumVisitCity(N, X, x):
    if len(x) == 1:
        return abs(x[0] - X)

    d = []
    for i in x:
        d.append(abs(i - X))
    return allgcd(d)


def main():
    N, X = map(int, input().split())
    x = map(int, input().split())
    print(maxNumVisitCity(N, X, x))


if __name__ == '__main__':
    main()

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce


def maxNumVisitCity(N, X, x):
    d = []
    for i in x:
        d.append(abs(i - X))
    return reduce(math.gcd, d)


def main():
    N, X = map(int, input().split())
    x = map(int, input().split())
    print(maxNumVisitCity(N, X, x))


if __name__ == '__main__':
    main()
Problem p03264 (python)

Fixed submission:
def calcPairOddAndEven(num):
    if num % 2 == 0:
        return int((num / 2))**2
    else:
        return int(num / 2)*int(num / 2 + 1)


def main():
    numArray = [3, 6, 11, 50]
    for num in numArray:
        print(num, ":", calcPairOddAndEven(num))


def contest():
    print(calcPairOddAndEven(int(input())))

if __name__ == '__main__':
    contest()

Buggy submission (verdict: Runtime Error):
def calcPairOddAndEven(num):
    if num % 2 == 0:
        return int((num / 2))**2
    else:
        return int((num / 2)*num)


def main():
    numArray = [3, 6, 11, 50]
    for num in numArray:
        print(num, ":", calcPairOddAndEven(num))


def contest():
    print(calcPairOddAndEven(int(input()))

if __name__ == '__main__':
    contest()
Problem p03266 (python)

Fixed submission:
N, K = map(int,input().split())
print(int(N/K)**3+[int((N+K/2)/K)**3,0][K%2])

Buggy submission (verdict: Runtime Error):
N, K = map(int,input().split())
print(int(N/K)**3+[int((N+K/2)/K)**3][K%2])

Buggy submission (verdict: Runtime Error):
def is calc(N, K):
  count = 0
  for a in range(1, N):
    for b in range(1, N):
      c = N - a - b
      if c > 0:
        if a + b % N == 0 and b + c % N == 0 and a + c % N == 0:
          count += 1
  return count

if __name__ == '__main__':
  N, K = map(int, input().split())
  print(calc(N, K))
Problem p03282 (python)

Fixed submission:
def logic(S, K):
    if len(S) == 1:
        return int(S)
    if S[0:int(K)].replace("1","") == "":
        return 1
    a = S.replace("1", "")
    if len(a) == 0:
        return 1
    return int(a[0])


if __name__ == '__main__':
    print(logic(input(), input()))

Buggy submission (verdict: Runtime Error):
def logic(S, K):
    if len(S) == 1:
        return int(S)
    if S[0:5] == "11111":
        return 1
    a = S.replace("1", "")
    return int(a[0])


if __name__ == '__main__':
    print(logic(input(), input()))
Problem p03285 (python)

Fixed submission:
def calc(a):
  for a4 in range(26):
    for a7 in range(16):
      if a4*4+a7*7 == a:
        return "Yes"
  return "No"

if __name__ == '__main__':
  print(calc(int(input())))

Buggy submission (verdict: Runtime Error):
def calc(a):
  for a4 in range(26):
    for a7 in range(16):
      if a4*4+a7*7 is a:
        return "Yes"
  return "No"

if __name__ == '__main__':
  calc(int(input())

Buggy submission (verdict: Runtime Error):
def calc(a):
  a = int(input())
  for a4 in range(26):
    for a7 in range(16):
      if a4*4+a7*7 is a:
        return "Yes"
  return "No"

if __name__ == '__main__':
  calc(int(input())
Problem p03288 (python)

Fixed submission:
a = int(input())
print("ABC" if a<1200 else "ARC" if a<2800 else "AGC")

Buggy submission (verdict: Runtime Error):
C = ["ABC", "ARC" , "AGC"]
A = int(input())
print(C[(A>1200)+(A>2800)]

Buggy submission (verdict: Runtime Error):
a = int(input())
print(["ABC","ARC","AGC"][a<1200, a<2800, a>=2800])
Problem p02612 (python)

Fixed submission:
n = int(input())
 
a = n%1000
b = 1000-a
if b==1000:
  print(0)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())
 
a = n%1000
b = 1000-a
if b=1000:
  print(0)
else:
  print(b)

Buggy submission (verdict: Runtime Error):
n = int(input())

a = n%1000
b = 1000-a
if b=1000:
  print(0)
else:
  print(a)
Problem p02613 (python)

Fixed submission:
N =int(input())
list ={"AC":0, "WA":0, "TLE":0, "RE":0 }
 
for i in range(N):
  words = input()
  list[words]+=1
 
print("AC x "+str(list["AC"]))
print("WA x "+str(list["WA"]))
print("TLE x "+str(list["TLE"]))
print("RE x "+str(list["RE"]))

Buggy submission (verdict: Runtime Error):
N =int(input())
list ={"AC"=0, "WA"=0, "TLE"=0, "RE"=0 }
 
for i in range(N):
  words = input()
  list[words]+=1
 
print("AC x "+str(list["AC"]))
print("WA x "+str(list["WA"]))
print("TLE x "+str(list["TLE"]))
print("RE x "+str(list["RE"]))

Buggy submission (verdict: Runtime Error):
N =int(input())
list ={"AC"=0, "WA"=0, "TLE"=0, "RE"=0 }

for i in range(s):
  words = input()
  list[words]+=1

print("AC x "+str(list["AC"]))
print("WA x "+str(list["WA"]))
print("TLE x "+str(list["TLE"]))
print("RE x "+str(list["RE"]))
Problem p02675 (python)

Fixed submission:
s =int( input()[-1])
if s in [2, 4, 5, 7, 9]:
  print('hon')
elif s in [0, 1, 6, 8]:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
s =int( input())
a = s[-1]
if a in [2, 4, 5, 7, 9]:
  print('hon')
elif a in [0, 1, 6, 8]:
  print('pon')
else:
  print('bon')

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N[-1]
if a in [0,1,6,8]:
  print("pon")
elif a=="3":
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N[-1]
if a in [0,1,6,8]:
  print("pon")
elif a in [3]:
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N[-1]
if a="0","1","6","8":
  print("pon")
elif a="3":
  print("bon")
else:
  print("hon")

Buggy submission (verdict: Runtime Error):
N = int(input())
a = N[-1]
if a="0","1","6","8":
  print("pon")
  elif a="3":
    print("bon")
    else:
      print("hon")
Problem p02681 (python)

Fixed submission:
s= input()
t = input()
if t[:-1]==s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s,t = input()
if t[:-1]==s:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s,t = input()
if t[:-1]=s:
  print("Yes")
else:
  print("No")
Problem p02705 (python)

Fixed submission:
R=float(input())

print(R*2*3.141592)

Buggy submission (verdict: Runtime Error):
n,m=map(int,input().split())
a=list(map(int,input().split()))

A=sum(a)
if n-A<0:
  print(-1)
else :
    print(n-A)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=list(map(int,input().split()))

A=sum(a)
if N-A<0:
  print(-1)
else :
    print(N-A)

Buggy submission (verdict: Runtime Error):
N,M=map(int,input().split())
a=list(map(int,input().split()))

A=sum(a)
if N-A<0:
  print(-1)
  else :
    print(N-A)

Buggy submission (verdict: Runtime Error):
R=(float.input())

print(R**2*3.141592)

Buggy submission (verdict: Runtime Error):
R=(float.input())

print(R**2*3.14)
Problem p02608 (python)

Fixed submission:
N = int(input())


ans = [0]*(N+1)
i = 102
for x in range(1,i):
    for y in range(1,i):
        for z in range(1,i):
            total = (x + y + z)**2 - (x*y + y*z + x*z)
            if total <= N:
                ans[total] += 1

for i in range(1,N+1):
    print(ans[i])

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


ans = [0]*(N+1)
i = 102
for x in range(1,i):
    for y in range(1,i):
        for z in range(1,i):
            total = (x + y + z)**2 - (x*y + y*z + x*z)
            if total <= N+1:
                ans[total] += 1

for i in range(1,N+1):
    print(ans[i])

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



total = 0
ans = [0]*(N+1)
i = 100
for x in range(1,i):
    for y in range(1,i):
        for z in range(1,i):
            total = (x + y + z)**2 - (x*y + y*z + x*z)
            if total <= N+1:
                ans[total] += 1



for i in range(1,N+1):
    print(ans[i])
Problem p02923 (python)

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

max = 0
count = 0
for x in range(N-1):
  if H[x]>=H[x+1]:
    count += 1
  else:
    if max < count:
      max = count
    count=0
if max < count:
  max = count
print(max)

Buggy submission (verdict: Runtime Error):
input()
towers = list(map(int, input().split()))

ans = []
count = 0
for x in range(len(towers)-1):
  if towers[x] >= towers[x+1]:
    count+=1
  else:
    ans.append(count)
    count = 0
    
print(ans.max())
Problem p02714 (python)

Fixed submission:
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ret = 0
for i in range(1,n-1):
    m = min(i,n-i-1)
    for j in range(1,m+1):
        A,B,C = s[i],s[i-j],s[i+j]
        if A != B and A != C and B != C:
            ret += 1
ans = r*g*b - ret
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = 0
ans = r*g*b
for i in range(1,n-1):
    m = min(i,n-i-1)
    for j in range(1,m+1):
        A,B,C = s[i],s[i-j],s[i+j]
        if A != B and A != C and B != C:
            ans -= 1
if r == 0 or g == 0 or b == 0:
    ans = 0
elif r == 1 or g == 1 or b == 1:
    ans = 1
print(ans)
n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
ans = 0
ans = r*g*b
for i in range(1,n-1):
    m = min(i,n-i-1)
    for j in range(1,m+1):
        A,B,C = s[i],s[i-j],s[i+j]
        if A != B and A != C and B != C:
            ans -= 1
if r == 0 or g == 0 or b == 0:
    ans = 0
elif r == 1 or g == 1 or b == 1:
    ans = 1
print(ans)
Problem p02761 (python)

Fixed submission:
n,m = map(int,input().split())
sc = []
for _ in range(m):
    sc.append(list(map(int,input().split())))
tmp = [-1,-1,-1]
flag = False
for b in sc:
    s = b[0]
    c = b[1]
    if n >1 and s == 1 and c == 0:
        flag = True
        break
    if tmp[s-1] != -1 and tmp[s-1] != c:
        flag = True
        break
    tmp[s-1] = c
ans = 0

if not flag:
    for i in range(n):
        if tmp[i] == -1:
            if n == 1:
                tmp[i] = 0
            elif i == 0:
                tmp[i]=1
            else:
                tmp[i]=0
    for i in range(n):
        m = 10**(n-1-i)
        ans = ans + tmp[i]*m
else:
    ans = -1
print(ans)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
sc = []
for _ in range(m):
    sc.append(list(map(int,input().split())))
ans = -1
flag = False
if n == 1:
    tmp = sc[0][1]
    for x in sc:
        s = x[0]
        c = x[1]
        if tmp != c:
            break
        ans = tmp
elif n == 2:
    tmp = [-1,-1]
    for x in sc:
        s = x[0]
        c = x[1]
        if tmp[s-1] != c and tmp[s-1] != -1:
            flag = True
            break
        if s == 1 and c == 0:
            flag = True
            break
        tmp[s-1] = c
    if tmp[0]==-1:
        tmp[0] = 1
    if tmp[1]==-1:
        tmp[1] = 0
    if not flag:
        ans = tmp[0]*10+tmp[1]
else:
    tmp = [-1,-1,-1]
    for x in sc:
        s = x[0]
        c = x[1]
        if tmp[s-1] != c and tmp[s-1] != -1:
            flag = True
            break
        if s == 1 and c == 0:
            flag = True
            break
        tmp[s-1] = c
    if tmp[0]==-1:
        tmp[0] = 1
    if tmp[1]==-1:
        tmp[1] = 0
    if tmp[2]==-1:
        tmp[2] = 0
    if not flag:
        ans = tmp[0]*100+tmp[1]*10+tmp[2]
print(ans)
Problem p02796 (python)

Fixed submission:
n = int(input())
Y = [list(map(int,input().split())) for _ in range(n)]
X = []
for y in Y:
    X.append([y[0]+y[1],y[0]-y[1]])
X.sort()
ans = n
right = X[0][0]
for i in range(1,n):
    left = X[i][1]
    if left < right:
        ans -= 1
    else:
        right = X[i][0]
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
Y = [list(map(int,input().split())) for _ in range(n)]
X = []
for y in Y:
    X.append(y[0]-y[1],y[0]+y[1])
X.sort()
ans = n
right = X[0][1]
for i in range(1,n):
    left = X[i][0]
    if left < right:
        ans -= 1
    else:
        right = X[i][1]
print(ans)
Problem p02811 (python)

Fixed submission:
k,x = map(int,input().split())
if k*500 >= x:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
cnt = 0
flag = 0
for i in range(n):
  if s[i] == "A":
    flag = 1
  elif s[i] == "B" and flag == 1:
    flag = 2
  elif s[i] == "C" and flag == 2:
    cnt += 1
    flag = 0
  else:
    flag = 0
print(cnt)
Problem p02958 (python)

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

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) or (c == 0):
    ans = "YES"

print(ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
p = list(map(int,input().split()))

q = []
for x in range(N):
    q.append(x+1)

i = 0
c = 0
ans = "NO"
while(i < N):
    if p[i] != q[i]:
        c += 1
    if c > 2:
        break
    i += 1

if (c == 2) && (c == 0):
    ans = "YES"

print(ans)
Problem p03029 (python)

Fixed submission:
a,p=map(int,input().split())
print((3*a+p)//2)

Buggy submission (verdict: Runtime Error):
N = int(input())
B = []
for i in range(N):
    s,p = map(str,input().split())
    tmp = [i+1,s,int(p)]
    B.append(tmp)
B.sort(key=lambda x:x[2],reverse=True)
B.sort(key=lambda x:x[1])
for x in B:
    print(x[0])

Buggy submission (verdict: Runtime Error):
a,p=map(int,input().split())
print((3*a+p)//2))
Problem p03035 (python)

Fixed submission:
A,B = map(int,input().split())
if A>=13 :
  print(B)
elif A >=6 and A<=12:
  print(B//2)
else:
  print(0)

Buggy submission (verdict: Runtime Error):
A,B = map(int,input().split())
if A>=13 :
  print(B)
elif A >=6 and A<=12:
  print(B//2)
 else:
  print(0)
Problem p03068 (python)

Fixed submission:
n=int(input())
s=input()
k=int(input())
r=s[k-1]
ans=""
for i in range(n):
  if s[i]==r:
    ans+=r
  else:
    ans+="*"
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
s=input()
k=int(input())
r=s[k]
ans=""
for i in range(n):
  if s[i]==r:
    ans+=r
  else:
    ans+="*"
print(ans)
Problem p03126 (python)

Fixed submission:
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c-1] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c] += 1
cnt = 0
for p in d:
    if p == n:
        cnt+=1
print(cnt)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
a = []
d = [0]*m
for _ in range(n):
    tmp = list(map(int,input().split()))
    a.append(tmp[1:])
for b in a:
    for c in b:
        d[c] += 1
print(d.count(n))
Problem p03262 (python)

Fixed submission:
import fractions
from functools import reduce

def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))

Buggy submission (verdict: Runtime Error):
import math
from functools import reduce
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

n,x = map(int,input().split())
y = list(map(int,input().split()))
dist = []
for b in y:
    dist.append(abs(b-x))
print(gcd_list(dist))
Problem p03292 (python)

Fixed submission:
import itertools
a=list(map(int,input().split()))
ans=999
l=[0,1,2]
for x in itertools.permutations(l,3):
  tmp=abs(a[x[0]]-a[x[1]])+abs(a[x[1]]-a[x[2]])
  if tmp <=ans:
    ans =tmp
print(ans)

Buggy submission (verdict: Runtime Error):
import itertools
a=map(int,input().split())
ans=999
l=[0,1,2]
for x in itertools(l,3):
  tmp=abs(a[x[0]]-a[x[1]])+abs(a[x[1]]-a[x[2]])
  if tmp <=ans:
    ans =tmp
print(ans)
Problem p03302 (python)

Fixed submission:
a,b = map(int,input().split())
if a+b == 15:
  print("+")
elif a*b == 15:
  print("*")
else:
  print("x")

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
if a+b = 15:
  print("+")
elif a*b = 15:
  print("*")
else:
  print("x")
Problem p03316 (python)

Fixed submission:
s=input()
n=int(s)
ss=0
for i in range(len(s)):
  ss+=int(s[i])
if n%ss==0:
  print("Yes")
else:
  print("No")

Buggy submission (verdict: Runtime Error):
s=input()
n=int(s)
ss=0
for i in len(s):
  ss+=int(s[i])
if n%ss=0:
  print("Yes")
else:
  print("No")
Problem p03361 (python)

Fixed submission:
def func(x,y):
    global s,h,w,seen
    d = [1,-1]
    flag = False
    for i in d:
        if x+i < h and x+i >= 0:
            if s[x+i][y] == "#":
                seen[(x+i)*w+y] = 1
                seen[x*w+y] = 1
                flag = True
        if y+i < w and y+i >= 0:
            if s[x][y+i] == "#":
                seen[x*w+y+i] = 1
                seen[x*w+y] = 1
                flag = True
    return flag


h,w = map(int,input().split())
s = [input() for _ in range(h)]
seen = [0 for _ in range(h*w)]
ans = False
for i in range(h):
    for j in range(w):
        if s[i][j] == "#" and seen[j + i*w] == 0:
            if not func(i,j):
                ans = True
if ans:
    print("No")
else:
    print("Yes")

Buggy submission (verdict: Runtime Error):
def func(x,y):
    global s,h,w,seen
    d = [1,-1]
    flag = False
    for i in d:
        if x+i < h and x+i >= 0:
            if s[x+i][y] == "#":
                seen[x+i+y*w] = 1
                seen[x+y*w] = 1
                flag = True
        if y+i < h and y+i >= 0:
            if s[x][y+i] == "#":
                seen[x+(y+i)*w] = 1
                seen[x+y*w] = 1
                flag = True
    return flag


h,w = map(int,input().split())
s = [input() for _ in range(h)]
seen = [0 for _ in range(h*w)]
ans = False
for i in range(h):
    for j in range(w):
        if s[i][j] == "#" and seen[i+j*w] == 0:
            if not func(i,j):
                ans = True
if ans:
    print("No")
else:
    print("Yes")
Problem p03485 (python)

Fixed submission:
import math
a,b = map(int,input().split())
print(math.ceil((a+b)/2))

Buggy submission (verdict: Runtime Error):
import math
a,b = map(int,input())
print(math.ceil((a+b)/2))
Problem p03544 (python)

Fixed submission:
n = int(input())
L = [0 for _ in range(n+2)]
L[0]=2
L[1]=1
if n >= 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])

Buggy submission (verdict: Runtime Error):
n = int(input())
L = [0 for _ in range(86)]
L[0]=2
L[1]=1
if n > 2:
    for i in range(2,n+1):
        L[i] = L[i-1]+L[i-2]
print(L[n])
Problem p03563 (python)

Fixed submission:
a = int(input())
b = int(input())
print(2*b -a)

Buggy submission (verdict: Runtime Error):
a,b = map(int,input().split())
print(2*b -a)
Problem p03694 (python)

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

Buggy submission (verdict: Runtime Error):
n = input()
a = map(int,input().split())
print(max(a)-min(a))
Problem p03993 (python)

Fixed submission:
n = int(input())
A = list(map(int,input().split()))
cnt = 0
B = [False for _ in range(n)]
for i,a in enumerate(A):
    if A[a-1] == i+1 and B[i] == False:
        cnt+=1
        B[a-1] = True
    B[i] = True
print(cnt)

Buggy submission (verdict: Runtime Error):
n = int(input())
A = list(map(int,input().split()))
cnt = 0
B = [False for _ in range(n)]
for i,a in enumerate(A):
    print(A[a-1],i)
    print(B)
    if A[a-1] == i+1 and B[i] == False:
        cnt+=1
        B[a-1] = True
    B[i] = True
print(cnt)
Problem p02582 (python)

Fixed submission:
s = input()
ans = 0

for i in range(1, 4):
    p = "R" * i
    if p in s:
        ans = i

print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
ans=0

R = 'R'*i
for i in range(1,4):
  R = 'R'*i
  if R in s:
    ans = i
    
print(ans)