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

Fixed submission:
h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
l1=[]
l2=[]
ans=[[0]*w for _ in range(h)]
for i in range(n):
    for j in range(l[i]):
        l1.append(i+1)

flag=1
for i in range(h):
    for j in range(w):
        if flag==1:
            l2.append([i,j])
        else:
            l2.append([i,w-j-1])
    flag*=(-1)
for i in range(h*w):
        ans[l2[i][0]][l2[i][1]]=l1[i]
for i in ans:
    print(*i)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
l1=[]
l2=[]
ans=[[0]*w for _ in range(h)]
for i in range(n):
    for j in range(i+1):
        l1.append(i+1)
flag=1
for i in range(h):
    for j in range(w):
        if flag==1:
            l2.append([i,j])
        else:
            l2.append([i,w-j-1])
    flag*=(-1)

for i in range(h*w):
        ans[l2[i][0]][l2[i][1]]=l1[i]
for i in ans:
    print(*i)

Buggy submission (verdict: Runtime Error):
h,w=map(int,input().split())
n=int(input())
l=list(map(int,input().split()))
l1=[]
l2=[]
ans=[[0]*w for _ in range(h)]
for i in range(n):
    for j in range(i+1):
        l1.append(l[i])
flag=1
for i in range(h):
    for j in range(w):
        if flag==1:
            l2.append([i,j])
        else:
            l2.append([i,w-j-1])
    flag*=(-1)

for i in range(h*w):
        ans[l2[i][0]][l2[i][1]]=l1[i]
for i in ans:
    print(*i)
Problem p03645 (python)

Fixed submission:
n,m = map(int,input().split())
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = set()
b = set()
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr:a.add(arr[1])
    if n in arr:b.add(arr[0])
if len(a&b)==0:print("IMPOSSIBLE")
else:print("POSSIBLE")

Buggy submission (verdict: Runtime Error):
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = []
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr or n in arr:
        a.append(arr)
l = [i[0] for i in a if i[1]==n]
if len(l)==0:
    print("IMPOSSIBLE")
    exit()
for i in l:
    if [1,i] in a:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
Problem p03738 (python)

Fixed submission:
a=int(input())
b=int(input())
if a>b:print("GREATER")
elif a<b:print("LESS")
else:print("EQUAL")

Buggy submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>b:print("GREATER")
elif a<b:print("LESS")
else:print("EQUAL")
Problem p03830 (python)

Fixed submission:
import math
def isPrime(num):
    if num < 2: return False
    elif num == 2: return True
    for i in range(2,math.floor(math.sqrt(num))+1):
        if num % i == 0:
            return False
    return True

n=int(input())
if n==1:print(1);exit()
l=[i for i in range(1,n+1) if isPrime(i)==True]
ans=1
INF=10**9+7
for i in l:
    tmp=0
    tmpi=i
    while n//i>0:
        tmp+=n//i
        i*=tmpi
    ans=(ans*(tmp+1))%INF
print(ans)

Buggy submission (verdict: Runtime Error):
n=int(input())
if n==1:print(1);exit()
l=[i for i in range(1,n+1) if isPrime(i)==True]
ans=1
INF=10**9+7
for i in l:
    tmp=0
    tmpi=i
    while n//i>0:
        tmp+=n//i
        i*=tmpi
    ans=(ans*(tmp+1))%INF
print(ans)
Problem p03854 (python)

Fixed submission:
s = str(input())[::-1]
while True:
    if s[:5]=="maerd" or s[:5]=="esare":
        s=s[5:]
        if len(s)==0:
            print("YES")
            exit()
    elif s[:6]=="resare":
        s=s[6:]
        if len(s)==0:
            print("YES")
            exit()
    elif s[:7]=="remaerd":
        s=s[7:]
        if len(s)==0:
            print("YES")
            exit()
    else:
        print("NO")
        exit()

