Harryxun/testdata huggingface dataset:
Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
mx = 0
for bit in range(1<<N):
    sums = 0
    for i in range(N):
        mask = 1<<i
        if mask&bit:
            sums += s[i]
        
    if mx < sums:
        if sums%10!=0:
            mx = sums

print(mx)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
s = sorted(s)
sm = sum(s)
if sm%10!=0:
    ans = sm
else:
    for i in s:
        if i%10!=0:
            sm-=i
            break
    ans = sm
    if sm==sum(s):
        ans = 0
print(ans)

Buggy python submission (verdict: Runtime Error):
N = int(input())
s = []
ans = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
mx = 0
for bit in range(1<<N):
    sums = 0
    for i in range(N):
        mask = 1<<i
        if mask&bit:
            sums += s[i]
        
    if mx < sums:
        if sums%10!=0:
            mx = sums

print(answer)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
s = sorted(s)
sm = sum(s)
if sm%10!=0:
    ans = sm
else:
    for i in s:
        if i%10!=0:
            sm-=i
            break
    ans = sm
    if sm==sum(s):
        ans = 0
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
N = int(input())
s = []
ans = []
for _ in range(N):
    inp = int(input())
    s.append(inp)

for bit in range(1<<N):
    sums = 0
    for i in range(N):
        mask = 1<<i
        if mask&bit:
            sums += s[i]
        ans.append(sums)
ans = sorted(ans,reverse=True)
answer=0
for i in range(N):
    if ans[i]%10!=0:
        answer = ans[i]
        break
print(answer)

Fixed submission:
N = int(input())
s = []
for _ in range(N):
    inp = int(input())
    s.append(inp)
s = sorted(s)
sm = sum(s)
if sm%10!=0:
    ans = sm
else:
    for i in s:
        if i%10!=0:
            sm-=i
            break
    ans = sm
    if sm==sum(s):
        ans = 0
