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

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

Buggy submission (verdict: Runtime Error):
import sys
from operator import itemgetter
inputs = sys.stdin.readline
N, Q= map(int,inputs().split())
def main():
	E = [None]*2*N
	for n in range(N):
		a,b,c = map(int,inputs().split())
		E[2*n] = (a - c, 1, c)
		E[2*n + 1] = (b - c, -1, c)
	E.sort(key=itemgetter(0))
	tuple(tuple(E))
	mini = 1000000001
	kouho = {1000000001}
	my_add = kouho.add
	my_discard = kouho.discard
	q = 0
	d = int(inputs())
	flag = False
	cont = False
	for e in E:
		while(e[0] > d):
			if cont == True:
				if mini < 1000000001:
					print(mini)
				else:
					print(-1)
			else:
				mini = min(kouho)
				if mini < 1000000001:
					print(mini)
				else:
					print(-1)
			cont = True
			if q < Q-1:
				q = q + 1
				d = int(inputs())
			else:
				flag = True
				q = q + 1
				break
		if flag == True:
			break
		if e[1] == 1:
			my_add(e[2])
			if mini > e[2]:
				mini = e[2]
		elif e[1] == -1:
			my_discard(e[2])
			cont = False
	for t in [None]*(Q-q):
		print(-1)
		
def sub():
	V = [list(map(int,inputs().split())) for p in [0]*N]
	M = [int(inputs()) for p in [0]*Q]
	V.sort(key = lambda x:(x[2],x[0],x[1]))
	for v in V:
		v[0] -= v[2]
		v[1] -= v[2] + 1
	for m in M:
		for n in range(N):
			if V[n][0] <=m and m <= V[n][1]:
				print(V[n][2])
				break
		else:
			print(-1)


if N>200000:
	sub()
else:
	main()

Buggy submission (verdict: Runtime Error):
import sys
inputs = sys.stdin.readline
N, Q= map(int,inputs().split())
V = [None]*N
E = []
for n in range(N):
	V[n] = list(map(int,inputs().split()))
	V[n][0] -= V[n][2]
	V[n][1] -= V[n][2]
	E.append([V[n][0],1,V[n][2]])
	E.append([V[n][1],-1,V[n][2]])
D = [int(inputs()) for p in [0]*Q]
E.sort(key = lambda x:x[0])
mini = 1000000001
kouho = [1000000001]
q = 0
d = D[0]
for e in E:
	flag = 0
	if e[0] <= d:
		if  e[1] == 1:
			kouho.append(e[2])
		elif e[1] == -1:
			kouho.remove(e[2])
	if e[0] > d:
		for k in kouho:
			mini = min(k,mini)
		if mini < 1000000001:
			print(mini)
			mini = 1000000001
		else:
			print(-1)
			mini = 1000000001
		flag = 1
		if q < Q-1:
			q = q + 1
			d = D[q]
		else:
			break
	if e[0] <= d and flag == 1:
		if  e[1] == 1:
			kouho.append(e[2])
		elif e[1] == -1:
			kouho.remove(e[2])
for t in [None]*(Q-q):
	print(-1)

Buggy submission (verdict: Runtime Error):
import sys
inputs = sys.stdin.readline
N, Q= map(int,inputs().split())
V = [list(map(int,inputs().split())) for p in [0]*N]

for q in [0]*Q:
	m = int(inputs())
	for n in range(N):
		if V[n][0] - V[n][2] <=m and m <= V[n][1] - V[n][2] -1:
			print(V[n][2])
			break
	else:
		print(-1)
Problem p03032 (python)

Fixed submission:
import sys
inputs = sys.stdin.readline
N, K= map(int,inputs().split())
V = list(map(int,inputs().split()))

maxim = 0
if K <= 2*N - 1:
	for i in range(0,K+1):
		for j in range(i+1):
			if j == i:
				a = V[:j] + [0]
			else:
				a = V[:j] + V[j-i:] + [0]
			a.sort()
			b = a.index(0)
			if b <= K - i:
				maxim = max(sum(a[b:]),maxim)
			else:
				maxim = max(sum(a[K-i:]),maxim)
else:
	V.append(0)
	V.sort()
	maxim = sum(V[V.index(0):])
print(maxim)