Buggy submission (verdict: Runtime Error):
s = str(input())[::-1]
while True:
    if s[:5]=="maerd" or s[:5]=="esare":
        s=s[5:]
        if len(s)==0:
            print("YES")
            exit()
    elif s[:6]=="resare"
        s=s[6:]
        if len(s)==0:
            print("YES")
            exit()
    elif s[:7]=="remaerd":
        s=s[7:]
        if len(s)==0:
            print("YES")
            exit()
    else:
        print("NO")
        exit()
Problem p03998 (python)

Fixed submission:
l_a = list(str(input()))
l_b = list(str(input()))
l_c = list(str(input()))

x = l_a.pop(0)
ans=0
while ans==0:
    if x == "a":
        if len(l_a) != 0: x = l_a.pop(0)
        else:ans = "A"
    if x == "b":
        if len(l_b) != 0: x = l_b.pop(0)
        else:ans = "B"
    if x == "c":
        if len(l_c) != 0: x = l_c.pop(0)
        else:ans = "C"
print(ans)

Buggy submission (verdict: Runtime Error):
x = l_a.pop(0)
ans=0
while ans==0:
    if x == "a":
        if len(l_a) != 0: x = l_a.pop(0)
        else:ans = "A"
    if x == "b":
        if len(l_b) != 0: x = l_b.pop(0)
        else:ans = "B"
    if x == "c":
        if len(l_c) != 0: x = l_c.pop(0)
        else:ans = "C"
print(ans)
Problem p03999 (python)

Fixed submission:
import itertools
n = str(input())
a = ["","+"]
l = list(itertools.product(a,repeat=len(n)-1))
l_n = list(n)
ans=0
for i in l:
    l_a = [None]*(len(n)*2-1)
    l_a[::2] = l_n
    l_a[1::2] = i
    ans+=eval("".join(l_a))
print(ans)

Buggy submission (verdict: Runtime Error):
n = str(input())
a = ["","+"]
l = list(itertools.product(a,repeat=len(n)-1))
l_n = list(n)
ans=0
for i in l:
    l_a = [None]*(len(n)*2-1)
    l_a[::2] = l_n
    l_a[1::2] = i
    ans+=eval("".join(l_a))
print(ans)
Problem p02683 (python)

Fixed submission:
n, m, x = [*map(int, input().split())]
k = [[*map(int, input().split())] for _ in range(n)]
ans = 10 ** 9

for i in range(2 ** n):
    cost = 0
    skills = [0] * m
    for j in range(n):
        if ((i >> j) & 1):
            cost += k[j][0]
            for s, t in enumerate(k[j][1:]):
                skills[s] += t
            if all(map(lambda skill: skill >= x, skills)):
                ans = min(ans, cost)
print(-1 if ans == 10 ** 9 else ans)

Buggy submission (verdict: Runtime Error):
n, m, x = [*map(int, input().split())]
k = []
ans = 10 ** 6
for i in range(n):
    c, *a = [*map(int, input().split())]
    s += c
    k.append([c, *a])

for i in range(2 ** n):
    cost = 0
    skills = [0] * m
    for j in range(n):
        if ((i >> j) & 1):
            cost += k[j][0]
            for s, t in enumerate(k[j][1:]):
                skills[s] += t
            if all(map(lambda skill: skill >= x, skills)):
                ans = min(ans, cost)
print(-1 if ans == 10 ** 6 else ans)
Problem p02888 (python)

Fixed submission:
import bisect

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_left(l, a + b)
        ans += max(idx - e - 1, 0)
print(ans)

Buggy submission (verdict: Runtime Error):
import bisect

n = int(input())
l = sorted([int(i) for i in input().split()])
ans = 0
for d in range(n):
    for e in range(d+1, n):
        a, b = l[d], l[e]
        idx = bisect.bisect_left(l, a + b)
        ans += max(idx - e - 1,)
print(ans)
Problem p03062 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = [abs(i) for i in a]
if m % 2 == 0 or 0 in a:
    print(sum(s))
else:
    print(sum(s) - 2 * min(s))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
m = len(list(filter(lambda x: x < 0, a)))
s = sum(map(abs, a))
if m % 2 == 0 or a in 0:
    print(s)
