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

Fixed submission:
import sys
input = sys.stdin.readline
import sys
sys.setrecursionlimit(1000000)
n = int(input())

g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append((v, w))
    g[v].append((u, w))

chk = [0]*n
chk[0] = 1

def dfs(now, prev):
    global chk
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next[0] != prev:
          if next[1]%2 == 0:
            chk[next[0]] = chk[now]
          elif next[1]%2 == 1:
            chk[next[0]] = (chk[now]*-1)
          
          dfs(next[0], now)
        
dfs(0,-1)
chk = tuple(chk)
for i in chk:
  if i == 1:
    print(1)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())

g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append((v, w))
    g[v].append((u, w))

chk = [0]*n
chk[0] = 1

def dfs(now, prev):
    global chk
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next[0] != prev:
          if next[1]%2 == 0:
            chk[next[0]] = chk[now]
          elif next[1]%2 == 1:
            chk[next[0]] = (chk[now]*-1)
          
          dfs(next[0], now)
        
dfs(0,0)
#print(chk)
chk = tuple(chk)
for i in chk:
  if i == 1:
    print(1)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())

g = [[] * n for i in range(n)]
for i in range(n-1):
    u, v, w = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append((v, w))
    g[v].append((u, w))

chk = [0]*n
chk[0] = 1

def dfs(now, prev):
    global chk
    # 今いる頂点から行ける頂点を順に next に入れてループ
    for next in g[now]:
        if next[0] != prev:
          if next[1]%2 == 0:
            chk[next[0]] = chk[now]
          elif next[1]%2 == 1:
            chk[next[0]] = (chk[now]*-1)
          
          dfs(next[0], now)
        
dfs(0,-1)
#print(chk)
chk = tuple(chk)
for i in chk:
  if i == 1:
    print(1)
  else:
    print(0)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())

def find(x):
    if par[x] < 0:
        return x
    else:
        px = find(par[x])
        wei[x] += wei[par[x]]
        par[x] = px
        return px

def weight(x):
    find(x)
    return wei[x]

#w[y]=w[x]+wとなるようにxとyを併合
def unite(x,y,w):
    w += wei[x]-wei[y]
    x = find(x)
    y = find(y)
    
    if x == y:
        return False
    else:
        #sizeの大きいほうがx
        if par[x] > par[y]:
            x,y = y,x
            w = -w
        par[x] += par[y]
        par[y] = x
        wei[y] = w
        return True

def diff(x,y):
    return weight(y)-weight(x)

par = [-1]*n
wei = [0]*n
chk = []
for i in range(n-1):
  u,v,w = [int(i) for i in input().split()]
  chk_append = chk.append
  chk_append((u,v,w))
  
from operator import itemgetter
chk = sorted(chk,key=itemgetter(0))

for i in chk:
  unite(i[0]-1,i[1]-1,i[2])    

m = find(6)
for i in range(n):
  #print(diff(m,i),i+1)
  if diff(m,i)%2 == 0:
    print(0)
  else:
    print(1)
Problem p03229 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
chk = []
for i in range(n):
  a = int(input())
  chk.append(a)