print(ans)
Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
result = 1
delta = 0
for i in range(1,n) :
    if a[i-1] < a[i]:
        ndelta = 1
    elif a[i-1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
        
    if delta!= ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
    
print(result)
    
            

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
result = 1
delta = 0
for i in range(1,N) :
    if a[i-1] < a[i]:
        ndelta = 1
    elif a[i-1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
        
    if delta and ndelta and delta != ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
    
print(result)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
result = 1
delta = 0
for i in range(1,n) :
    if a[i-1] < a[i]:
        ndelta = 1
    elif a[i-1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
        
    if delta and ndelta and delta != ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
    
print(result)
    
            

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
result = 1
delta = 0
for i in range(1,N) :
    if a[i-1] < a[i]:
        ndelta = 1
    elif a[i-1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
        
    if delta and ndelta and delta != ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
    
print(result)

Buggy python submission (verdict: Runtime Error):
N = int(input())
a = [int(i) for i in input().split()]
count = 0
i = 0
while i < N-2:
    if a[i] <= a[i+1]:
        if a[i+1] > a[i+2]:
            count += 1
            i += 1
    
    if a[i] >= a[i+1]:
        if a[i+1] < a[i+2]:
            count += 1
            i += 1
    i += 1
print(count+1)
    
            

Fixed submission:
N = int(input())
a = [int(i) for i in input().split()]
result = 1
delta = 0
for i in range(1,N) :
    if a[i-1] < a[i]:
        ndelta = 1
    elif a[i-1] > a[i]:
        ndelta = -1
    else:
        ndelta = 0
        
    if delta and ndelta and delta != ndelta:
        result += 1
        delta = 0
    elif not delta:
        delta = ndelta
    
print(result)
Buggy python submission (verdict: Runtime Error):
from collections import Counter
n = int(input())
s = list(input())
ans1 = dict(Counter(s))
for i in range(n-1):
    ans = {}
    s = list(input())
    ans2 = dict(Counter(s))
    for j in ans2:
        if j in ans1:
            ans[j] = min(ans1[j],ans2[j])
st = []
sorted(ans)
for i,j in zip(ans,ans.values()):
    st.append(i*j)
print(''.join(st))

Fixed submission:
from collections import Counter
n = int(input())
s = [dict(Counter(list(input()))) for _ in range(n)]
st = []
kouho = s[0]
moji = sorted(kouho)
for i in moji: #１つめの辞書から１つ１つ取り出す
    mn = kouho[i]
    for j in s: #すべての辞書において確認
        if i in j: #もし辞書に入っているのであれば取る値の小さいほうをmnに格納
            mn = min(mn,j[i])
        else:
            mn = 0
    st.append(i*mn)

print(''.join(st))
Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
student = []
check = []
for i in range(n):
    ab = [int(i) for i in input().split()]
    student.append(ab)
for j in range(m):
    cd = [int(i) for i in input().split()]
    check.append(cd)
mn = 10**8
for ax,by in student:
    for i in range(m):
        dist = abs(ax-check[i][0]) + abs(by-check[i][1])
        if mn > dist:
            ans = i+1
            mn = dist
    print(ans)
    mn = 10**8

Fixed submission:
n,m = map(int,input().split())
student = []
check = []
for i in range(n):
    ab = [int(i) for i in input().split()]
    student.append(ab)
for j in range(m):
    cd = [int(i) for i in input().split()]
    check.append(cd)
mn = 10**13
for ax,by in student:
    for i in range(m):
        dist = abs(ax-check[i][0]) + abs(by-check[i][1])
        if mn > dist:
            ans = i+1
            mn = dist
    print(ans)
    mn = 10**13
Buggy python submission (verdict: Runtime Error):
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    1+1
else:
    ans = x//11 *2 +1
print(ans)

Fixed submission:
x = int(input())
ans = x // 11 * 2
if x % 11 >= 7:
    ans += 2
elif x % 11 == 0:
    pass
else:
    ans += 1
print(ans)

Buggy python submission (verdict: Runtime Error):
x = int(input())
if x%11 > 6:
    ans = x//11 *2 +2
elif x %11==0:
    pass
else:
    ans = x//11 *2 +1
print(ans)

Fixed submission:
x = int(input())
ans = x // 11 * 2
if x % 11 >= 7:
    ans += 2
elif x % 11 == 0:
    pass
else:
    ans += 1
print(ans)
Buggy python submission (verdict: Runtime Error):
x,y = map(int,input().split())
mn = 10**10
if x<=y: ans = min(ans,y-x)
if -x<=y: ans = min(ans,1+y-(-x))
if x<=-y: ans = min(ans,-y-x+1)
if -x<=-y: ans = min(ans,-y-(-x)+1)
print(ans)


Fixed submission:
x,y = map(int,input().split())
ans = 10**10
if x<=y: ans = min(ans,y-x)
if -x<=y: ans = min(ans,1+y-(-x))
if x<=-y: ans = min(ans,-y-x+1)
if -x<=-y: ans = min(ans,-y-(-x)+2)
print(ans)
Buggy python submission (verdict: Runtime Error):

n, a, b = list(map(int, input().split()))

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else: 
    if n%sum > a: 
        print ((n // sum)*a) + a

    else:
        res = ((n // sum)*a) + (n % sum)
        print(res)


Fixed submission:

n, a, b = list(map(int, input().split()))

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else: 
    if n%sum > a: 
        print (((n // sum)*a) + a)

    else:
        res = ((n // sum)*a) + (n % sum)
        print(res)

Buggy python submission (verdict: Runtime Error):

n, a, b = list(map(int, input().split()))

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else:
    res = ((n // sum)*a) + (n % sum)
    
    if n%sum > a: 
        print( ((n // sum)*a) + a

    else:
        print(res)


Fixed submission:

n, a, b = list(map(int, input().split()))

sum = a+b

if n < a+b:

    if n < a :
        print(n)
    else:
        print(a)

else: 
    if n%sum > a: 
        print (((n // sum)*a) + a)

    else:
        res = ((n // sum)*a) + (n % sum)
        print(res)
Buggy python submission (verdict: Runtime Error):

n = int(input())
x = list(map(int, input().split()))

a = []
for pp in 100:
    sum = 0
    for xx in x:
        sum += abs((xx-pp) ** 2)
    a.append(sum)

print(min(a))


Fixed submission:

n = int(input())
x = list(map(int, input().split()))

a = []
for pp in range(1,101):
    sum = 0
    for xx in x:
        sum += abs((xx-pp) ** 2)
    a.append(sum)

print(min(a))
Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
            a -= 1
  
	elif a < 1 and b >= 1:
            b -= 1
	else:
            break
        
print (a,b,end=" ")

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy python submission (verdict: Runtime Error):
a,b,k = map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
        a -= 1
  
	elif a < 1 and b >= 1:
        b -= 1
	else:
        break
        
print (a,b,end=" ")

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
      a -= 1
  
	elif a < 1 and b >= 1:
      b -= 1
	else:
      break
        
print (a,b,end=" ")

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
	else:
      	break
        
print (a,b,end=" ")

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
	else:
      	break
        
print (a,b,end=" ")

Fixed submission:
s = input().split()
print(s[1] + s[0])

Buggy python submission (verdict: Runtime Error):
a,b,k=map(int,input().split())
 
for a,b in range(k):
	if a >=  1:
    	a -= 1
  
	elif a < 1 and b >= 1:
		b -= 1
        
print (a,b)

Fixed submission:
s = input().split()
print(s[1] + s[0])
Buggy python submission (verdict: Runtime Error):
a = [input() for i in range(2)]
print (6-a[0]-a[1])

Fixed submission:
A = input()
B = input()
print(6-int(A)-int(B))

Buggy python submission (verdict: Runtime Error):
a = [input() for i in range(5)]
print (6-a[0]-a[1])

Fixed submission:
A = input()
B = input()
print(6-int(A)-int(B))

Buggy python submission (verdict: Runtime Error):
A = input()
B = input()
print (6-A-B)

Fixed submission:
A = input()
B = input()
print(6-int(A)-int(B))
Buggy python submission (verdict: Runtime Error):

a,b=list(map(int,input().split()))

from fractions import gcd

res=a*b/math.gcd(a,b)
print(int(res))



Fixed submission:

a,b=list(map(int,input().split()))

from fractions import gcd

res=a*b/gcd(a,b)
print(int(res))

Buggy python submission (verdict: Runtime Error):

a,b=list(map(int,input().split()))

import math

res=a*b/math.gcd(a,b)
print(int(res))



Fixed submission:

a,b=list(map(int,input().split()))

from fractions import gcd

res=a*b/gcd(a,b)
print(int(res))

Buggy python submission (verdict: Runtime Error):

a,b=list(map(int,input().split()))

import math

print(len(a*b/math.gcd(a,b)))

Fixed submission:

a,b=list(map(int,input().split()))

from fractions import gcd

res=a*b/gcd(a,b)
print(int(res))
Buggy python submission (verdict: Runtime Error):
a = input().split()
if a[0]+a[1]+a[2] >= 22:
  print ("bust")
else:
  print("win")

Fixed submission:
a = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
if a[0]+a[1]+a[2] >= 22:
  print ("bust")
else:
  print("win")

Buggy python submission (verdict: Runtime Error):
a = input().split()
if (a[0]+a[1]+a[2]) >= 22:
  print("bust")
else:
  print("win")

Fixed submission:
a = list(map(int, input().split())) #i_1 i_2を取得し、iに値を入れる
if a[0]+a[1]+a[2] >= 22:
  print ("bust")
else:
  print("win")
Buggy python submission (verdict: Runtime Error):
s = input()
if s = "SUN":
  print (7) 
elif s= "MON":
  print (6)
elif s= "TUE":
  print (5)
elif s= "WED":
  print (4)
elif s= "THU":
  print (3)
elif s= "FRI":
  print (2)
else:
  print(1)

Fixed submission:
s = input()
days = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print (days[s])

Buggy python submission (verdict: Runtime Error):
s = input()
if s = "SUN":
  print ("7") 
elif s= "MON":
  print ("6")
elif s= "TUE":
  print ("5")
elif s= "WED":
  print ("4")
elif s= "THU":
  print ("3")
elif s= "FRI":
  print ("2")
else:
  print("1")


Fixed submission:
s = input()
days = {"SUN":7,"MON":6,"TUE":5,"WED":4,"THU":3,"FRI":2,"SAT":1}
print (days[s])
Buggy python submission (verdict: Runtime Error):
a = int(input())
bai = r*r
print(bai)

Fixed submission:
r = int(input()) 
print (r*r)

Buggy python submission (verdict: Runtime Error):
r = input()
bai = r*r/1
print (bai)

Fixed submission:
r = int(input()) 
print (r*r)
Buggy python submission (verdict: Runtime Error):
A, B = int(input().split())
if A >=10 or B >=10:
  print ("-1")
else:
  print (A*B)

Fixed submission:
A, B = list(map(int,input().split()))
if A >=10 or B >=10:
  print ("-1")
else:
  print (A*B)

Buggy python submission (verdict: Runtime Error):
A = int(input())
B = int(input())
if A >=10 or B >=10:
  print ("-1")
else:
  print (A*B)

Fixed submission:
A, B = list(map(int,input().split()))
if A >=10 or B >=10:
  print ("-1")
else:
  print (A*B)
Buggy python submission (verdict: Runtime Error):
A, B = int(input())
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))

Fixed submission:
A, B = list(map(int, input().split())) 
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))

Buggy python submission (verdict: Runtime Error):
A, B = int(input().split())
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))

Fixed submission:
A, B = list(map(int, input().split())) 
if 2*B >= A:
  print(0)
else:
  print(A-(2*B))
Buggy python submission (verdict: Runtime Error):
N = int(input())
if n % 2 == 1:
	print (((n+1)/2) /n)
else:
	print ((n/2)/n)

Fixed submission:
n = int(input())
if n % 2 != 0:
	print (((n+1)/2) /n)
else:
	print ((n/2)/n)

Buggy python submission (verdict: Runtime Error):
N = int(input())
if n % 2 != 0:
	print (((n+1)/2) /n)
else:
  print (2/n)

Fixed submission:
n = int(input())
if n % 2 != 0:
	print (((n+1)/2) /n)
else:
	print ((n/2)/n)
Buggy python submission (verdict: Runtime Error):
n=int(print())
print(n*n*n)

Fixed submission:
n = int(input())
print (n*n*n)
Buggy python submission (verdict: Runtime Error):
a = int(input())
b = int(input())

count = [a+b, a-b, a*b]
print (max(count))

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

c=[a+b, a-b, a*b]
print (max(c))
Buggy python submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print (Even)
else:
    print(Odd)
    

Fixed submission:
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")

Buggy python submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)
    

Fixed submission:
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")

Buggy python submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a,b = list(map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)
    

Fixed submission:
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")

Buggy python submission (verdict: Runtime Error):
#2つの正整数a, bの積の偶奇判定
a = list(map(int,input().split()))

c = a*b
if c % 2 == 0:
    print (Even)
else:
    print(Odd)
    

Fixed submission:
#2つの正整数a, bの積の偶奇判定
a,b = map(int,input().split())

if (a*b) % 2 == 0:
    print ("Even")
else:
    print ("Odd")
Buggy python submission (verdict: Runtime Error):

N = int(input())

t_prev, x_prev, y_prev=0

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) 

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()
    #1個前のループと比較
    elif x_i-x_prev > t_i-t_prev or y_i-y_prev>t_i-t_prev:
        print('No')
        exit()

    t_prev=t_i
    x_prev=x_i
    y_prev=y_i

print("Yes")
    

Fixed submission:

N = int(input())

for i in range(N):
    t_i, x_i, y_i = map(int, input().split()) 

    if (x_i+y_i)> t_i:
        print("No")
        exit()
    elif (x_i+y_i) %2 != t_i%2 :
        print("No")
        exit()

print("Yes")
Buggy python submission (verdict: Runtime Error):
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)+1
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            break()

print(-1, -1, -1)


Fixed submission:
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

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

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)+1
        if (10000*a + 5000*b + 1000*c) == y:
                print(a, b, c)
                break()

print(-1, -1, -1)


Fixed submission:
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Time Limit Exceeded):
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        for c in range(n-(a+b)+1):

            if (10000*a + 5000*b + 1000*(n-(a+b))) == y:
                print(a, b, (n-(a+b)))
                exit()


print(-1, -1, -1)
               

Fixed submission:
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)

Buggy python submission (verdict: Time Limit Exceeded):
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        for c in range(0, n-(a+b)+1):

            if (10000*a + 5000*b + 1000*c) == y and (a+b+c) == n:
                print(a, b, c)
                exit()

a = -1
b = -1
c = -1
print(a, b, c)
               

Fixed submission:
n, y = list(map(int, input().split()))

for a in range(0, n+1):
    for b in range(0, n-a+1):
        c = n-(a+b)
        if (10000*a + 5000*b + 1000*c) == y:
            print(a, b, c)
            exit()

print(-1, -1, -1)
Buggy python submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[1]+a[2]+a[3])

Fixed submission:
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])

Buggy python submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

res = sum(list(map(int(s))))
print (res)


Fixed submission:
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])

Buggy python submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s1,s2,s3 = map(int,input().split())

res = (s1 + s2 + s3)
print (res)


Fixed submission:
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])

Buggy python submission (verdict: Runtime Error):
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s1,s2,s3 = a = map(int,input().split())

res = (s1+s2+s3)
print (res)


Fixed submission:
#1,2,3の番号がついた3マスに，それぞれ"0"か"1"がある．"1"のマスはいくつあるか

s = input()
a = [int(c) for c in s]
print (a[0]+a[1]+a[2])
Buggy python submission (verdict: Time Limit Exceeded):

k, s = list(map(int, input().split()))

count=0

for x in range(0, k+1):
    for y in range(0, k+1):
        for z in range(0, k+1):
            if x+y+z==s:
                count+=1
print(count)


Fixed submission:

k, s = list(map(int, input().split()))

count=0

for x in range(0, k+1):
    for y in range(0, k+1):
      if 0<=s-(x+y)<=k :
          count+=1 

print(count)
Buggy python submission (verdict: Runtime Error):
s = input()

rtn="dream"and "dreamer" and "eraser" and "erase" in s #""内は探したい文字列，戻り値はtrue/false

    if (rtn) == True:
        print(YES)
    else:
        print(NO)

Fixed submission:
s = input()
a = 0
t = ("")

while a < len(s):
    if s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] != ("er"):
        a += 5

    elif s[a+0:a+5] == ("dream") and s[a+5+0:a+5+2] == ("er"):
        if s[a+7+0:a+7+3] != ("ase"):
            a += 7

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] != ("r"):
            a += 10

        elif s[a+7+0:a+7+3] == ("ase") and s[a+10+0:a+10+1] == ("r"):
            a += 11

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] != ("r"):
        a += 5

    elif s[a+0:a+5] == ("erase") and s[a+5+0:a+5+1] == ("r"):
        a += 6

    else:
        break

if a == len(s):
    print("YES")
else:
    print("NO")
Buggy python submission (verdict: Runtime Error):
a,b=map(int,input().split())
if a>80:
    print(-1)
elif a==b:
    if a<=3:
        print(25*a//2)
    else:
        print(-1)
else:
    if -(-25*a//2) <= 10*b and -(-25*a//2) > 9*b:
        print(25*a//2)
    else:
        print(-1)



Fixed submission:
s=input()
print('Yes' if 'A' in s and 'B' in s else 'No')
Buggy python submission (verdict: Runtime Error):
n,m =map(int,input().split())
if n <m:
    print(-1)
else:
    l= [11]*m
    for _ in range(m):
        s,c=map(int,input().split())
        if l[s-1] != str(c) and l[s-1] != 11:
            print(-1)
            exit(0)
        else:
            l[s-1] = str(c)
    for index,i in enumerate(l):
        if i == 11:
            l[index] = '0'
    if n>=2:
        if l[0] == '0' or l[0]==l[1]=='0':
            print(-1)
            exit(0)
    print(''.join(l))


Fixed submission:
n,m =map(int,input().split())
l= [11]*n
for _ in range(m):
    s,c=map(int,input().split())
    if l[s-1] != str(c) and l[s-1] != 11:
        print(-1)
        exit()
    else:
        l[s-1] = str(c)
for index,i in enumerate(l):
    if i == 11:
        if n>1 and (index==0):
            l[index] = '1'
        else:
            l[index] = '0'
if n>=2:
    if l[0] == '0' or l[0]==l[1]=='0':
        print(-1)
        exit()
print(''.join(l))
Buggy python submission (verdict: Runtime Error):
s,t=input().split()
a,b=map(int(),input().split())
u=input()
print(a-1,b if u==s else a,b-1)


Fixed submission:
s,t=input().split()
a,b=map(int,input().split())
u=input()
print(a-1,b) if u==s else print(a,b-1)
Buggy python submission (verdict: Time Limit Exceeded):
a,b,k=map(int,input().split())
for i in range(k):
    if a>0:
        a-=1
    elif b>0:
        b-=1
    else:
        break
print(a,b)

Fixed submission:
a,b,k=map(int,input().split())
print(a-k,b) if a>k else print(0,b-(k-a)) if a+b>k else print(0,0)
Buggy python submission (verdict: Time Limit Exceeded):
l,r=map(int,input().split())
a=2019
for i in range(l,r):
    for j in range(i+1,r+1):
        a=min(i*j%2019,a)
    if a==0:
        break
print(a)


Fixed submission:
l,r=map(int,input().split())
a=2019
if r-l>=2019:
    print(0)
    exit(0)
for i in range(l,r):
    for j in range(i+1,r+1):
        a=min(i*j%2019,a)
print(a)