Buggy submission (verdict: Runtime Error):
def count_l(d,n):
	maxim = 0
	if n > 0:
		for t in wa_l(d,n-1):
			maxim = max(t[0]+d[t[1]],maxim)
	return(maxim)

def count_r(d,n):
	maxim = 0
	if n > 0:
		for t in wa_r(d,n-1):
			maxim = max(t[0]+d[N-1-t[1]],maxim)
	return(maxim)			
		

def wa_l(d,n):
	if n == 0:
		return([[0,0]])
	if n == 1:
		return([[d[0],1]])
	if n == 2:
		return([[0,1],[d[0]+d[1],2]])
	if n > 2:
		a = []
		for j in wa_l(d,n-2):
			j[1] += 1
			a.append(j)
		for j in wa_l(d,n-1):
			j[0] += d[j[1]]
			j[1] += 1
			a.append(j)
		return(a)

def wa_r(d,n):
	if n == 0:
		return([[0,0]])
	if n == 1:
		return([[d[N-1],1]])
	if n == 2:
		return([[0,1],[d[N-1]+d[N-2],2]])
	if n > 2:
		a = []
		for j in wa_r(d,n-2):
			j[1] += 1
			a.append(j)
		for j in wa_r(d,n-1):
			j[0] += d[N-1-j[1]]
			j[1] += 1
			a.append(j)
		return(a)

def l_r(d,n):
	maxim = 0
	for x in range(n+1):
		maxim = max(count_r(d,x)+count_l(d,n-x),maxim)
	print(maxim)

N, q= map(int,input().split())
p = list(map(int,input().split()))

l_r(p,q)
Problem p03035 (python)

Fixed submission:
a = list(map(int,input().split()))
if a[0] <= 5:
  print(0)
