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

Fixed submission:
N, M = map(int, input().split())
num = ['0'] * N
s1 = False
error = False

for i in range(M):
    s, c = input().split()
    if num[int(s)-1] in ['0', c]:
        num[int(s)-1] = c
        if s == '1':
            s1 = True
    else:
        error = True
        break

if N != 1 and not s1:
    num[0] = '1'
if (N != 1 and num[0] == '0') or error:
    print(-1)
else:
    if N != 1 and not s1:
        num[0] = '1'
    print(''.join(num))

Buggy submission (verdict: Runtime Error):
N, M = map(int, input().split())
num = ['0'] * N
si = False
error = False

for i in range(M):
    s, c = input().split()
    if num[int(s)-1] in ['0', c]:
        num[int(s)-1] = c
        if s == '1':
            s1 = True
    else:
        error = True
        break

if not s1:
    num[0] = '1'
if num[0] == '0' or error:
    print(-1)
else:
    print(''.join(num))
Problem p02767 (python)

Fixed submission:
N = int(input())
x = list(map(int, input().split()))
p = int(sum(x)/N)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))

Buggy submission (verdict: Runtime Error):
N = int(input())
x = list(map(int, input().split()))
l = []
minx = min(x)
maxx = max(x)
for p in range(minx, maxx):
  s = 0
  for j in range(N):
    s += (x[j]-p)**2
  l.append(s)
minp = min(l)
p = l.index(minp) + 1
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))

Buggy submission (verdict: Runtime Error):
N = int(input())
x = list(map(int, input().split()))
l = []
minx = min(x)
maxx = max(x)
for p in range(minx, maxx):
  s = 0
  for j in range(N):
    s += (x[j]-p)**2
  l.append(s)
minp = min(l)
p = l.index(minp)
p = int(p)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))

Buggy submission (verdict: Runtime Error):
N = int(input())
x = list(map(int, input().split()))
l = []
minx = min(x)
maxx = max(x)
for p in range(minx, maxx):
  s = 0
  for j in range(N):
    s += (x[j]-p)**2
  l.append(s)
minp = min(l)
p = l.index(minp)
hp1 = 0
hp2 = 0
for i in range(N):
  hp1 += (x[i]-p)**2
  hp2 += (x[i]-p-1)**2
print(min(hp1, hp2))
Problem p02882 (python)

Fixed submission:
import math

a,b,x=[int(x) for x in input().split()]
if x*2<=a**2*b:
    y=2*x
    theta=math.atan2(y,b*a*b)
else:
    theta=math.atan2(a**3, 2*(b*a**2-x) )
print(90-theta*180/math.pi)

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

a,b,x=[int(x) for x in input().split()]
if x*2<=a**2*b:
    y=2*x
    theta=np.arctan2(y,b*a*b)
else:
    theta=np.arctan2(a**3, 2*(b*a**2-x) )
print(90-theta*180/np.pi)
Problem p03382 (python)

Fixed submission:
from bisect import *

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    try:
        if i:
            return a[i-1]
        else:
            return -1
    except:
        return -1

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    try:
        if i != len(a):
            return a[i]
        else:
            return -1
    except:
        return -1

def fun(a,b):
    if b==-1:
        return -1
    elif b==0:
        return 0
    return (b+1)*(2*a-b)/2 - b*(b+1)/2

N=int(raw_input())
X=map(int, raw_input().split())
Y=sorted(X)
ans=[-1,0,0]
if len(Y)==2:
    print Y[1],Y[0]

else:
    for y in Y[::-1]:
        qry=y/2
        tmp1=find_ge(Y, qry)
        tmp2=find_le(Y, qry)
        if ans[0]<fun(y,tmp1):
            ans=[fun(y,tmp1),y,tmp1]
        if ans[0]<fun(y,tmp2):
            ans=[fun(y,tmp2),y,tmp2]
    print ans[1], ans[2]

Buggy submission (verdict: Runtime Error):
from bisect import *