chk.sort()
if n%2 == 0:
  l = [i*2 for i in chk[:n//2]]
  r = [i*2 for i in chk[n//2:]]
  print(sum(r)-sum(l)+chk[n//2-1]-chk[n//2])
else:
  l = [i*2 for i in chk[:(n-1)//2]]
  r = [i*2 for i in chk[(n-1)//2+1:]]
  p = sum(r)-sum(l)+chk[(n-1)//2-1]-chk[(n-1)//2]
  q = sum(r)-sum(l)+chk[(n-1)//2]-chk[(n-1)//2+1]
  print(max(p,q))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
chk = []
for i in range(n):
  a = int(input())
  chk.append(a)
chk.sort()
if n%2 == 0:
  l = [i*2 for i in chk[:n//2]]
  r = [i*2 for i in chk[n//2:]]
  print(sum(r)-sum(l)+chk[n//2-1]-chk[n//2])
else:
  l = [i*2 for i in chk[:(n-1)//2]]
  r = [i*2 for i in chk[(n-1)//2+1:]]
  print(max(sum(r)-sum(l)+chk[(n-1)//2-1]-chk[(n-1)//2]),(sum(r)-sum(l)+chk[(n-1)//2]-chk[(n-1)//2+1]))

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = innt(input())
chk = []
for i in range(n):
  a = input()
  chk.append(a)
chk.sort()
if n%2 == 0:
  l = [i*2 for i in chk[:n//2]]
  r = [i*2 for i in chk[n//2:]]
  print(sum(r)-sum(l)+chk[n//2-1]-chk[n//2])
else:
  l = [i*2 for i in chk[:(n-1)//2]]
  r = [i*2 for i in chk[(n-1)//2+1:]]
  print(max(sum(r)-sum(l)+chk[(n-1)//2-1]-chk[(n-1)//2]),(sum(r)-sum(l)+chk[(n-1)//2]-chk[(n-1)//2+1]))
Problem p03238 (python)

Fixed submission:
n = int(input())
if n == 1:
  print('Hello World')
  exit()
else:
  a = int(input())
  b = int(input())
  print(a+b)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)

p,q,r = c[0]
if n == 1:
  print(p,q,r)
  exit()

end = c[-1]
c = c[1:]
for i in range(101):
  for j in range(101):
    chk = abs(p-i)+abs(q-j)+r
    for num,k in enumerate(c):
      x,y,h = k
      if abs(x-i)+abs(y-j)+h != chk and h != 0:
        break
      if k == end:
        ans = (i,j,chk)

print(*ans)
Problem p03240 (python)

Fixed submission:
import sys
input = sys.stdin.readline
n = int(input())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)

from operator import itemgetter
c = sorted(c,key=itemgetter(2),reverse=True)
p,q,r = c[0]
end = c[-1]
c = c[1:]
for i in range(101):
  for j in range(101):
    if r > 0:
      chk = abs(p-i)+abs(q-j)+r
    else:
      chk = 1
    for num,k in enumerate(c):
      x,y,h = k
      if h == 0:
        if abs(x-i)+abs(y-j) < chk:
          break
      else:
        if abs(x-i)+abs(y-j)+h != chk:
          break
      if k == end:
        ans = (i,j,chk)

print(*ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)

p,q,r = c[0]
if n == 1:
  print(p,q,r)
  exit()

end = c[-1]
c = c[1:]
for i in range(101):
  for j in range(101):
    chk = abs(p-i)+abs(q-j)+r
    for num,k in enumerate(c):
      x,y,h = k
      if abs(x-i)+abs(y-j)+h != chk and h != 0:
        break
      if k == end:
        ans = (i,j,chk)

print(*ans)

Buggy submission (verdict: Runtime Error):
import sys
input = sys.stdin.readline
n = int(input())
c = []
for i in range(n):
  a = [int(i) for i in input().split()]
  c.append(a)

p,q,r = c[0]
c = c[1:]
for i in range(101):
  for j in range(101):
    chk = abs(p-i)+abs(q-j)+r
    for num,k in enumerate(c):
      x,y,h = k
      if abs(x-i)+abs(y-j)+h != chk:
        break
      if num == n-2:
        ans = (i,j,chk)

print(*ans)
Problem p03388 (python)

Fixed submission:
q = int(input())
for i in range(q):
  a,b = map(int,input().split())
  if a == b:
    print(2*a-2)
  else:
    n= (a*b)**0.5
    d = int(n)
    if n.is_integer():
        d -= 1
    ans = d*2-1
    if d*(d+1) >= a*b:
      ans -= 1
    print(ans)

Buggy submission (verdict: Runtime Error):
import math
q = int(input())
for i in range(q):
  a,b = map(int,input().split())
  if a == b:
    print(a*2-2)
    continue
  y = max(a,b)
  z = min(a,b)
  ind = int(math.sqrt(a*b))
  if ind.is_integer():
    ind -= 1
  cnt = 0
  else:
    if ind*(ind+1) < a*b:
      if ind >= z:
        cnt = 1
      if ind+1 >= y:
        cnt = 2
      print(2*ind-cnt)
    else:
      if ind >= z:
        cnt = 1
      print(2*ind-1-cnt)
Problem p03394 (python)

Fixed submission:
n = int(input())
if n == 3:
  print(2,5,63)
elif n == 4:
  print(2,5,20,63)
elif n == 6:
  print(2,4,6,12,3,9)
elif n == 19999:
  ans = []
  for i in range(5000):
    ans.append(3+6*i)
  for j in range(15000):
    m = 2+2*j
    if m != 30:
      ans.append(m)
  print(*ans)
else:
  m = 1
  if n > 15001:
    m = (n-15000)//2
  for j in range(m,2501):
    if (n-2*j)/3 == int((n-2*j)/3) and 0 < (n-2*j)//3 <= 5000:
      x = j; y = (n-2*x)//3
      #print(x,y,2*x+3*y)
      break
  ans = []
  for i in range(2*x):
    ans.append(3+6*i)
  for j in range(3*y):
    ans.append(2+2*j)
    
  print(*ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 3:
  print(2,5,63)
elif n == 4:
  print(2,5,20,63)
elif n == 6:
  print(2,4,6,12,3,9)
else:
  m = 1
  if n > 15001:
    m = (n-15000)//2
  for j in range(m,2501):
    if (n-2*j)/3 == int((n-2*j)/3) and 0 < (n-2*j)//3 <= 5000:
      x = j; y = (n-2*x)//3
      #print(x,y,2*x+3*y)
      break
  ans = []
  for i in range(2*x):
    ans.append(3+6*i)
  for j in range(3*y):
    ans.append(2+2*j)
    
  print(*ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
if n == 3:
  print(2,5,63)
elif n == 4:
  print(2,5,20,63)
elif n == 6:
  print(2,4,6,12,3,9)
else:
  m = 1
  if n > 15001:
    m = (n-15000)//2
  for j in range(m,2501):
    if (n-2*j)/3 == int((n-2*j)/3) and (n-2*j)//3 <= 5000:
      x = j; y = (n-2*x)//3
      #print(x,y,2*x+3*y)
      break
  ans = []
  for i in range(2*x):
    ans.append(3+6*i)
  for j in range(3*y):
    ans.append(2+2*j)
    
  print(*ans)
Problem p03408 (python)

Fixed submission:
n = int(input())
from collections import Counter
c = Counter()
for i in range(n):
  a = input()
  c.update({a:1})
  
m = int(input())
for i in range(m):
  s = input()
  if c[s] >= 1:
    c.update({s:-1})
    
print(c.most_common()[0][1])

Buggy submission (verdict: Runtime Error):
n = int(input())
from collections import Counter
c = Counter()
for i in range(n):
  c.update[{input():1}]
  
m = int(input())
for i in range(m):
  s = input()
  if c[s] >= 1:
    c.update[{s:-1}]
    
print(c.most_common()[0][1])
Problem p03411 (python)

Fixed submission:
from operator import itemgetter
from bisect import bisect
n = int(input())
a = [tuple(map(int,input().split())) for i in range(n)]
b = [tuple(map(int,input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
a.sort(key=itemgetter(0))
b.sort(key=itemgetter(1))
b.sort(key=itemgetter(0))

ans = 0
for l,r in b:
  ind = bisect(a,(l-1,r-1))
  chk = 0
  d = -1
  for i in range(min(len(a),ind)):
    if a[i][1] < r:
      chk = max(chk,a[i][1])
      if chk == a[i][1]:
        d = i
  if d >= 0:
    ans += 1
    k = a[d]
    a.remove(k)
    
print(ans)

Buggy submission (verdict: Runtime Error):
from operator import itemgetter
from bisect import bisect
n = int(input())
a = [tuple(map(int,input().split())) for i in range(n)]
b = [tuple(map(int,input().split())) for i in range(n)]
a.sort(key=itemgetter(1))
a.sort(key=itemgetter(0))
b.sort(key=itemgetter(1))
b.sort(key=itemgetter(0))

ans = 0
for l,r in b:
  ind = bisect(a,(l-1,r-1))
  chk = 0
  for i in range(ind):
    if a[i][1] < r:
      chk = max(chk,a[i][1])
      if chk == a[i][1]:
        d = i
  if ind > 0:
    ans += 1
    k = a[d]
    a.remove(k)
print(ans)
Problem p03487 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
b = [i for i in a if i <= 10**5]
ans = len(a)-len(b)
import collections
c = collections.Counter(b)
for i in range(0,10**5+1):
  if c[i] < i:
    ans += c[i]
  if c[i] > i:
    ans += c[i]-i
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
import collections
c = collections.Counter(a)
for i in range(10**9):
  if c[i] < i:
    ans += c[i]
  if c[i] > i:
    ans += c[i]-i
print(ans)
Problem p03583 (python)

Fixed submission:
N = int(input())
import math
U = math.ceil(3*N/4)
D = math.ceil(N/4)
if N % 2 == 0:
  ans = (N,N,N//2)
else:
  if D%2 == 1:
    D += 1
  h = -1
  for n in range(D,3500):
    if h > 0:
      break
    for w in range(n,3500):
      #print(h,n,w)
      if w*n*N/(4*n*w-w*N-n*N) == int(w*n*N/(4*n*w-w*N-n*N)):
        h = w*n*N//(4*n*w-w*N-n*N)
        ans = (w*n*N//(4*n*w-w*N-n*N),n,w)
        break
        
print(*ans)

Buggy submission (verdict: Runtime Error):
N = int(input())
import math
U = math.ceil(3*N/4)
D = math.ceil(N/4)
if N % 2 == 0:
  print(N,N,N//2)
else:
  if D%2 == 1:
    D += 1
  h = -1
  for n in range(D,3500):
    if h > 0:
      break
    for w in range(n,3500):
      #print(h,n,w)
      if w*n*N/(4*n*w-w*N-n*N) == int(w*n*N/(4*n*w-w*N-n*N)):
        h = w*n*N//(4*n*w-w*N-n*N)
        ans = (w*n*N//(4*n*w-w*N-n*N),n,w)
        break
        
print(ans)
Problem p03607 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
b = []
for i in range(0,n-1,2):
  if a[i] != a[i+1]:
    b.append(a[i])
    b.append(a[i+1])
  else:
    continue
if n%2 == 1:
  b.append(a[-1])
#print(b)
ans = []
if b != []:
  ans.append(b[0])
  for j in range(1,len(b)-1,2):
    if b[j] != b[j+1]:
      ans.append(b[j])
      ans.append(b[j+1])
  if len(b)%2 == 0:
    ans.append(b[-1])
#print(ans)
if ans == []:
  print(0)
else:
  print(len(ans))

Buggy submission (verdict: Runtime Error):
import collections
import sys
input = sys.stdin.readline
n = int(input())
b = []
for i in range(n):
  a = int(input())
  b_append = b.append
  b_append(a)

s = set(b)
c = collections.Counter(b)
ans = 0
for i in range(n-len(s)):
  if c.most_common()[i][1] % 2 == 0:
    ans -= 1
ans += len(s)
print(ans)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
b = []
for i in range(0,n-1,2):
  if a[i] != a[i+1]:
    b.append(a[i])
    b.append(a[i+1])
  else:
    continue
if n%2 == 1:
  b.append(a[-1])
#print(b)
ans = []
if b != []:
  ans.append(b[0])
  for j in range(1,len(b)-1,2):
    if b[j] != b[j+1]:
      ans.append(b[i])
      ans.append(b[i+1])
#print(ans)
if ans == []:
  print(0)
else:
  print(len(ans))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = []
for i in range(n):
  a.append(int(input()))
a.sort()
b = []
for i in range(0,n-1,2):
  if a[i] != a[i+1]:
    b.append(a[i])
    b.append(a[i+1])
  else:
    continue
if n%2 == 1:
  b.append(a[-1])
print(b)
ans = []
if b != []:
  ans.append(b[0])
  for j in range(1,len(b)-1,2):
    if b[j] != b[j+1]:
      ans.append(b[i])
      ans.append(b[i+1])
print(ans)
if ans == []:
  print(0)
else:
  print(len(ans))
Problem p03610 (python)

Fixed submission:
s = list(input())
a = []
for i in range(len(s)):
  if 2*i+1 <= len(s):
    a.append(s[2*i])
  else:
    break
print(''.join(a))

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i and a[j]-a[i] <= 2:
      #print(i,j)
      count += 1
    else:
      ans.append(count)
      count = 0
if n == 1:
  print(1)
else:
  print(max(ans))
Problem p03611 (python)

Fixed submission:
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
p1 = []
for i in range(n):
  p1.append(a[i]-1)
p2 = []
for i in range(n):
  p2.append(a[i]+1)
chk = a+p1+p2
chk.sort()
#print(chk)
ans =[]
count = 0
for i in range(3*n-1):
  if chk[i+1] == chk[i]:
    count += 1
  else:
    ans.append(count)
    count = 0
print(max(ans)+1)

Buggy submission (verdict: Runtime Error):
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
count = 0
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i:
      if a[j]-a[i] <= 2:
        #print(i,j)
        count += 1
      else:
        if count != 0:
          ans.append(count)
        count = 0
        i += 1
    else:
      continue
#print(ans)
if n == 1:
  print(1)
else:
  print(max(ans))

Buggy submission (verdict: Runtime Error):
ans = []
for i in range(n):
  for j in range(n-1):
    if j >= i:
      if a[j]-a[i] <= 2:
        #print(i,j)
        count += 1
      else:
        if count != 0:
          ans.append(count)
        count = 0
        i += 1
    else:
      continue
if n == 1:
  print(1)
else:
  print(max(ans))
Problem p03651 (python)

Fixed submission:
from fractions import gcd
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
g = a[0]
for i in a:
  g = gcd(g,i)
  
if k%g != 0:
  print('IMPOSSIBLE')
elif k<=max(a):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

Buggy submission (verdict: Runtime Error):
from fractions import gcd
n,k = map(int,input().split())
a = [int(i) for i in input().split()]
g = a[0]
for i in a:
  g = gcd(g,a)
  
if k%g != 0:
  print('IMPOSSIBLE')
elif k<=max(a):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
Problem p03680 (python)

Fixed submission:
n = int(input())
a = []
for i in range(n):
	a.append(int(input()))
t = a[0]
ans = 1
if t == 2:
	print(ans)
else:
	while True:
		t = a[t-1]
		ans += 1
		if t == 2:
			print(ans)
			break
		if ans > n:
			print('-1')
			break

Buggy submission (verdict: Runtime Error):
n = int(input())
for i in range(n):
	a.append(int(input()))
t = [0]
ans = 1
if t == 2:
	print(ans)
else:
	while True:
		t = a[t-1]
		ans += 1
		if t == 2:
			print(ans)
			break
		if ans > n:
			print('-1')
			break
Problem p03740 (python)

Fixed submission:
n,m = map(int,input().split())
if abs(n-m) < 2:
  print('Brown')
else:
  print('Alice')

Buggy submission (verdict: Runtime Error):
n,m = map(int(input().split()))
if abs(n-m) < 2:
  print('Brown')
else:
  print('Alice')
Problem p03778 (python)

Fixed submission:
w,a,b = [int(i) for i in input().split()]
ans = 0
if a <= b <= a+w or b <= a <= b+w:
  print(ans)
else:
  ans = min(abs(b-a-w),abs(a-b-w))
  print(ans)

Buggy submission (verdict: Runtime Error):
W,a,b = [int(i) for i in input().split()]
ans = 0
if a <= b <= a+w or b <= a <= b+w:
  print(ans)
else:
  ans = min(abs(b-a-w),abs(a-b-w))
  print(ans)
Problem p03814 (python)

Fixed submission:
s = input()
t = s[::-1]
a = s.index('A')
z = t.index('Z')
print(len(s)-a-z)

Buggy submission (verdict: Runtime Error):
s = input()
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)

Buggy submission (verdict: Runtime Error):
s = input()
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)

Buggy submission (verdict: Runtime Error):
s = input
t = s[::-1]
a = s.index('a')
z = t.index('z')
print(len(s)-a-z)
Problem p03854 (python)

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

Buggy submission (verdict: Runtime Error):
s = inpput()
while True:
	S = s
	if len(S) < 5:
		print('NO')
		break
	if S == 'dream' or S == 'erase':
		print('YES')
		break
	else:
		if S[0] == 'd':
			if S[7] == 'a':
				T ='dream'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'dreamer'
				if S[:7] == T:
					S = S[7:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		if S[0] == 'e':
			if len(S) >= 6 and S[5] == 'r':
				T = 'eraser'
				if S[:6] == T:
					S = S[6:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'erase'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		else:
			print('NO')
			break

Buggy submission (verdict: Runtime Error):
s = input()
while True:
	S = s
	if len(S) < 5:
		print('NO')
		break
	if S == 'dream' or S == 'erase':
		print('YES')
		break
	else:
		if S[0] == 'd':
			if S[7] == 'a':
				T ='dream'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'dreamer'
				if S[:7] == T:
					S = S[7:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		if S[0] == 'e':
			if len(S) >= 6 and S[5] == 'r':
				T = 'eraser'
				if S[:6] == T:
					S = S[6:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'erase'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		else:
            print('NO')
            break

Buggy submission (verdict: Runtime Error):
s = input()
while True:
	S = s
	if len(S) < 5:
		print('NO')
		break
	if S == 'dream' or S == 'erase':
		print('YES')
		break
	else:
		if S[0] == 'd':
			if S[7] == 'a':
				T ='dream'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'dreamer'
				if S[:7] == T:
					S = S[7:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		if S[0] == 'e':
			if len(S) >= 6 and S[5] == 'r':
				T = 'eraser'
				if S[:6] == T:
					S = S[6:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
			else:
				T = 'erase'
				if S[:5] == T:
					S = S[5:]
					T = ""
					if S == "":
						print('YES')
						break
					s = S
				else:
					print('NO')
					break
		else:
			print('NO')
            break
Problem p03860 (python)

Fixed submission:
a,x,c = input().split()
X = x[0]
list = ['A',X,'C']
ans = ''.join(list)
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ams += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = (b-a+1)//x
  if a%x == 0 and b%x == 0:
    ans = ans + 1
  if x == 1:
    ans = ans - 1
print(ans)
Problem p03861 (python)

Fixed submission:
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ans += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
if a%x == 0:
  ams += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)

Buggy submission (verdict: Runtime Error):
a,b,x = map(int,input().split())
if a == 0:
  ans = b//x + 1
else:
  ans = b//x - a//x
  if a%x == 0:
    ams += 1
print(ans)
Problem p03963 (python)

Fixed submission:
N,K = map(int,input().split())
print(int(K*(K-1)**(N-1)))

Buggy submission (verdict: Runtime Error):
N,K = int(input().split())
print(int(K*((K-1)**(N-1))))
Problem p04011 (python)

Fixed submission:
N = int(input())
K = int(input())
X = int(input())
Y = int(input())
if N > K:
	print(int(K*X + (N-K)*Y))
else:
	print(int(N*X))

Buggy submission (verdict: Runtime Error):
n = list(input())
ans = 'Yes'
 for i in w:
	if int(w.count(i))%2 == 1:
		ans = 'No'
		break
	if int(w.count(i))%2 == 0:
		continue
print(ans)
Problem p04029 (python)

Fixed submission:
n = int(input())
s = 0
for i in range(1,n):
	s = s+i
print(s+n)

Buggy submission (verdict: Runtime Error):
s = input()
word = ""
for i in range(n):
	if s[i] == '0':
		word = word + "0"
	if s[i] == '1':
		word = word + "1"
	if s[i] == "B":
		word = word[:-1]

print(word)

Buggy submission (verdict: Runtime Error):
n = int(input())
print(sum(for i in range(1:n)))
Problem p04043 (python)

Fixed submission:
l = list(map(int,input().split()))
if int(l.count(5)) == 2 and int(l.count(7)) == 1:
	print('YES')
else:
	print('NO')

Buggy submission (verdict: Runtime Error):
a,b,c = map(int,(input().split()))
l = [a,b,c]
if int(l.count(5)) == 2 and int(l.count(7)) == 1:
	print(Yes)
else:
	print(No)