elif a[0] <= 12:
  print(a[1]//2)
else:
  print(a[1])

Buggy submission (verdict: Runtime Error):
a = list(map(int,input().split()))
if a[0] <= 5:
  print(0)
elif a[0] <= 12:
  print(int(a[1]//2)
else:
  print(a[1])

Buggy submission (verdict: Runtime Error):
a = int(input().split())
if a[0] <= 5:
  print(0)
elif a[0] <= 12:
  print(a[1]/2)
else:
  print(a[0])
Problem p03037 (python)

Fixed submission:
max,m = map(int,input().split())
min = 1
for k in range(m):
  a,b = map(int,input().split())
  if min < a:
    min = a
  if max > b:
    max = b
if max < min:
  print(0)
else:
  print(max-min+1)

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
min,max = map(int,input().split())
for k in range(m-1):
  a,b = map(int,input().split())
  if min < a:
    min = a
  if max > b:
    max = b
if b < a:
  print(0)
else:
  print(b-a+1)
Problem p04045 (python)

Fixed submission:
class A:

    def solve(self):
        [a, b, c] = sorted([int(x) for x in input().split(" ")])
        if a == 5 and b == 5 and c == 7:
            print("YES")
        else:
            print("NO")

class B:

    def solve(self):
        [n, l] = [int(x) for x in input().split(" ")]

        strings = []
        for r in range(n):
            strings.append(input())

        sorted_strings = sorted(strings)

        print("".join(sorted_strings))

class C:

    def fix(self, final_amount, likes):
        i = 0
        import bisect as b
        changed = False
        for i,x in enumerate(reversed(final_amount)):
            real_index = len(final_amount) - i - 1
            ind = b.bisect_right(likes, int(x))
            if ind != len(likes):
                final_amount[real_index] = str(likes[ind])
                changed = True
                break

        if not changed:
            ind = b.bisect_right(likes, 0)
            final_amount = [str(likes[ind])] + final_amount
            i = 1
        else:
            i = len(final_amount) - i - 1

        while i < len(final_amount):
            final_amount[i] = str(likes[0])
            i += 1

        return final_amount

    def solve(self):
        [n, k] = [int(x) for x in input().split(" ")]
        dislikes = [int(x) for x in input().split(" ")]

        likes = []
        for r in range(10):
            if r not in dislikes:
                likes.append(r)

        import bisect as b

        final_amount = []
        sn = str(n)
        for ind in range(len(sn)):
            c = sn[ind]
            i = b.bisect_left(likes, int(c))
            if i == len(likes):
                prev_len = len(final_amount)
                final_amount = self.fix(final_amount, likes)
                final_amount += [str(likes[0]) for r in range(len(sn) - prev_len)]
                break

            if str(c) != str(likes[i]):
                final_amount.append(str(likes[i]))
                final_amount += [str(likes[0]) for r in range(len(sn) - len(final_amount))]
                break

            final_amount.append(str(likes[i]))

        print("".join(final_amount))

C().solve()

Buggy submission (verdict: Runtime Error):
class A:

    def solve(self):
        [a, b, c] = sorted([int(x) for x in input().split(" ")])
        if a == 5 and b == 5 and c == 7:
            print("YES")
        else:
            print("NO")

class B:

    def solve(self):
        [n, l] = [int(x) for x in input().split(" ")]

        strings = []
        for r in range(n):
            strings.append(input())

        sorted_strings = sorted(strings)

        print("".join(sorted_strings))

class C:

    def solve(self):
        [n, k] = [int(x) for x in input().split(" ")]
        dislikes = [int(x) for x in input().split(" ")]

        likes = []
        for r in range(10):
            if r not in dislikes:
                likes.append(r)

        import bisect as b

        final_amount = []
        for c in str(n):
            i = b.bisect_left(likes, int(c))
            final_amount.append(str(likes[i]))

        print("".join(final_amount))

C().solve()
Problem p02582 (python)

Fixed submission:
S=list(input())
ans=0

for i in range(len(S)):
    if ans==0 and S[i]=="R":
        ans=1
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

print(ans)

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

for i in range(len(S)):
    if ans=0 and S[i]="R":
        ans=1
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

print(ans)

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

for i in range(len(S)):
    if ans=0 and S[i]="R":
        ans=1
for i in range(len(S)-1):
    if S[i]=="R" and S[i+1]=="R":
        ans+=1

print(ans)
Problem p02681 (python)

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

if len(S)+1==len(T) and T.startswith(S):
    print("Yes")
else:
    print("No")

Buggy submission (verdict: Runtime Error):




if __name__ == "__main__":
    n, m, x = map(int, input().split())

    c = []
    a = []

    for _ in range(n):
        cost, *rikaido = map(int, input().split())
        c.append(cost)
        a.append(rikaido)

    INF = float("inf")
    ans = INF
    
    for bit in range(1 << n):
        price_total = 0
        learn_total = [0] * m

        for i in range(n):
            if (bit >> i) & 1:
                # 買う場合
                price_total += c[i]
                for j in range(m):
                    learn_total[j] += a[i][j] 
        
        # 判定
        judge = True
        for j in range(m):
            if learn_total[j] < x:
                judge = False
                break
        
        if judge:
            ans = min(ans, price_total)
        
    if ans == INF:
        print(-1)
    else:
        print(ans)
Problem p02700 (python)

Fixed submission:

a, b, c, d = map( int, input().split() )
#print( a, b, c, d )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()

Buggy submission (verdict: Runtime Error):
a, b, c, d = map( int, input().split() )
while True:
    c = c - b
    if c < = 0:
  		print( "Yes" )
  		break
	a = a - d
  	if a < = 0:
  		print( "No" )
  		break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())
count=0
while True:
    c=c-b
    print(count+=1)
    if c<=0:
  		print("Yes")
  		break
	a=a-d
    print(count+=1)
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int,input().split())

while True:
    c=c-b
    if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
a, b, c, d = map( int, input().split() )
 
for i in range( 200 ):
    c = c - b
    if c <= 0:
        print( "Yes" )
        exit()
 
    a = a - d
    if a <= 0:
        print( "No" )
        exit()

        
a,b,c,d=map(int, input().split() )
 
for i in range( 200 ):
    c=c-b
    if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
 
for i in range( 200 ):
    c=c-b
    if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
 
for i in range( 200 ):
    c=c-b
    if c<=0:
  		print("Yes")
  		exit()
	a=a-d
  	if a<=0:
  		print("No")
  		exit()

Buggy submission (verdict: Runtime Error):
import numpy as np
a,b,c,d=map(int, input().split())
 
while True:
    c=c-b
    if c<=0:
  		print("Yes")
  		exit()
	a=a-d
  	if a<=0:
  		print("No")
  		exit()

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
 
while True:
	c=c-b
  	if c<=0:
  		print("Yes")
  		exit()
	a=a-d
  	if a<=0:
  		print("No")
  		exit()

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
 
while True:
	c=c-b
  	if c<=0:
  		print("Yes")
  		quit()
	a=a-d
  	if a<=0:
  		print("No")
  		quit()

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
while True:
	c=c-b
  	if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
a,b,c,d=map(int, input().split())
 
while True:
	c=c-b
  	if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
"""
A高橋体力
B高橋攻撃力
C青木体力
D青木攻撃力
"""
 
a,b,c,d=map(int, input().split())
 
while(true):
	c=c-b
  	if c<=0:
  		print("Yes")
  		break
	a=a-d
  	if a<=0:
  		print("No")
  		break

Buggy submission (verdict: Runtime Error):
"""
A高橋体力
B高橋攻撃力
C青木体力
D青木攻撃力
"""

a,b,c,d=map(int, input().split())

while(true):
  c=c-b
  	if c<=0:
  		#takahasi win
  		print("Yes")
  		break
  a=a-d
  	if c<=0:
  		#takahasi win
  		print("No")
  		break
Problem p02924 (python)

Fixed submission:
N=int(input())
print(N*(N-1)//2)

Buggy submission (verdict: Runtime Error):
N=int(input())
print(N(N-1)//2)

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

print(N(N-1)//2)
Problem p03062 (python)

Fixed submission:
import numpy as np
import collections

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

a=np.array(A, dtype=np.float64)
asign=np.sign(A)
c = collections.Counter(asign)
ar = np.array(c[-1], dtype=np.float64)
ac = a * asign

if c[-1] % 2 == 0:
    print(int(sum(ac)))
else:
    print(int(sum(ac)-min(ac)*2))

Buggy submission (verdict: Runtime Error):
import collections

N,X,Y=map(int,input().split())
if X > Y:
    exc=X
    X=Y
    Y=exc
L=[]
for i in range(N-1):
    for j in range(i+1,N):
        if i >= Y-1 or j <= X-1:
            L.append(j-i)
        elif j-i == 1:
            L.append(1)
        elif i <= X-1 and j >= Y-1:
            L.append(1+abs(X-1-i)+abs(Y-1-j))
        elif i >= X-1 and i-(X-1) > (Y-1)-i:
            L.append(j-i)            
        else:
            L1=j-i
            L2=min(j-i,1+abs(X-1-i)+abs(Y-1-j))
            L.append(min(L1,L2))

c=collections.Counter(L)

for i in range(1,N):
    print(c[i])
Problem p03162 (python)

Fixed submission:
N=int(input())
a=[0]*N
b=[0]*N
c=[0]*N
hpa=[0]*N
hpb=[0]*N
hpc=[0]*N
hp=[0]*N

for i in range(N):
    a[i],b[i],c[i]=map(int,input().split())

hpa[0]=a[0]
hpb[0]=b[0]
hpc[0]=c[0]
hp[0]=max(hpa[0],hpb[0],hpc[0])

for i in range(N-1):
    hpa[i+1]=max(hpb[i]+a[i+1],hpc[i]+a[i+1])
    hpb[i+1]=max(hpa[i]+b[i+1],hpc[i]+b[i+1])
    hpc[i+1]=max(hpa[i]+c[i+1],hpb[i]+c[i+1])
    hp[i+1]=max(hpa[i+1],hpb[i+1],hpc[i+1])

print(hp[-1])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*(N+1)
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1):
        if i+j>N-1:
            break
        else:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
print(dp[N-1])
Problem p03163 (python)

Fixed submission:
N,W=map(int,input().split())
w=[0]*N
v=[0]*N
for i in range(N):
    w[i],v[i]=map(int,input().split())

#dp[i][j]は、品数i,重さjのときの価値
dp =[[0 for i in range(W+1)] for j in range(N+1)] 
#表で表す

for i in range(N):#これは品数.i番目の品のオンオフ
    for j in range(W+1):#これは許容される重さの合計
        #選ぶ場合
        if j - w[i]>=0:
            dp[i+1][j]=max(dp[i][j],(dp[i][j-w[i]]+v[i]))
        #選ばない場合と比較
        dp[i+1][j]=max(dp[i][j],dp[i+1][j])

print(dp[N][W])

Buggy submission (verdict: Runtime Error):
N,K=map(int,input().split())
h=list(map(int,input().split()))
dp=[float('inf')]*(N+1)
dp[0]=0
for i in range(N-1):
    for j in range(1,K+1):
        if i+j>N-1:
            break
        else:
            dp[i+j]=min(dp[i+j],dp[i]+abs(h[i]-h[i+j]))
print(dp[N-1])
Problem p03274 (python)

Fixed submission:
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(N-K+1):
    if i + K == N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)

Buggy submission (verdict: Runtime Error):
N,K = map(int,input().split())
x = list(map(int,input().split()))
ans=float("inf")

for i in range(K):
    if i + K > N+1:
        break
    else:
        a = min(abs(x[K+i-1]),abs(x[i])) 
        ans = min(ans,x[K+i-1]-x[i]+a)
print(ans)
Problem p03338 (python)

Fixed submission:
N=int(input())
S=list(input())
cnt=0
maxcnt=0
for i in range(N):
    if i==0:
        if S[0] in S[1:N]:
            cnt+=1
        if maxcnt<cnt:
            maxcnt=cnt
    elif i == N-1:
        if S[N-1] in S[0:N]:
            cnt-=1
    else:
        if S[i] not in S[0:i] and S[i] in S[i+1:N]:
            cnt+=1
            if maxcnt<cnt:
                maxcnt=cnt
        elif S[i] in S[0:i] and S[i] not in S[i+1:N]:
            cnt-=1
        else:
            pass
print(maxcnt)

Buggy submission (verdict: Runtime Error):
def count_bomb(y,x):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans
h,w=map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j)
for i in range(h):
    print(*s[i],sep="")

Buggy submission (verdict: Runtime Error):
def count_bomb(y,x,h,w):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans

h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j,h,w)
for i in range(h):
    print(*s[i],sep="")