else:
    print(s - 2 * min(a))
Problem p03106 (python)

Fixed submission:
A, B, K = [int(i) for i in input().split()]
th = []
i = 0
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])

Buggy submission (verdict: Runtime Error):
A, B, K = [int(i) for i in input().split()]
th = []
i = 1
while True:
    i += 1
    if (A % i, B % i) == (0, 0):
        th.append(i)
    if i > A or i > B:
        break
print(th[len(th) - K])
Problem p03145 (python)

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

Buggy submission (verdict: Runtime Error):
a,b,c = sorted(int, input().split())
print(int(a*b/2))
Problem p03219 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
t,a = map(int, input().split())
h = [int(i) for i in input().split()]
candidates = list(map(lambda x: abs(a - t - x * 0.006), h))
print(candidates.index(min(candidates)) + 1)
Problem p03251 (python)

Fixed submission:
N, M, X, Y = map(int, input().split())
x = max(map(int, input().split()))
y = min(map(int, input().split()))
print('No War' if any([ X < z <= Y and x < z <= y for z in range(X+1, Y+1)]) else 'War')

Buggy submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = max([*map(int, input().split())])
y = min([*map(int, input().split())])
print('No War' if any([ X < z <= Y and x < z and z <= y for z in range(X+1, Y+1)]) else 'War')

Buggy submission (verdict: Runtime Error):
N, M, X, Y = map(int, input().split())
x = max([*map(int, input().split())])
y = min([*map(int, input().split())])
print('No War' if any([ X < z <= Y and x < z and z <= y for z in range(X+1, Y+1)]) else 'War')
Problem p03264 (python)

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

Buggy submission (verdict: Runtime Error):
n = int(input())
print((k/2)*((k+1)/2))
Problem p03294 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
print(sum(a) - n)

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = sorted([int(i) for i in input().split()], reverse=True)
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = sorted([int(i) for i in input().split()])
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))

Buggy submission (verdict: Runtime Error):
def gcd(x, y):
    if x % y:
        return gcd(y, x % y)
    return y

def lcm(a, b):
    return int(a * b / gcd(a, b))

n = int(input())
a = [int(i) for i in input().split()]
l = a[0]
for i in a[1:]:
    l = lcm(l, i)
print(sum(map(lambda x: (l - 1) % x, a)))
Problem p03308 (python)

Fixed submission:
input()
n = sorted([int(i) for i in input().split()])
print(n[-1] - n[0])

Buggy submission (verdict: Runtime Error):
input()
n=sorted(list(map(int,input().split())))
print(n［-1］- n［0］)
Problem p03324 (python)

Fixed submission:
d,n = map(int, input().split())
r = 100 ** d
l = [i for i in range(0, r*100, r)]
if n == 100:
    print(100 ** (d + 1) + 100 ** d)
else:
    print(l[n])

Buggy submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(0,100)]
elif d == 1:
    l = [i for i in range(0, 10000, 100)]
else:
    l = [i for i in range(0, 1000000, 10000)]
print(l[n])

Buggy submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(0,100)]
elif d == 1:
    l = [i for i in range(100, 10000, 100)]
else:
    l = [i for i in range(10000, 1000000, 10000)]
print(l[n])

Buggy submission (verdict: Runtime Error):
d,n = map(int, input().split())
if d == 0:
    l = [i for i in range(1,100)]
elif d == 1:
    l = [i for i in range(100, 10000, 100)]
else:
    l = [i for i in range(10000, 1000000, 10000)]
print(l[n])
Problem p03378 (python)

Fixed submission:
N, M, X = map(int, input().split())
a = {int(i) for i in input().split()}
l = set(range(0, X+1))
r = set(range(X, N+1))
print(min([len(a.intersection(l)) , len(a.intersection(r))]))

Buggy submission (verdict: Runtime Error):
N, M, X = map(int, input().split())
A = sorted([int(i) for i in input().split()])
start = A.index(X)
a = 0
b = 0
paying_area = range(1, M+1)
for i in range(start, -1, -1):
    if i in paying_area and not i in [0, X, N]:
        a += 1