def index(a, x):
    'Locate the leftmost value exactly equal to x'
    i = bisect_left(a, x)
    if i != len(a) and a[i] == x:
        return i
    raise ValueError

def find_lt(a, x):
    'Find rightmost value less than x'
    i = bisect_left(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_le(a, x):
    'Find rightmost value less than or equal to x'
    i = bisect_right(a, x)
    try:
        if i:
            return a[i-1]
    except:
        return -1

def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bisect_right(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def find_ge(a, x):
    'Find leftmost item greater than or equal to x'
    i = bisect_left(a, x)
    try:
        if i != len(a):
            return a[i]
    except:
        return -1

def fun(a,b):
    if b==-1:
        return -1
    elif b==0:
        return 0
    return (b+1)*(2*a-b)/2 - b*(b+1)/2

N=int(raw_input())
X=map(int, raw_input().split())
Y=sorted(X)
ans=[-1,0,0]
if len(Y)==2:
    print Y[1],Y[0]

else:
    for y in Y[::-1]:
        qry=y/2
        tmp1=find_ge(Y, qry)
        tmp2=find_le(Y, qry)
        if ans[0]<fun(y,tmp1):
            ans=[fun(y,tmp1),y,tmp1]
        if ans[0]<fun(y,tmp2):
            ans=[fun(y,tmp2),y,tmp2]
    print ans[1], ans[2]
Problem p03552 (python)

Fixed submission:
[N,Z,W]=map(int,raw_input().split())
A=map(int,raw_input().split())

if len(A)==1:
    print abs(A[-1]-W)
else:
    if abs(A[-1]-W)>abs(A[-1]-A[-2]):
        print abs(A[-1]-W)
    else:
        print abs(A[-1]-A[-2])

Buggy submission (verdict: Runtime Error):
[N,Z,W]=map(int,raw_input().split())
A=map(int,raw_input().split())

if abs(A[-1]-W)>abs(A[-1]-A[-2]):
    print abs(A[-1]-W)
else:
    print abs(A[-1]-A[-2])
Problem p03591 (python)

Fixed submission:
S=raw_input()
if len(S)>3:
    if S[:4]=="YAKI":
        print "Yes"
    else:
        print "No"
else:
    print "No"

Buggy submission (verdict: Runtime Error):
[N,M,K]= map(int, raw_input().split())
ans=["No","Yes"]
f=0
for m in range(M+1):
    for n in range(N+1):
        if K== m*N+n*M-2*m*n:
            f=1
print ans[f]
Problem p03640 (python)

Fixed submission:
[H,W]=[int(x) for x in raw_input().split()]
N=int(raw_input())
A=[int(x) for x in raw_input().split()]
B=[[0 for x in range(W)] for y in range(H)]
p=0
q=0
d=1
k=0
D=6
for i in range(1,N+1):
    for j in  range(A[i-1]):
        B[p][(q+k)*d]=i
        q+=1
        if q==W:
            p+=1
            q=0
            d*=-1
            k= not k
for i in range(H):
    print "".join([str(x).ljust(D) for x in B[i]])

Buggy submission (verdict: Runtime Error):
[H,W]=[int(x) for x in raw_input().split()]
N=int(raw_input())
A=[int(x) for x in raw_input().split()]
B=[[0 for x in range(W)] for y in range(H)]
p=0
q=0
d=1
k=0
for i in range(1,N+1):
    for j in  range(A[i-1]):
        B[p][(q+k)*d]=i
        q+=1
        if q==N:
            p+=1
            q=0
            d*=-1
            k= not k
for i in range(H):
    print "".join([str(x) for x in B[i]])
Problem p02628 (python)

Fixed submission:
def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main()

Buggy submission (verdict: Runtime Error):
def main():
	n, k = map(int, input().split())
	P = list(map(int, input().split()))
	sorted_p = sorted(P)
	ans = sum(sorted_p[:k])
	print(ans)
	return

if __name__ == "__main__":
	main(
Problem p02730 (python)

Fixed submission:
import sys
S = input()

def isKaibun(txt, n):
    for i in range(n):
        if txt[i] == txt[-(i+1)]:
            continue
        else:
            print("No")
            sys.exit()
    return 0

l = len(S)
isKaibun(S, l//2)

l_b = (l-1)//2 
isKaibun(S[:l_b], l_b//2)

l_a = (l+3)//2
isKaibun(S[l_a-1:], (l-l_a)//2)

print("Yes")

Buggy submission (verdict: Runtime Error):
import sys
S = input()

def isKaibun(txt, n):
    for i in range(n):
        if txt[i] == txt[-(i+1)]:
            continue
        else:
            print("No")
            sys.exit(-1)
    return 0

l = len(S)
isKaibun(S, l//2)

l_b = (l-1)//2 
isKaibun(S[:l_b], l_b//2)

l_a = (l+3)//2
isKaibun(S[l_a-1:], (l-l_a)//2)

print("Yes")
Problem p02817 (python)

Fixed submission:
S, T = input().split()
print(T + S)

Buggy submission (verdict: Runtime Error):
In = list(map(int, input().split()))
sin = set(In)
print("Yes" if len(sin) == 2 else "No")
Problem p02813 (python)

Fixed submission:
from itertools import permutations

n = int(input())
nums1 = list(map(int,input().split(" ")))
nums2 = list(map(int,input().split(" ")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index += 1

print(abs(a-b))

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permutations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))

Buggy submission (verdict: Runtime Error):
from itertools import permutations

n = int(input())
nums1 = list(map(int,input(),split("")))
nums2 = list(map(int,input(),split("")))

t1 = tuple(nums1)
t2 = tuple(nums2)

index = 1
a = b = -1

for perm in permtations(list(range(1,n+1))):
    if perm == t1:
        a = index
    if perm == t2:
        b = index
    index +=  1

print(abs(a-b))
Problem p02690 (python)

Fixed submission:
x = int(input())
for a in range(1000):
    for b in range(1000):
        if a**5 - b**5 == x:
            print(f"{a} {b}")
            break
        elif a**5 - (-b)**5 == x:
            print(f"{a} {-b}")
            break
    else:
        continue
    break

Buggy submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        if 0 < x-y:
            print(f"{l.index(x-y)} {-i}")
            break
        else:
            print(f"{i} {-(l-index(abs(x-y)))}")
            break

Buggy submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(n)]
for i,y in enumerate(l):
    if abs(x-y) in l:
        print(f"{l.index(x-y)} {-i}")
        break

Buggy submission (verdict: Runtime Error):
x=int(input())
n = 1000
l = [x**5 for x in range(-n, n)]
for i,y in enumerate(l):
    if y+x in l:
        print(f'{int(l.index(y+x)-len(l)/2+1)} {int(i-len(l)/2+1)}')
        break
    elif y-x in l:
        print(f'{int(i-len(l)/2+1)} {int(l.index(y-x)-len(l)/2+1)}')
	break
Problem p02696 (python)

Fixed submission:
a,b,n=map(int, input().split())
if n < b:
    print((a*n)//b - a*(n//b))
else:
    print((a*(b-1))//b - a*((b-1)//b))

Buggy submission (verdict: Runtime Error):
import itertools
n,m,q=map(int,input().split())
abcd=[None]*q
for i in range(q):
    abcd[i]=list(map(int,input().split()))
num=0
for l in list(map(list, itertools.combinations(list(range(1,m+1))*m, n))):
    num_ = 0
    for x in abcd:
        if l[x[1]-1]-l[x[0]-1] == x[2]:
            num_ += x[3]
    num = max(num ,num_)
print(num)
Problem p02714 (python)

Fixed submission:
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
if len(l) == 3:
    ans=l[0]*l[1]*l[2]
    for i in range(n):
        for j in range(i+1,n):
            k = 2*j-i
            if n <= k:
                break
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans-=1
    print(ans)
else:
    print(0)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
ans=l[0]*l[1]*l[2]
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if n <= k:
            break
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans-=1
print(ans)

Buggy submission (verdict: Runtime Error):
import collections
n = int(input())
s=input()
l=list(collections.Counter(s).values())
ans=l[0]*l[1]*l[2]
for i in range(n):
    for j in range(i+1,n):
        k = 2*j-i
        if n<=k:
            continue
        if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
            ans-=1
print(ans)
Problem p02717 (python)

Fixed submission:
x,y,z=map(int,input().split())
print('{0} {1} {2}'.format(z,x,y))

Buggy submission (verdict: Runtime Error):
x,y,z=map(int,input().split())
print(f'{z} {x} {y}')
Problem p02720 (python)

Fixed submission:
k=int(input())
l=list(map(str,range(1,10)))
for i in range(k):
    x=l[i][-1]
    if x=='0':
        l.append(l[i]+x)
        l.append(l[i]+'1')
    elif x=='9':
        l.append(l[i]+'8')
        l.append(l[i]+x)
    else:
        n=int(x)
        l.append(l[i]+str(n-1))
        l.append(l[i]+x)
        l.append(l[i]+str(n+1))
print(sorted(map(int,l))[k-1])

Buggy submission (verdict: Runtime Error):
import math
n,m=map(int,input().split())
a=list(map(int,input().split()))
t=sum(a)
a=list(filter(lambda x: math.ceil(t/(4*m)) < x, a))
print('Yes' if m <= len(a) else 'No')
Problem p02732 (python)

Fixed submission:
n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
    if d.get(x) is None:
        d[x]=1
        continue
    d[x]+=1
total=0
for v in d.values():
    total+=(v-1)*v//2
for x in a:
    print(total-d[x]+1)

Buggy submission (verdict: Runtime Error):
import collections
n=int(input())
a=list(map(int,input().split()))
d=collections.Counter(a)
total=sum([(v-1)*v//2, for v in d.values()])
for x in a:
    print(total-d[x]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
d={}
for x in a:
    if d.get(x) is None:
        d[x]=1
        continue
    d[x]+=1
total=0
for v in d.values():
    total+=(y-1)*y//2
for x in a:
    print(total-d[x]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ua=list(set(a))
total=sum([sum(range(a.count(x))) for x in ua])
d={}
total=0
for x in ua:
    c=a.count(x)
    d[x]=c
    total+=sum(range(c))
for i in range(n):
    print(total-d[i]+1)

Buggy submission (verdict: Runtime Error):
n=int(input())
a=list(map(int,input().split()))
ua=list(set(a))
d={}
total=0
for i in range(n):
    y=a[i]
    if y in d:
        print(d[y])
        continue
    if ua:
        for x in ua:
            c = a.count(x)
            if c==1:
                ua.remove(c)
            total+=sum(range(c - (1 if x==y else 0)))
        print(total)
        d[y]=total
        total=0
    else:
        print(0)
Problem p02761 (python)

Fixed submission:
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
if l[0] is None and len(l) != 1:
    l[0]='1'
l = list(map(lambda x: '0' if x is None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) != 1:
    print(-1)
else:
    print(msg.join(l))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
l = [None]*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] is None:
        l[index] = c
    else:
        if l[index] == c:
            continue
        else:
            msg=-1
            break
l = list(map(lambda x: '0' if x in None else x, l))
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) >1:
    print(-1)
else:
    print(msg.join(l))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
l = ['0']*n
msg=''
for _ in range(m):
    s, c = input().split()
    index = int(s)-1
    if l[index] == '0':
	l[index] = c
    else:
        if l[index] == c:
            continue
	else:
            msg=-1
            break
if msg == -1:
    print(msg)
elif l[0] == '0' and len(l) >1:
    print(-1)
else:
    print(msg.join(l))

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
d = {}
flag = True
for _ in range(m):
    s, c = input().split()
    if d.get(s):
        if d.get(s) == c:
            continue
        else:
            flag = False
            break
    else:
        d[s] = c
if flag:
    if max(map(int, d.keys())) == n:
        l = ['0']*n
        for i in range(1,n+1):
            if d.get(str(i)):
                l[i-1] = d.get(str(i))
        if l[0] == '0':
            print(-1)
        else:
            print(''.join(l))
    else:
        print(-1)
else:
    print(-1)

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
d = {}
flag = True
for _ in range(m):
    s, c = input().split()
    if d.get(s):
        if d.get(s) == c:
            continue
        else:
            flag = False
            break
    else:
        d[s] = c
if flag:
    if max(map(int, d.keys())) == n:
        l = ['0']*n
        for i in range(1,n+1):
            if d.get(str(i)):
                l[i-1] = d.get(str(i))
        print(''.join(l))
    else:
        print(-1)
else:
    print(-1)
Problem p02789 (python)

Fixed submission:
n,m=map(int, input().split())
print('Yes' if n==m else 'No')

Buggy submission (verdict: Runtime Error):
n,m=map(int, input().split())
print(Yes if n==m else No)
Problem p02796 (python)

Fixed submission:
n=int(input())
li=[None]*n
for i in range(0,n):
    flag=True
    x,l=map(int, input().split())
    li[i]=(x+l, x-l)
li=sorted(li)
count=1
x,y=li[0]
for i in range(1,n):
    x2,y2=li[i]
    if y2 < x:
        continue
    count=count+1
    x=x2
print(count)

Buggy submission (verdict: Runtime Error):
n=int(input())
li=[]
for i in range(0,n):
    flag=True
    x,l=map(int, input().split())
    mi=x-l
    ma=x+l
    for j in li:
	if j[0] < mi < ma < j[1]:
            flag=False
            break
    if flag:
	li.append([mi,ma])
print(len(li))
Problem p02812 (python)

Fixed submission:
n = int(input())
s = input()
print(s.count('ABC'))

Buggy submission (verdict: Runtime Error):
n = int(input())
s = input()
print(s.count('ABC')
Problem p02841 (python)

Fixed submission:
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
print(0 if m1 == m2 else 1)

Buggy submission (verdict: Runtime Error):
m1, d1 = map(int, input().split())
m2, d2 = map(int, input().split())
m1 == m2 if ans = 0 else ans = 1
print(ans)
Problem p03023 (python)

Fixed submission:
n=int(input())
print((n-2)*180)

Buggy submission (verdict: Runtime Error):
n=input()
print((n-2)*180)
Problem p03048 (python)

Fixed submission:
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(int(n/l[2])+1):
    for j in range(int(n/l[1])+1):
        x = l[2]*i
        y = l[1]*j
        if (n-x-y) >= 0 and (n-x-y)%l[0] == 0:
            count = count + 1
print(count)

Buggy submission (verdict: Runtime Error):
r,g,b,n = map(int, input().split(" "))
l = sorted([r,g,b])
count=0
for i in range(n):
    for j in range(n):
        x = l[2]*i
        y = l[1]*j
        if (n - (x + y) < 0:
            break
        if (n-(x+y))%l[0] == 0:
            count = count + 1
print(count)
Problem p03062 (python)

Fixed submission:
n = int(input())
a = list(map(int, input().split(" ")))
if len(list(filter(lambda x: x < 0, a))) % 2 == 0:
    print(sum(list(map(abs, a))))
else:
    a = list(map(abs, a))
    print(sum(a) - min(a)*2)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = list(map(int, input().split(" ")))
for i in range(1, n-1):
    print(a)
    if 0 <= a[i-1] and 0 <= a[i] and 0 <= a[i+1]:
        continue
    elif a[i-1] < 0 and 0 <= a[i] and a[i+1] < 0:
        a[i-1] = abs(a[i-1])
        a[i+1] = abs(a[i+1])
    elif a[i-1] < 0 and a[i] < 0:
        a[i-1] = abs(a[i-1])
        a[i] = abs(a[i])
    elif a[i] < a[i+1]:
        if abs(a[i]) >= abs(a[i+1]):
            a[i] = a[i]*-1
            a[i+1] = a[i+1]*-1
    elif a[i-1] < a[i]:
        if abs(a[i-1]) >= abs(a[i]):
            a[i-1] = a[i-1]*-1
            a[i] = a[i]*-1
    else:
        continue
print(sum(a))
Problem p03071 (python)

Fixed submission:
inputs = list(map(int, input().split(" ")))
print(max([sum(inputs), inputs[0]*2-1, inputs[1]*2-1]))

Buggy submission (verdict: Runtime Error):
inputs = [int(input()) for i in range(2)]

print(max([sum(inputs), inputs[0]*2-1, inputs[1]*2-1]))
Problem p02664 (python)

Fixed submission:
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    data[i] = "D"
ans = "".join(data)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    if i == 0:
      if data[i + 1] == "D" or data[i + 1] == "?":
        data[i] = "P"
      else:
        data[i] = "D"
    elif i == len(data) - 1:
      data[i] = "D"
    else:
      if data[i - 1] == "D" or data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
ans = "".join(data)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    if i == 0:
      if data[i + 1] == "D" or data[i + 1] == "?":
        data[i] = "P"
      else:
        data[i] = "D"
    elif i == len(data) - 1:
      if data[i - 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
    else:
      if data[i - 1] == "D" or data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
ans = "".join(data)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    if i == 0:
      if data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
    elif i == len(data) - 1:
      if data[i - 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
    else:
      if data[i - 1] == "D" or data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
ans = "".join(data)
print(ans)

Buggy submission (verdict: Runtime Error):
import sys
data = list(input())
for i, _str in enumerate(data):
  if _str == "?":
    if i == 0:
      if data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
    elif i == len(data) - 1:
      if data[i - 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
    else:
      if data[i - 1] == "D" or data[i + 1] == "D":
        data[i] = "P"
      else:
        data[i] = "D"
print(data)
Problem p02675 (python)

Fixed submission:
import sys
num = input()
 
hon_num_list = ["2", "4", "5", "7", "9"]
pon_num_list = ["0", "1", "6", "8"]
bon_num_list = ["3"]
 

if num[-1] in hon_num_list:
  print("hon")
elif num[-1] in pon_num_list:
  print("pon")
elif num[-1] in bon_num_list:
  print("bon")

Buggy submission (verdict: Runtime Error):
import sys
num = sys.stdin

hon_num_list = ["2", "4", "5", "7", "9"]
pon_num_list = ["0", "1", "6", "8"]
bon_num_list = ["3"]


if num[-1] in hon_num_list:
  print("hon")
elif num[-1] in pon_num_list:
  print("pon")
elif num[-1] in bon_num_list:
  print("bon")
Problem p02657 (python)

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

Buggy submission (verdict: Runtime Error):
A, B = input.split()
A = int(A)
B = int(B*100)
print(int(A*B/100))
Problem p02996 (python)

Fixed submission:
N = int(input())
job = []
for i in range(N):
    A,B = map(int,input().split())
    job.append([B,A])
job = sorted(job)
time = 0
flag = 0
for i in job:
    time += i[1]
    if i[0] < time:
        print('No')
        flag = 1
        break
        
if flag == 0:
    print('Yes')

Buggy submission (verdict: Runtime Error):
N = int(input())
job = []
for i in range(N):
    A,B = map(int,input().split())
    job.append([B,A])
job = sorted(job)time = 0
flag = 0
for i in job:
    time += i[1]
    if i[0] < time:
        print('No')
        flag = 1
        break
        
if flag == 0:
    print('Yes')