Buggy submission (verdict: Runtime Error):
def count_bomb(y,x,h,w):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans

h,w=map(int,input().split())
s=[list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j,h,w)
for i in range(h):
    print(*s[i],sep="")
Problem p03574 (python)

Fixed submission:
def count_bomb(y,x):
    ans=0
    for i in range(y-1,y+2):
        for j in range(x-1,x+2):
            if i>=0 and i<h and j>=0 and j<w:
                if s[i][j]=="#":
                    ans+=1
    return ans
h,w=map(int,input().split())
s = [list(input()) for _ in range(h)]
for i in range(h):
    for j in range(w):
        if s[i][j]==".":
            s[i][j]=count_bomb(i,j)
for i in range(h):
    print(*s[i],sep="")

Buggy submission (verdict: Runtime Error):
import copy
H,W=map(int,input().split())
S=[0]*W
for i in range(H):
    S[i]=list(input()+".")
S+=[["."]*(W+1)]
S2=[["#"]*W]*H

for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            S2[i][j]="#"
        else:
            if i==0:
                im=H
            else:
                im=i-1
            if j==0:
                jm=W
            else:
                jm=j-1

            if i==H-1:
                ip=H
            else:
                ip=i+1

            if j==W-1:
                jp=W
            else:
                jp=j+1
            cnt=[S[im][jm],S[im][j],S[im][jp],S[i][jm],S[i][jp],S[ip][jm],S[ip][j],S[ip][jp]]
            S2[i][j]=cnt.count('#')