for i in range(start, N+1):
    if i in paying_area and not i in [0, X, N]:
        b += 1

print(min((a,b)))
Problem p03386 (python)

Fixed submission:
a, b, k = map(int, input().split())
l = range(a, b+1)
for i in sorted(set(l[-k:]) | set(l[:k])):
    print(i)

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
l = list(range(a, b+1))
print(*(l[:k] + l[-k if k < len(l)/2 else - (len(l) - k):]), sep='\n')

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
c = list(range(a, b + 1))
print(*c if a+2*k >= b else list(dict.fromkeys(c[:k] + c[-k:])), sep='\n')

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
a = list(range(a, b+1))
print(*dict.fromkeys(a[:k] + a[-k:]), sep='\n')

Buggy submission (verdict: Runtime Error):
a, b, k = map(int, input().split())
a = list(range(a, b+1))
print(*set(a[:k] + a[-k:]), sep='\n')
Problem p03408 (python)

Fixed submission:
n = int(input())
d= {}
for _ in range(n):
    i = input()
    if i in d:
        d[i] += 1
    else: d[i] = 1

for _ in range(int(input())):
    i = input()
    if i in d:
        d[i] -= 1

print(max(max(d.values()), 0))

Buggy submission (verdict: Runtime Error):
n = int(input())
d= {}
for _ in range(n):
    i = input()
    if i in d:
        d[i] += 1
    else: d[i] = 1

for _ in range(int(input())):
    i = input()
    if i in d:
        d[i] -= 1

print(max(*d.values(), 0))
Problem p03456 (python)

Fixed submission:
a = [i**2 for i in range(4, 334)]
b,c = input().split()
print(int(b+c) in a and 'Yes' or 'No')

Buggy submission (verdict: Runtime Error):
from math import sqrt
a = [i ** 2 for i in range(3, sqrt(100100)+1)]
b, c = input().split()
print(int(b+c) in a and 'Yes' or 'No')

Buggy submission (verdict: Runtime Error):
a = [i ** 2 for i in range(3, sqrt(100100)+1)]
b, c = input().split()
print(int(b+c) in a and 'Yes' or 'No')

Buggy submission (verdict: Runtime Error):
import sys
a = [i**2 for i in range(0, 101)]
b,c = input().split()
if '00' b + c:
  print('No')
  sys.exit()
print(int(b+c) in a and 'Yes' or 'No')
Problem p03469 (python)

Fixed submission:
print('2018', input()[4:], sep='')

Buggy submission (verdict: Runtime Error):
print('2018',sep='' ,input()[4:])
Problem p03487 (python)

Fixed submission:
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(0 if c[key] == key else c[key] if c[key] < key else c[key] - key for key in c))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum([v if c < v else v - c for k,v in c.items()]))

Buggy submission (verdict: Runtime Error):
from collections import Counter
n = input()
c = Counter(map(int, input().split()))
print(sum(v if c < v else v - c for k,v in c.items()))
Problem p03606 (python)

Fixed submission:
n = int(input())
p = 0
for _ in range(n):
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = 0
for _ in n:
  i,j = [int(k) for k in input().split()]
  p += j-i+1
print(p)

Buggy submission (verdict: Runtime Error):
n = int(input())
p = 0
for _ in n:
  i,j = [int(i) for i in input().split()]
  p += j-i+1
print(p)
Problem p03607 (python)

Fixed submission:
from collections import Counter
n = int(input())
a = []
for _ in range(n):
  i = int(input())
  a.append(i)
col = Counter(a)
ans = 0
for c in col.values():
	if c % 2 == 1: ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for _ in n:
  i = int(input())
  if i in n:
    a.remove(i)
  else:
    a.append(i)
print(len(a))
Problem p03612 (python)

Fixed submission:
input()
nums = [int(i)-1 for i in input().split()]
c = 0

for i, j in enumerate(nums):
	if i == j and i != len(nums) - 1:
		nums[i], nums[i+1] = nums[i+1], nums[i]
		c += 1
	elif i == j and i == len(nums) - 1:
		nums[i], nums[0] = nums[0], nums[i]
		c += 1
print(c)

Buggy submission (verdict: Runtime Error):
input()
nums = [int(i)-1 for i in input().split()]
c = 0

for i, j in enumerate(nums):
	if i == j:
		nums[i], nums[i+1] = nums[i+1], nums[i]
		c += 1
print(c)
Problem p03633 (python)

Fixed submission:
from functools import reduce

def gcd(x,y):
    if x % y == 0:
        return y
    return gcd(y, x % y)

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = [int(input()) for _ in range(int(input()))]
print(lcm(*n))

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

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

def lcm(*numbers):
    return reduce(lcm_base, numbers, 1)

n = [int(input()) for _ in range(int(input()))]
print(lcm(*n))
Problem p03673 (python)

Fixed submission:
from collections import deque

n = int(input())
a = [int(i) for i in input().split()]
d = deque()
for i, v in enumerate(a):
    if i % 2: d.append(v)
    else: d.appendleft(v)
print(*d if n % 2 else reversed(d))

Buggy submission (verdict: Runtime Error):
from collections import deque
n = int(input())
a = [int(i) for i in input().split()]
odd = deque()
even = deque()
for i, v in enumerate(a):
    if (i + 1) % 2: odd.appendleft(v)
    else: even.appendleft(v)
print(*(odd + even) if n % 2 else (even + odd))
Problem p03844 (python)

Fixed submission:
print(eval(input()))

Buggy submission (verdict: Runtime Error):
import copy
N = int(input())
t = [int(x) for x in input().split()]
p = []
for _ in range(int(input())):
	p.append([int(x) for x in input().split()])

result = []
ori_t = copy.deepcopy(t)
for i,j in zip(t,p):
	t = copy.deepcopy(ori_t)
	t[j[0]-1] = j[1]
	result.append(sum(t))

print(result)
Problem p03251 (python)