print(S2)
Problem p02658 (python)

Fixed submission:
n=int(input())
a = list(map(int, input().split()))
ans=1

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans==1000000000000000000:
  ans=1000000000000000000
elif len(str(ans))>=19:
  ans=-1
print(ans)

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

if 0 in a :
  ans=0
else:
  for i in range(n):
    if len(str(ans))>=19:
      ans='-1'
      break
    else:
      ans*=a[i]
if ans>10**18:
  ans='-1'
print(ans)

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

if 0 in a :
  ans=0
else:
  for i in range(n+1):
    if len(str(ans))>=19:
      ans=-1
      break
    else:
      ans*=a[i]

print(ans)
Problem p02664 (python)

Fixed submission:
t=input()

tla=list(t)
tlb=list(t)
pd1=0
pd2=0

for i in range(len(tla)):
  if tla[i]=="?":
    if i==0:
      pass
    elif i==len(tla)-1:
      tla[i]="D"
    elif tla[i-1]=="P":
      tla[i]="D"
    elif tla[i+1]=="D":
      tla[i]="P"
    elif tla[i+1]=="?":
      tla[i]="P"
    else:
      tla[i]="D"
  if tla[i]=="D":
    if i==0:
      pass
    elif tla[i-1]=="P":
      pd1+=1
d1=tla.count('D')
s1=d1+pd1

for i in range(len(tlb)):
  if tlb[i]=="?":
    tlb[i]="D"
  if tlb[i]=="D":
    if i==0:
      pass
    elif tlb[i-1]=="P":
      pd2+=1
d2=tlb.count('D')
s2=d2+pd2

if s1>=s2:
  print(''.join(tla))
else:
  print(''.join(tlb))

Buggy submission (verdict: Runtime Error):
for i in range(len(tl1)):
  if tl1[i]=="?":
    if i==0:
      if tl1[i+1]=="D":
        tl1[i]="P"
      elif tl1[i+1]=="?":
        tl1[i]="P"
      else:
        tl1[i]="D"
    elif i==len(tl1)-1:
      tl1[i]="D"
    elif tl1[i-1]=="P":
      tl1[i]="D"
    elif tl1[i+1]=="D":
      tl1[i]="P"
    elif tl1[i+1]=="?":
      tl1[i]="P"
    else:
      tl1[i]="D"
  if tl1[i]=="D":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      pd1+=1
d1=tl1.count('D')
s1=d1+pd1
 
print(''.join(tl1))

Buggy submission (verdict: Runtime Error):
t=input()
tl=list(t)

tl1=tl
pd1=0

for i in range(len(tl1)):
  if tl1[i]=="?":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      tl1[i]="D"
    elif tl1[i+1]=="D":
      tl1[i]="P"
    elif tl1[i+1]=="?":
      tl1[i]="P"
    else:
      tl1[i]="D"
  if tl1[i]=="D":
    if i==0:
      pass
    elif tl1[i-1]=="P":
      pd1+=1
d1=tl1.count('D')
s1=d1+pd1

print(''.join(tl1))
Problem p02687 (python)

Fixed submission:
s=input()

if s=='ABC':
    ans='ARC'
else:
    ans='ABC'
print(ans)

Buggy submission (verdict: Runtime Error):
var str = readLine()!

if str=="ABC"{
  print("ARC")
}else{
  print("ABC")
}
Problem p02719 (python)

Fixed submission:
n,k = map(int,input().split())
 
if k==1 :
  ln=0
elif k==0 :
  ln=n
elif n>=k:
  a = n%k
  n=a
  while 1:
    ln = n
    n = abs(a-k)
    if ln<=n:
      break
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
elif n>=k and k!=0 :
  if n//k==0:
    ln=0
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)

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

if k==1 :
  ln=0
elif n>=k :
  if n//k==0:
    ln=0
else:
  while 1:
    ln = n
    n = abs(n-k)
    if ln<=n:
      break
print(ln)
Problem p02811 (python)

Fixed submission:
K, X = map(int,input().split())
if (500*K) >= X:
  print('Yes')
else:
  print('No')

Buggy submission (verdict: Runtime Error):
hoge = [0 for i in range(2)]

for i in range(2):
  hoge[i] = input()
  
N = int(hoge[0])
S = hoge[1]

print(S.count('ABC'))
Problem p03544 (python)

Fixed submission:
n=int(input())
 
a=2
b=1
s=0
 
if n==1:
  s=1
  n=2
 
for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn
 
if s==1:
  ans = 1
 
print(ans)

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

a=2
b=1

if n==1:
  s=1
  n=2

for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

if s==1:
  ans = 1

print(ans)

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

a=2
b=1


for i in range(n-1):
  nn = a+b
  ans=nn
  a=b
  b=nn

print(ans)
Problem p04033 (python)

Fixed submission:
import numpy
a,b = map(int,input().split())

if numpy.sign(a*b)==-1:
  print('Zero')
elif (numpy.sign(a)==1) or (numpy.sign(b)==1):
  print('Positive')
elif (a-b)%2==0:
  print('Negative')
else:
  print('Positive')

Buggy submission (verdict: Runtime Error):
ans=a
c=a
if a==b :
  ans=a**b
else:
  while c<=b:
    c=c+1
    ans=ans*c
pm = numpy.sign(ans)
if pm==0:
  print('zero')
elif pm==1:
  print('Positive')
else:
  print('Negative')