Fixed submission:
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            print('No War')
        else:
            print('War')
    else:
        print('War')

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    data = list(map(int, input().split()))
    Xn = data[0]
    Yn = data[1]
    X = data[2]
    Y = data[3]

    Xs = list(map(int, input().split()))
    Ys = list(map(int, input().split()))

    mergin = list(range(X, Y))
    flag = false
    if not mergin:
        mergin.append(0)
        flag = true
    x_line = min(mergin)
    y_line = max(mergin)

    max_x = max(Xs)
    min_y = min(Ys)

    if (max_x < min_y):
        if ((max_x + min_y) // 2 in mergin):
            if flag:
                print('War')
            else:
                print('No War')
        else:
            if flag:
                print('No War')
            else:
                print('War')
    else:
        if flag:
            print('No War')
        else:
            print('War')

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

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

if __name__ == "__main__":
    main()

Buggy submission (verdict: Runtime Error):
def main():
    A, B = input().split()
    print((A - 1) * (B - 1))

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

Fixed submission:
n,m,x = map(int,input().split())
costlst = []
scorelst = []
ans = float("inf")
for _ in range(n):
    cost,*score = map(int,input().split())
    costlst.append(cost)
    scorelst.append(score)
for i in range(2**n):
    cost = 0
    defaultscore = [0]*m
    for j in range(n):
        if (i>>j)&1:
            cost += costlst[j]
            for k in range(m):
                defaultscore[k] += scorelst[j][k]
    if all([defaultscore[p] >= x for p in range(m)]):
            ans = min(ans,cost)
        
            
                
                
                 
print(ans if ans != float("inf") else "-1")

Buggy submission (verdict: Runtime Error):
n,m,x = map(int,input().split())
costlst = []
scorelst = []
ans = float("inf")
for _ in range(m):
    cost,*score = map(int,input().split())
    costlst.append(cost)
    scorelst.append(score)
for i in range(2**n):
    cost = 0
    defaultscore = [0]*m
    for j in range(n):
        if (i>>j)&1:
            cost += costlst[j]
            for k in range(m):
                defaultscore[k] += scorelst[j][k]
        if all([defaultscore[p] >= x for p in range(m)]):
            ans = min(ans,cost)
        
            
                
                
                 
print(ans if ans != float("inf") else "-1")
Problem p02687 (python)

Fixed submission:
s = input()
if s == "ABC":
  print("ARC")
else:
  print("ABC")

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
    if height[x-1] >= height[y-1]:
      lst[y-1] = 1
    if height[x-1] <= height[y-1]:
      lst[x-1] = 1
print(lst.count(0))

Buggy submission (verdict: Runtime Error):
n,m = map(int,input().split())
height = list(map(int,input().split()))
lst = [0]*n
for j in range(m):
    x,y = map(int,input().split())
if height[x-1] >= height[y-1]:
    lst[y-1] = 1
if height[x-1] <= height[y-1]:
    lst[x-1] = 1
print(lst.count(0))
Problem p03854 (python)

Fixed submission:
l = input()
l = l.replace('eraser','')
l = l.replace('erase','')
l = l.replace('dreamer','')
l = l.replace('dream','')
 
if l == '':
    print('YES')
else:
    print('NO')

Buggy submission (verdict: Runtime Error):
s = input()
s = s.replase('eraser', '')
s = s.replase('erase', '')
s = s.replase('dreamer', '')
s = s.replase('dream', '')

if l == '':
    print('YES')
else:
    print('NO')
Problem p02939 (python)

Fixed submission:
s = input()
i = 1
now = s[0]
ans = 1
while i <=len(s)-1:
    if i >=len(s):
        break
    if len(now)==2:
        now = s[i]
        i += 1
        ans+=1
        continue
    if len(now)==1:
        if now != s[i]:
            now = s[i]
            i +=1
            ans+=1
        else:
            if i+2 <= len(s):
                now = s[i:i+2]
                ans +=1
            i +=2
            continue
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
i = 0
now = s[0]
ans = 1
while i <=len(s)-1:
    if i ==len(s) -1:
        break
    if len(now)==2:
        now = s[i+1]
        i += 1
        ans+=1
    if len(now)==1:
        if now != s[i+1]:
            now = s[i+1]
            i +=1
            ans+=1
        else:
            if i+2 <= len(s)-1:
                now = s[i+1:i+3]
                ans +=1
            i +=2
print(ans)

Buggy submission (verdict: Runtime Error):
s = input()
i = 0
now = s[0]
ans = 1
while i <len(s)-1:
    if len(now)==2:
        now = s[i+1]
        i += 1
        ans+=1
    if len(now)==1:
        if now != s[i+1]:
            now = s[i+1]
            i +=1
            ans+=1
        else:
            if i+2 <= len(s)-1:
                now = s[i+1:i+3]
                ans +=1
            i +=2
print(ans)
Problem p02953 (python)

Fixed submission:

n= int(input())
hl = list(map(int,input().split(' ')))


hmax = 0
if n == 1:
    print('Yes')
    exit()

for i in range(n):
    if (hl[i] >= (hmax - 1)):
        hmax = max(hmax,hl[i])
        if i == n - 1:
        	print('Yes')
        	break
    else:
        print('No')
        break

Buggy submission (verdict: Runtime Error):

n= int(input())
hl = list(map(int,input().split(' ')))


hmax = 0
def hantei(n,x):
    global hmax
    if n == 1:
        print('Yes')
        exit()
        
    if x == n - 1:
        print('Yes')
        exit()
    if (hl[x] >= (hmax - 1)):
        hmax = max(hmax,hl[x])
        return hantei(n,x+1)
    else:
        return print('No')
    

hantei(n,0)

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


def hantei(x):
    if x == n - 1:
        print('Yes')
        exit()
    
    if hlist[x]>(hlist[x+1]+1):
        print('No')
        exit()
    
    return hantei(x+1)

print(hantei(0))