ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
N = int(input())
h = [int(i) for i in input().split()]
dp = [float("inf")]*N

dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[i], abs(h[i] - h[i-1]))
    if i > 1: dp[i] = min(dp[i], abs(h[i] - h[i-2]))

print(dp[-1])

Failing test case input:
6
3 0 1 45 52 26

Expected output:
65


Actual output:
19


Fixed program (verdict: Accepted):
N = int(input())
h = [int(i) for i in input().split()]
dp = [float("inf")]*N

dp[0] = 0

for i in range(1, N):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    if i > 1: dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[-1])

Diff:
 N = int(input())
 h = [int(i) for i in input().split()]
 dp = [float("inf")]*N
 
 dp[0] = 0
 
 for i in range(1, N):
-    dp[i] = min(dp[i], abs(h[i] - h[i-1]))
-    if i > 1: dp[i] = min(dp[i], abs(h[i] - h[i-2]))
+    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
+    if i > 1: dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))
 
 print(dp[-1])
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
A.sort()
from bisect import bisect_left
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        ans += bisect_left(A, A[i] + A[j]) - bisect_left(A, A[j]) - 1
print(ans)


Failing test case input:
4
8 2 2 1

Expected output:
1


Actual output:
3


Fixed program (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
A.sort()
from bisect import bisect_left, bisect_right
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        ans +=bisect_left(A, A[i] + A[j]) - (j + 1)
print(ans)

Diff:
 N = int(input())
 A = list(map(int, input().split()))
 A.sort()
-from bisect import bisect_left
+from bisect import bisect_left, bisect_right
 ans = 0
 for i in range(N - 1):
     for j in range(i + 1, N):
-        ans += bisect_left(A, A[i] + A[j]) - bisect_left(A, A[j]) - 1
+        ans +=bisect_left(A, A[i] + A[j]) - (j + 1)
 print(ans)
-
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
A = map(int, input().split())

A_list = list(A)
counter = 0
A_list.sort()
A_list.reverse()

if K >= N:
    print(N)
else:
    for val in range(N - K):
        counter += int(A_list[val+K])
    print(counter)

Failing test case input:
8 8
7 9 3 2 3 8 4 6

Expected output:
0


Actual output:
8


Fixed program (verdict: Accepted):
N, K = map(int, input().split())
A = map(int, input().split())

A_list = list(A)
counter = 0
A_list.sort()
A_list.reverse()

if K >= N:
    print(0)
else:
    for val in range(N - K):
        counter += int(A_list[val+K])
    print(counter)

Diff:
 N, K = map(int, input().split())
 A = map(int, input().split())
 
 A_list = list(A)
 counter = 0
 A_list.sort()
 A_list.reverse()
 
 if K >= N:
-    print(N)
+    print(0)
 else:
     for val in range(N - K):
         counter += int(A_list[val+K])
     print(counter)
Buggy program (verdict: Wrong Answer):





import sys


def solve():
    
    max_profit = -1
    min_stock = prices[0]
    for price in prices[1:]:
        max_profit = max(max_profit, price - min_stock)
        min_stock = min(min_stock, price)
    return max_profit


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    p_num = int(_input[0])
    prices = list(map(int, _input[1:]))
    print(solve())

Failing test case input:
3
1
-5
-43

Expected output:
-6


Actual output:
-1


Fixed program (verdict: Accepted):





import sys


def solve():
    
    max_profit = -1 * float('inf')
    min_stock = prices[0]
    for price in prices[1:]:
        max_profit = max(max_profit, price - min_stock)
        min_stock = min(min_stock, price)
    return max_profit


if __name__ == '__main__':
    _input = sys.stdin.readlines()
    p_num = int(_input[0])
    prices = list(map(int, _input[1:]))
    print(solve())

Diff:
 
 
 
 
 
 import sys
 
 
 def solve():
     
-    max_profit = -1
+    max_profit = -1 * float('inf')
     min_stock = prices[0]
     for price in prices[1:]:
         max_profit = max(max_profit, price - min_stock)
         min_stock = min(min_stock, price)
     return max_profit
 
 
 if __name__ == '__main__':
     _input = sys.stdin.readlines()
     p_num = int(_input[0])
     prices = list(map(int, _input[1:]))
     print(solve())
Buggy program (verdict: Wrong Answer):
i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        l = stack.pop()
        r = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)

print (stack[0])

Failing test case input:
1 4 + 5 0 - *

Expected output:
25


Actual output:
-25


Fixed program (verdict: Accepted):
i = [i for i in input().split()]


op = ['+', '*', '-']
stack = []

for j in i:
    if j in op:
        r = stack.pop()
        l = stack.pop()
        stack.append(str(eval(l + j + r)))
    else:
        stack.append(j)
print (stack[0])

Diff:
 i = [i for i in input().split()]
 
 
 op = ['+', '*', '-']
 stack = []
 
 for j in i:
     if j in op:
-        l = stack.pop()
         r = stack.pop()
+        l = stack.pop()
         stack.append(str(eval(l + j + r)))
     else:
         stack.append(j)
-
 print (stack[0])
Buggy program (verdict: Wrong Answer):
N = int(input())
A = [int(e) for e in input().split()]

S = [0]
sum =0
for i in range(0, N):
    S.append(S[i] + A[i])
for i in range(N):
    sum = sum + (S[i+1]-A[i]) * A[i]
print(sum)
 

Failing test case input:
4
141421356 15438004 10545868 176612

Expected output:
309796111


Actual output:
3867047336865440


Fixed program (verdict: Accepted):
N = int(input())
A = [int(e) for e in input().split()]

S = [0]
sum =0
for i in range(0, N):
    S.append(S[i] + A[i])
for i in range(N):
    sum = sum + (S[i+1]-A[i]) * A[i]
print(sum%1000000007)

Diff:
 N = int(input())
 A = [int(e) for e in input().split()]
 
 S = [0]
 sum =0
 for i in range(0, N):
     S.append(S[i] + A[i])
 for i in range(N):
     sum = sum + (S[i+1]-A[i]) * A[i]
-print(sum)
- 
+print(sum%1000000007)
Buggy program (verdict: Wrong Answer):
n=int(input())
ac,wa,tl,re=0,0,0,0
for i in range(n):
  s=input()
  if(s=="AC"):
    ac+=1
  if(s=="WA"):
    wa+=1
  if(s=="TLE"):
    tl+=1
  else:
    re+=1
print("AC",'x',ac)
print("WA",'x',wa)
print("TLE",'x',tl)
print("RE",'x',re)
   

Failing test case input:
10
AC
AC
AC
AC
AC
AC
AC
AC
AC
AC

Expected output:
AC x 10
WA x 0
TLE x 0
RE x 0

Actual output:
AC x 10
WA x 0
TLE x 0
RE x 10


Fixed program (verdict: Accepted):
n=int(input())
ac,wa,tl,re=0,0,0,0
for i in range(n):
  s=input()
  if(s=="AC"):
    ac+=1
  elif(s=="WA"):
    wa+=1
  elif(s=="TLE"):
    tl+=1
  else:
    re+=1
print("AC",'x',ac)
print("WA",'x',wa)
print("TLE",'x',tl)
print("RE",'x',re)
   


Diff:
 n=int(input())
 ac,wa,tl,re=0,0,0,0
 for i in range(n):
   s=input()
   if(s=="AC"):
     ac+=1
-  if(s=="WA"):
+  elif(s=="WA"):
     wa+=1
-  if(s=="TLE"):
+  elif(s=="TLE"):
     tl+=1
   else:
     re+=1
 print("AC",'x',ac)
 print("WA",'x',wa)
 print("TLE",'x',tl)
 print("RE",'x',re)
    
+
Buggy program (verdict: Wrong Answer):


N = int(input())

ron = 10 ** 9 + 7

a = (10 ** N) % ron

b = (9 ** N) % ron

c = (9 ** N) % ron 

bandc = (8 ** N) % ron

ans = a - b - c + bandc

print("{}".format(ans))

Failing test case input:
1889

Expected output:
325108626


Actual output:
-674891381


Fixed program (verdict: Accepted):


N = int(input())

ron = 10 ** 9 + 7

a = (10 ** N) % ron

b = (9 ** N) % ron

c = (9 ** N) % ron 

bandc = (8 ** N) % ron

ans = (a - b - c + bandc) % ron

print("{}".format(ans))

Diff:
 
 
 N = int(input())
 
 ron = 10 ** 9 + 7
 
 a = (10 ** N) % ron
 
 b = (9 ** N) % ron
 
 c = (9 ** N) % ron 
 
 bandc = (8 ** N) % ron
 
-ans = a - b - c + bandc
+ans = (a - b - c + bandc) % ron
 
 print("{}".format(ans))
Buggy program (verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    S=0
    for a in A:
        S+=abs(a)
    print(S)
else:
    X=0
    S=0
    for a in A:
        X+=(a<0)
        S+=abs(a)

    if X%2==0:
        print(S)
    else:
        b=min(A,key=lambda x:abs(x))
        print(S-2*b)

Failing test case input:
5
2 -1 -4 -1 7

Expected output:
13


Actual output:
17


Fixed program (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))

if 0 in A:
    S=0
    for a in A:
        S+=abs(a)
    print(S)
else:
    X=0
    S=0
    for a in A:
        X+=(a<0)
        S+=abs(a)

    if X%2==0:
        print(S)
    else:
        b=abs(min(A,key=lambda x:abs(x)))
        print(S-2*b)

Diff:
 N=int(input())
 A=list(map(int,input().split()))
 
 if 0 in A:
     S=0
     for a in A:
         S+=abs(a)
     print(S)
 else:
     X=0
     S=0
     for a in A:
         X+=(a<0)
         S+=abs(a)
 
     if X%2==0:
         print(S)
     else:
-        b=min(A,key=lambda x:abs(x))
+        b=abs(min(A,key=lambda x:abs(x)))
         print(S-2*b)
Buggy program (verdict: Wrong Answer):
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))
DP = [float("inf")]*N

for i in range(1,min(K,N)):
    DP[i] = abs(h[i]-h[0])

DP[1] = abs(h[1]-h[0])
for i in range(K,N):
    for k in range(1,K+1):
        DP[i] = min(DP[i],DP[i-k]+abs(h[i]-h[i-k]))
print(DP[N-1])

Failing test case input:
5 2
46 10 34 219 155 12 20 15 80 60

Expected output:
133


Actual output:
181


Fixed program (verdict: Accepted):
N,K = list(map(int,input().split()))
h = list(map(int,input().split()))
DP = [float("inf")]*N

for i in range(1,min(K+1,N)):
    DP[i] = abs(h[i]-h[0])

DP[1] = abs(h[1]-h[0])
for i in range(K+1,N):
    for k in range(1,K+1):
        DP[i] = min(DP[i],DP[i-k]+abs(h[i]-h[i-k]))
print(DP[N-1])

Diff:
 N,K = list(map(int,input().split()))
 h = list(map(int,input().split()))
 DP = [float("inf")]*N
 
-for i in range(1,min(K,N)):
+for i in range(1,min(K+1,N)):
     DP[i] = abs(h[i]-h[0])
 
 DP[1] = abs(h[1]-h[0])
-for i in range(K,N):
+for i in range(K+1,N):
     for k in range(1,K+1):
         DP[i] = min(DP[i],DP[i-k]+abs(h[i]-h[i-k]))
 print(DP[N-1])
Buggy program (verdict: Wrong Answer):

while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
    if m + f >= 80:
        print('A')
    if 80 > m + f and m + f >= 65:
        print('B')
    if 65 > m + f and m + f >= 50:
        print('C')
    if 50 > m + f and m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    if 30 >= m + f:
        print('F')

Failing test case input:
20 11 -2
30 30 0
1 -1 -1
-1 -1 -1

Expected output:
D
C
F


Actual output:
D
C
F
F


Fixed program (verdict: Accepted):

while True:
    m,f,r = map(int,input().split())
    if m == -1 and f == -1 and r == -1:
        break
    if m == -1 or f == -1:
        print('F')
        m = -999
    if m + f >= 80:
        print('A')
    if 80 > m + f and m + f >= 65:
        print('B')
    if 65 > m + f and m + f >= 50:
        print('C')
    if 50 > m + f and m + f >= 30:
        if r >= 50:
            print('C')
        else:
            print('D')
    if 30 > m + f >= 0:
        print('F')

Diff:
 
 while True:
     m,f,r = map(int,input().split())
     if m == -1 and f == -1 and r == -1:
         break
     if m == -1 or f == -1:
         print('F')
+        m = -999
     if m + f >= 80:
         print('A')
     if 80 > m + f and m + f >= 65:
         print('B')
     if 65 > m + f and m + f >= 50:
         print('C')
     if 50 > m + f and m + f >= 30:
         if r >= 50:
             print('C')
         else:
             print('D')
-    if 30 >= m + f:
+    if 30 > m + f >= 0:
         print('F')
Buggy program (verdict: Wrong Answer):
s = input().split()
 
if int(s[0]) < int(s[1]):
  s1 = int(s[0])
  s2 = int(s[1])
else:
  s1 = int(s[1])
  s2 = int(s[0])
  
result = 0
if (s2-s1) > 2:
  result = s2*2 - 1
else:
  result = s2 + s1
 
print(result)

Failing test case input:
-11 -13

Expected output:
-23


Actual output:
-24


Fixed program (verdict: Accepted):
s = input().split()
 
if int(s[0]) < int(s[1]):
  s1 = int(s[0])
  s2 = int(s[1])
else:
  s1 = int(s[1])
  s2 = int(s[0])
  
result = 0
if (s2-s1) >= 2:
  result = s2*2 - 1
else:
  result = s2 + s1
 
print(result)


Diff:
 s = input().split()
  
 if int(s[0]) < int(s[1]):
   s1 = int(s[0])
   s2 = int(s[1])
 else:
   s1 = int(s[1])
   s2 = int(s[0])
   
 result = 0
-if (s2-s1) > 2:
+if (s2-s1) >= 2:
   result = s2*2 - 1
 else:
   result = s2 + s1
  
 print(result)
+
Buggy program (verdict: Wrong Answer):
import math
a, b, c = (int(i) for i in input().split()) 
l = []
l.extend([abs(a-b),abs(b-c),abs(c-a)])
l.sort()
ans = l[0] + l[1]


Failing test case input:
110 111 110

Expected output:
1


Actual output:

Fixed program (verdict: Accepted):
import math
a, b, c = (int(i) for i in input().split()) 
l = []
l.extend([abs(a-b),abs(b-c),abs(c-a)])
l.sort()
ans = l[0] + l[1]
print(ans)


Diff:
 import math
 a, b, c = (int(i) for i in input().split()) 
 l = []
 l.extend([abs(a-b),abs(b-c),abs(c-a)])
 l.sort()
 ans = l[0] + l[1]
+print(ans)
Buggy program (verdict: Wrong Answer):
import sys
m,d = input().split()
if m in ('1','3','5','7','8','10','12'):
  if d == '31':
    print('1')
  else:
    print('0')
elif m == '2':
  if d == '28':
    print('1')
  else:
    print('0')
else:
  print('0')


Failing test case input:
9 30
12 1

Expected output:
1


Actual output:
0


Fixed program (verdict: Accepted):
import sys
m,d = input().split()
if m in ('1','3','5','7','8','10','12'):
  if d == '31':
    print('1')
  else:
    print('0')
elif m == '2':
  if d == '28':
    print('1')
  else:
    print('0')
else:
  if d == '30':
    print('1')
  else:
    print('0')


Diff:
 import sys
 m,d = input().split()
 if m in ('1','3','5','7','8','10','12'):
   if d == '31':
     print('1')
   else:
     print('0')
 elif m == '2':
   if d == '28':
     print('1')
   else:
     print('0')
 else:
-  print('0')
+  if d == '30':
+    print('1')
+  else:
+    print('0')
Buggy program (verdict: Wrong Answer):

A,B,C,D = map(int,input().split())
for i in range(1000):
    if i%2 == 1:
        A = A - D
    else:
        C = C - B
    if C < 0:
        if A > C:
            print('No')
            break
        else:
            print('Yes')
            break


Failing test case input:
364 7 0 3

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):

A,B,C,D = map(int,input().split())
for i in range(10000):
    if i%2 == 1:
        A = A - D
    else:
        C = C - B
    if C <= 0 or A <= 0:
        if A > C:
            print('Yes')
            break
        else:
            print('No')
            break


Diff:
 
 A,B,C,D = map(int,input().split())
-for i in range(1000):
+for i in range(10000):
     if i%2 == 1:
         A = A - D
     else:
         C = C - B
-    if C < 0:
+    if C <= 0 or A <= 0:
         if A > C:
-            print('No')
+            print('Yes')
             break
         else:
-            print('Yes')
+            print('No')
             break
Buggy program (verdict: Wrong Answer):
n,x,y=map(int,input().split())
def dis(i,j):
  return min(j-i,abs(j-y)+abs(i-x)+1)-1
ans=[0]*(n-1)
for i in range(0,n-1):
  for j in range(i,n):
    ans[dis(i,j)]+=1
for i in range(len(ans)):
  print(ans[i])

Failing test case input:
68 1 3

Expected output:
68
66
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
2
0


Actual output:
68
67
65
64
63
62
61
60
59
58
57
56
55
54
53
52
51
50
49
48
47
46
45
44
43
42
41
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
20
19
18
17
16
15
14
13
12
11
10
9
8
7
6
5
4
3
1
67


Fixed program (verdict: Accepted):
n,x,y=map(int,input().split())
def dis(i,j):
  return min(j-i,abs(j-y)+abs(i-x)+1)-1
ans=[0]*(n-1)
for i in range(1,n):
  for j in range(i+1,n+1):
    ans[dis(i,j)]+=1
for i in range(len(ans)):
  print(ans[i])


Diff:
 n,x,y=map(int,input().split())
 def dis(i,j):
   return min(j-i,abs(j-y)+abs(i-x)+1)-1
 ans=[0]*(n-1)
-for i in range(0,n-1):
-  for j in range(i,n):
+for i in range(1,n):
+  for j in range(i+1,n+1):
     ans[dis(i,j)]+=1
 for i in range(len(ans)):
   print(ans[i])
+
Buggy program (verdict: Wrong Answer):
list1 = list(map(int, input().split()))
if list1[3] <= list1[0]:
    print(list1[0])
else:
    a = list1[3] - list1[0]
    if a <= list1[1]:
        print(list1[0])
    else:
        b = a - list1[1]
        c = (-1)*b
        print(c)

Failing test case input:
1 2 18 4

Expected output:
0


Actual output:
-1


Fixed program (verdict: Accepted):
list1 = list(map(int, input().split()))
if list1[3] <= list1[0]:
    print(list1[3])
else:
    a = list1[3] - list1[0]
    if a <= list1[1]:
        print(list1[0])
    else:
        b = a - list1[1]
        c = (-1)*b + list1[0]
        print(c)

Diff:
 list1 = list(map(int, input().split()))
 if list1[3] <= list1[0]:
-    print(list1[0])
+    print(list1[3])
 else:
     a = list1[3] - list1[0]
     if a <= list1[1]:
         print(list1[0])
     else:
         b = a - list1[1]
-        c = (-1)*b
+        c = (-1)*b + list1[0]
         print(c)
Buggy program (verdict: Wrong Answer):
a, b = map(int, input().split())
if a < b:
    b = a
print(str(b)*a)

Failing test case input:
1 76

Expected output:
1111111111111111111111111111111111111111111111111111111111111111111111111111


Actual output:
1


Fixed program (verdict: Accepted):
a, b = map(int, input().split())
if a < b:
    b, a = a, b
print(str(b)*a)

Diff:
 a, b = map(int, input().split())
 if a < b:
-    b = a
+    b, a = a, b
 print(str(b)*a)
Buggy program (verdict: Wrong Answer):
n=int(input())
p=1
for i in range(2,int(n**0.5)+1):
  if n%i==0:
    p=i
print(p+n/p-2)

Failing test case input:
1922250

Expected output:
2771


Actual output:
2771.0


Fixed program (verdict: Accepted):
n=int(input())
p=1
for i in range(2,int(n**0.5)+1):
  if n%i==0:
    p=i
print(p+n

Diff:
 n=int(input())
 p=1
 for i in range(2,int(n**0.5)+1):
   if n%i==0:
     p=i
-print(p+n/p-2)
+print(p+n
Buggy program (verdict: Wrong Answer):

N=int(input())
S=list(input())
numlist=range(1000)
ans=0

for i in numlist:
    num=str(i)
    if len(num)==1:
        num="00"+num
    if len(num)==2:
        num="0"+num
    if num[0] in S[:N-1]:
        num1=S.index(num[0])
        if num[1] in S[num1+1:N-1]:
            S2=S[num1+1:N-1]
            num2=S2.index(num[1])+num1+1
            if num[2] in S[num2+1:]:
                ans+=1
                print(i)
print(ans)

Failing test case input:
19
5190480453114530655

Expected output:
260


Actual output:
0
1
3
4
5
6
10
11
13
14
15
16
30
31
33
34
35
36
40
41
43
44
45
46
48
50
51
53
54
55
56
65
80
81
83
84
85
86
100
101
103
104
105
106
108
110
111
113
114
115
116
130
131
133
134
135
136
140
141
143
144
145
146
148
150
151
153
154
155
156
165
180
181
183
184
185
186
190
191
193
194
195
196
198
305
306
310
311
313
314
315
316
330
335
336
340
343
345
346
350
353
355
356
365
400
401
403
404
405
406
410
411
413
414
415
416
430
431
433
434
435
436
440
441
443
444
445
446
450
451
453
454
455
456
465
480
481
483
484
485
486
500
501
503
504
505
506
508
510
511
513
514
515
516
518
519
530
531
533
534
535
536
540
541
543
544
545
546
548
550
551
553
554
555
556
565
580
581
583
584
585
586
590
591
593
594
595
596
598
655
800
801
803
804
805
806
810
811
813
814
815
816
830
831
833
834
835
836
840
841
843
844
845
846
850
851
853
854
855
856
865
900
901
903
904
905
906
908
910
911
913
914
915
916
930
931
933
934
935
936
940
941
943
944
945
946
948
950
951
953
954
955
956
965
980
981
983
984
985
986
260


Fixed program (verdict: Accepted):

N=int(input())
S=list(input())
numlist=range(1000)
ans=0

for i in numlist:
    num=str(i)
    if len(num)==1:
        num="00"+num
    if len(num)==2:
        num="0"+num
    if num[0] in S[:N-1]:
        num1=S.index(num[0])
        if num[1] in S[num1+1:N-1]:
            S2=S[num1+1:N-1]
            num2=S2.index(num[1])+num1+1
            if num[2] in S[num2+1:]:
                ans+=1
print(ans)

Diff:
 
 N=int(input())
 S=list(input())
 numlist=range(1000)
 ans=0
 
 for i in numlist:
     num=str(i)
     if len(num)==1:
         num="00"+num
     if len(num)==2:
         num="0"+num
     if num[0] in S[:N-1]:
         num1=S.index(num[0])
         if num[1] in S[num1+1:N-1]:
             S2=S[num1+1:N-1]
             num2=S2.index(num[1])+num1+1
             if num[2] in S[num2+1:]:
                 ans+=1
-                print(i)
 print(ans)
Buggy program (verdict: Wrong Answer):
N = int(input())

nums = sorted(list(map(int, input().split())))

print(nums)
res = 0
for i in range(N):
    res += nums[3 * N - 2 * (i+1)]

print(res)

Failing test case input:
2
1 4 8 9 1 2

Expected output:
10


Actual output:
[1, 1, 2, 4, 8, 9]
10


Fixed program (verdict: Accepted):
N = int(input())

nums = sorted(list(map(int, input().split())))

res = 0
for i in range(N):
    res += nums[3 * N - 2 * (i+1)]

print(res)  

Diff:
 N = int(input())
 
 nums = sorted(list(map(int, input().split())))
 
-print(nums)
 res = 0
 for i in range(N):
     res += nums[3 * N - 2 * (i+1)]
 
-print(res)
+print(res)
Buggy program (verdict: Wrong Answer):
n = 0
list = []
while n < 10:
    x = input()
    list.append(x)
    n += 1

list.sort()
print(list[9])
print(list[8])
print(list[7])

Failing test case input:
1819
2003
1094
2489
1142
492
4419
4289
2834
1724

Expected output:
4419
4289
2834


Actual output:
492
4419
4289


Fixed program (verdict: Accepted):
n = 0
list = []
while n < 10:
    x = int(input())
    list.append(x)
    n += 1

list.sort()
print(list[9])
print(list[8])
print(list[7])

Diff:
 n = 0
 list = []
 while n < 10:
-    x = input()
+    x = int(input())
     list.append(x)
     n += 1
 
 list.sort()
 print(list[9])
 print(list[8])
 print(list[7])
Buggy program (verdict: Wrong Answer):
k=int(input())
a,b=map(int,input().split())
c=b-a
if(c>=k-1):
    print("OK")
elif(a%k+c>=k):
    print("OK")
else:
    print("NG")


Failing test case input:
4
8 9

Expected output:
OK


Actual output:
NG


Fixed program (verdict: Accepted):
k=int(input())
a,b=map(int,input().split())
c=b-a
if(a%k+c>=k)or(a%k==0):
    print("OK")
else:
    print("NG")


Diff:
 k=int(input())
 a,b=map(int,input().split())
 c=b-a
-if(c>=k-1):
-    print("OK")
-elif(a%k+c>=k):
+if(a%k+c>=k)or(a%k==0):
     print("OK")
 else:
     print("NG")
Buggy program (verdict: Wrong Answer):
A, B, C = map(int, input().split())
if A*B*C == 5*5*7:
  print("YEAS")
else:
  print("NO")

Failing test case input:
5 5 7

Expected output:
YES

Actual output:
YEAS


Fixed program (verdict: Accepted):
A, B, C = map(int, input().split())
if A*B*C == 5*5*7:
  print("YES")
else:
  print("NO")

Diff:
 A, B, C = map(int, input().split())
 if A*B*C == 5*5*7:
-  print("YEAS")
+  print("YES")
 else:
   print("NO")
Buggy program (verdict: Wrong Answer):
n=int(input())
ans=0
for i in range(n):
    if i%3==0 or i%5==0:
        i=0
    ans +=i
print(ans)

Failing test case input:
1110001

Expected output:
328561110001


Actual output:
328560000000


Fixed program (verdict: Accepted):
n=int(input())
ans=0
for i in range(n+1):
    if i%3==0 or i%5==0:
        i=0
    ans +=i
print(ans)

Diff:
 n=int(input())
 ans=0
-for i in range(n):
+for i in range(n+1):
     if i%3==0 or i%5==0:
         i=0
     ans +=i
 print(ans)
Buggy program (verdict: Wrong Answer):
N = int(input())
R = int(input())

max = 0
maxcounter = 0
j = 1

for i in range(N):
  
  
  if j * 2 <= j + R:
    j = j * 2
    
  else:
    j = j + R
 

Failing test case input:
10
10

Expected output:
76

Actual output:

Fixed program (verdict: Accepted):
N = int(input())
R = int(input())

max = 0
maxcounter = 0
j = 1

for i in range(N):
  
  
  if j * 2 <= j + R:
    j = j * 2
    
  else:
    j = j + R
 
print(j)

Diff:
 N = int(input())
 R = int(input())
 
 max = 0
 maxcounter = 0
 j = 1
 
 for i in range(N):
   
   
   if j * 2 <= j + R:
     j = j * 2
     
   else:
     j = j + R
  
+print(j)
Buggy program (verdict: Wrong Answer):
price, num = input().split(" ")
dislike = input().split(" ")
for i in range(int(price), 10001):
    if set(dislike) & set(str(i)):
        continue
    else:
        print(i)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2000
2002
2020
2022
2200
2202
2220
2222


Fixed program (verdict: Accepted):
price, num = input().split(" ")
dislike = input().split(" ")
for i in range(int(price), 100000):
    if set(dislike) & set(str(i)):
        continue
    else:
        print(i)
        break

Diff:
 price, num = input().split(" ")
 dislike = input().split(" ")
-for i in range(int(price), 10001):
+for i in range(int(price), 100000):
     if set(dislike) & set(str(i)):
         continue
     else:
         print(i)
+        break
Buggy program (verdict: Wrong Answer):
S = input()
for i in  range(1,len(S)):
    if S[i-1] == S[i]:
        print('Bad')
    else:
        print('Good')

Failing test case input:
7702

Expected output:
Bad


Actual output:
Bad
Good
Good


Fixed program (verdict: Accepted):
S = input()
for i in  range(1,len(S)):
    if S[i-1] == S[i]:
        print('Bad')
        exit()
print('Good')

Diff:
 S = input()
 for i in  range(1,len(S)):
     if S[i-1] == S[i]:
         print('Bad')
-    else:
-        print('Good')
+        exit()
+print('Good')
Buggy program (verdict: Wrong Answer):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
print(max(diff))

Failing test case input:
4
-2 90 1 1
2 2 -2 -1

Expected output:
93


Actual output:
88


Fixed program (verdict: Accepted):
N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))

diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
print(sum(diff))

Diff:
 N = int(input())
 V = list(map(int, input().split()))
 C = list(map(int, input().split()))
 
 diff = [v-c if (v-c > 0) else 0 for v, c in zip(V, C)]
-print(max(diff))
+print(sum(diff))
Buggy program (verdict: Wrong Answer):
n, k = map(int, input().split())
s = list(map(int, input().split()))
if k > len(s):
    k = len(s)
s = s[::-1]
print(sum(s[k:]))

Failing test case input:
8 1
4 9 9 2 3 4 5 6

Expected output:
33


Actual output:
36


Fixed program (verdict: Accepted):
n, k = map(int, input().split())
s = list(map(int, input().split()))
if k > len(s):
    k = len(s)
s = sorted(s, reverse=True)

print(sum(s[k:]))


Diff:
 n, k = map(int, input().split())
 s = list(map(int, input().split()))
 if k > len(s):
     k = len(s)
-s = s[::-1]
+s = sorted(s, reverse=True)
+
 print(sum(s[k:]))
+
Buggy program (verdict: Wrong Answer):
a,b = map(int,input().split())
if (a+b)%2 == 1:
  print("Yes")
else:
  print("No")

Failing test case input:
5 -3

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
a,b = map(int,input().split())
if (a*b)%2 == 1:
  print("Yes")
else:
  print("No")

Diff:
 a,b = map(int,input().split())
-if (a+b)%2 == 1:
+if (a*b)%2 == 1:
   print("Yes")
 else:
   print("No")
Buggy program (verdict: Wrong Answer):
N = int(input())
maxA = 0
secondMaxA = 0
maxIndex = -1
for i in range(N):
  A = int(input())
  if A >= maxA:
    secondMaxA = maxA
    maxA = A
    maxIndex = 1
  elif A >= secondMaxA:
    secondMaxA = A

for i in range(N):
  if i == maxIndex:
    print(secondMaxA)
  else:
    print(maxA)

Failing test case input:
3
0
5
8

Expected output:
8
8
5


Actual output:
8
5
8


Fixed program (verdict: Accepted):
N = int(input())
maxA = 0
secondMaxA = 0
maxIndex = -1
for i in range(N):
  A = int(input())
  if A >= maxA:
    secondMaxA = maxA
    maxA = A
    maxIndex = i
  elif A >= secondMaxA:
    secondMaxA = A

for i in range(N):
  if i == maxIndex:
    print(secondMaxA)
  else:
    print(maxA)

Diff:
 N = int(input())
 maxA = 0
 secondMaxA = 0
 maxIndex = -1
 for i in range(N):
   A = int(input())
   if A >= maxA:
     secondMaxA = maxA
     maxA = A
-    maxIndex = 1
+    maxIndex = i
   elif A >= secondMaxA:
     secondMaxA = A
 
 for i in range(N):
   if i == maxIndex:
     print(secondMaxA)
   else:
     print(maxA)
Buggy program (verdict: Wrong Answer):
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for _ in range(M)]

A = []
B = [0]*N
for a,b in ab:
  if a==1:
    A.append(a)
  if b==N:
    B[a]=1

for a in A:
  if B[a]==1:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Failing test case input:
4 3
1 4
2 3
3 4

Expected output:
IMPOSSIBLE


Actual output:
POSSIBLE


Fixed program (verdict: Accepted):
N,M = map(int,input().split())
ab = [[int(i) for i in input().split()] for _ in range(M)]

A = []
B = [0]*(N+1)
for a,b in ab:
  if a==1:
    A.append(b)
  if b==N:
    B[a]=1

for a in A:
  if B[a]==1:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")

Diff:
 N,M = map(int,input().split())
 ab = [[int(i) for i in input().split()] for _ in range(M)]
 
 A = []
-B = [0]*N
+B = [0]*(N+1)
 for a,b in ab:
   if a==1:
-    A.append(a)
+    A.append(b)
   if b==N:
     B[a]=1
 
 for a in A:
   if B[a]==1:
     print("POSSIBLE")
     break
 else:
   print("IMPOSSIBLE")
Buggy program (verdict: Wrong Answer):
x = int(input())

def score(x):

 if  400 <= x :
        print("8")
 elif 600 <= x :
        print("7")
 elif 899 <= x :
        print("6")
 elif 1000 <= x :
        print("5")
 elif 1200 <= x :
        print("4")
 elif 1400 <= x :
        print("3")
 elif 1600 <= x :
        print("2")
 elif 1800 <= x <= 1999:
        print("1")
        
print(score(x))



Failing test case input:
482

Expected output:
8


Actual output:
8
None


Fixed program (verdict: Accepted):
x = int(input())

def score(x):
 if  400 <= x <= 599:
        print("8")
 elif 600 <= x <= 799:
        print("7")
 elif 800 <= x <= 999:
        print("6")
 elif 1000 <= x <= 1199:
        print("5")
 elif 1200 <= x <= 1399:
        print("4")
 elif 1400 <= x <= 1599:
        print("3")
 elif 1600 <= x <= 1799:
        print("2")
 elif 1800 <= x <= 1999:
        print("1")

score(x)

Diff:
 x = int(input())
 
 def score(x):
-
- if  400 <= x :
+ if  400 <= x <= 599:
         print("8")
- elif 600 <= x :
+ elif 600 <= x <= 799:
         print("7")
- elif 899 <= x :
+ elif 800 <= x <= 999:
         print("6")
- elif 1000 <= x :
+ elif 1000 <= x <= 1199:
         print("5")
- elif 1200 <= x :
+ elif 1200 <= x <= 1399:
         print("4")
- elif 1400 <= x :
+ elif 1400 <= x <= 1599:
         print("3")
- elif 1600 <= x :
+ elif 1600 <= x <= 1799:
         print("2")
  elif 1800 <= x <= 1999:
         print("1")
-        
-print(score(x))
-
 
+score(x)
Buggy program (verdict: Wrong Answer):
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 or int(p[i]) < int(B):
        cntC += 1

print(min(cntA,cntB,cntC))


Failing test case input:
7
7 22
-3 0 82 2 2 3 5

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
N = int(input())
A,B = map(int,input().split())
p = list(map(int,input().split()))
cntA = 0
cntB = 0
cntC = 0

for i in range(N):
    if int(p[i]) <= int(A):
        cntA += 1
    if int(p[i]) >= int(B)+1:
        cntB += 1
    if int(p[i]) >= int(A)+1 and int(p[i]) <= int(B):
        cntC += 1

print(min(cntA,cntB,cntC))


Diff:
 N = int(input())
 A,B = map(int,input().split())
 p = list(map(int,input().split()))
 cntA = 0
 cntB = 0
 cntC = 0
 
 for i in range(N):
     if int(p[i]) <= int(A):
         cntA += 1
     if int(p[i]) >= int(B)+1:
         cntB += 1
-    if int(p[i]) >= int(A)+1 or int(p[i]) < int(B):
+    if int(p[i]) >= int(A)+1 and int(p[i]) <= int(B):
         cntC += 1
 
 print(min(cntA,cntB,cntC))
Buggy program (verdict: Wrong Answer):
a,b,c,d=map(int,input().split())

if c-b>=0 or a-d>=0:
  print(0)
elif (c-a>=0 and b-d>=0):
  print(d-c)
elif (a-c>=0 and d--b>=0):
  print(b-a)
elif c-a>=0:
  print(b-c)
elif a-c>=0:
  print(d-a)


Failing test case input:
1 6 -1 4

Expected output:
3


Actual output:
5


Fixed program (verdict: Accepted):
a,b,c,d=map(int,input().split())

if c-b>=0 or a-d>=0:
  print(0)
elif (c-a>=0 and b-d>=0):
  print(d-c)
elif (a-c>=0 and d-b>=0):
  print(b-a)
elif c-a>=0:
  print(b-c)
elif a-c>=0:
  print(d-a)

Diff:
 a,b,c,d=map(int,input().split())
 
 if c-b>=0 or a-d>=0:
   print(0)
 elif (c-a>=0 and b-d>=0):
   print(d-c)
-elif (a-c>=0 and d--b>=0):
+elif (a-c>=0 and d-b>=0):
   print(b-a)
 elif c-a>=0:
   print(b-c)
 elif a-c>=0:
   print(d-a)
-
Buggy program (verdict: Wrong Answer):
nums = list(map(int,input().split()))
money_sum = 500 * nums[0]
if nums[1]  < money_sum:
    print("No")
else:
    print("Yes")

Failing test case input:
12 85

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
nums = list(map(int,input().split()))
money_sum = 500 * nums[0]
if nums[1]  > money_sum:
    print("No")
else:
    print("Yes")

Diff:
 nums = list(map(int,input().split()))
 money_sum = 500 * nums[0]
-if nums[1]  < money_sum:
+if nums[1]  > money_sum:
     print("No")
 else:
     print("Yes")
Buggy program (verdict: Wrong Answer):
s = input()

if s[0] == 'A' and s[2:-1].count('C') == 1:
  for letter in s[1:]:
    if letter != letter.lower() or letter == 'C':
      print('WA')
      break
  else:
    print('AC')
else:
  print('AC')


Failing test case input:
fqCBdr

Expected output:
WA


Actual output:
AC


Fixed program (verdict: Accepted):
s = input()

if s[0] == 'A' and s[2:-1].count('C') == 1:
  for letter in s[1:]:
    if letter != letter.lower() and letter != 'C':
      print('WA')
      break
  else:
    print('AC')
else:
  print('WA')


Diff:
 s = input()
 
 if s[0] == 'A' and s[2:-1].count('C') == 1:
   for letter in s[1:]:
-    if letter != letter.lower() or letter == 'C':
+    if letter != letter.lower() and letter != 'C':
       print('WA')
       break
   else:
     print('AC')
 else:
-  print('AC')
+  print('WA')
Buggy program (verdict: Wrong Answer):
a, b = map(int, input().split())
c, d = map(int, input().split())
if(a != b):
  print(1)
else:
  print(0)

Failing test case input:
11 14
11 56

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
a, b = map(int, input().split())
c, d = map(int, input().split())
if(a != c):
  print(1)
else:
  print(0)


Diff:
 a, b = map(int, input().split())
 c, d = map(int, input().split())
-if(a != b):
+if(a != c):
   print(1)
 else:
   print(0)
+
Buggy program (verdict: Wrong Answer):
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if not i%5 != 0:
    ans = "DENIED"
    pass
  if not i%3 != 0:
    ans = "DENIED"
    pass
print(ans)


Failing test case input:
5
1 1 4 5 31

Expected output:
DENIED


Actual output:
APPROVED


Fixed program (verdict: Accepted):
n = int(input())
s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
ans = "APPROVED"
for i in s:
  if i%5 != 0 and i%3 != 0:
    ans = "DENIED"
    pass
print(ans)

Diff:
 n = int(input())
 s = [int(x) for x in list(input().split()) if int(x)%2 == 0]
 ans = "APPROVED"
 for i in s:
-  if not i%5 != 0:
-    ans = "DENIED"
-    pass
-  if not i%3 != 0:
+  if i%5 != 0 and i%3 != 0:
     ans = "DENIED"
     pass
 print(ans)
-
Buggy program (verdict: Wrong Answer):
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
print(sorted(rest))
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Failing test case input:
10
yakuusk 18
kyastul 53
yskutak 76
k`kutsy -1
yakvtsk 5
kstkvay 60
yajutsk 70
yakksut 18
kstukay 160
yakutsk 110

Expected output:
4
6
9
2
7
8
10
1
5
3


Actual output:
['k`kutsy', 'kstkvay', 'kstukay', 'kyastul', 'yajutsk', 'yakksut', 'yakutsk', 'yakuusk', 'yakvtsk', 'yskutak']
1
2
3
4
5
6
7
8
9
10


Fixed program (verdict: Accepted):
N = int(input())
rest = {}
cities = []
for i in range(N):
    k,s = input().split()
    if k not in rest:
        rest[k] = []
        cities.append(k)
    rest[k].append([int(s),i+1])
cities.sort()
for k in cities:
    rest[k].sort(reverse = True)
    for i in rest[k]:
        print(i[1])

Diff:
 N = int(input())
 rest = {}
 cities = []
 for i in range(N):
     k,s = input().split()
     if k not in rest:
         rest[k] = []
         cities.append(k)
     rest[k].append([int(s),i+1])
-print(sorted(rest))
+cities.sort()
 for k in cities:
     rest[k].sort(reverse = True)
     for i in rest[k]:
         print(i[1])
Buggy program (verdict: Wrong Answer):
n, m = map(int, input().split())

time = 100 * (n - m) + 19000 * m
ans = time * 2**m
print(ans)

Failing test case input:
000 2

Expected output:
14400


Actual output:
151200


Fixed program (verdict: Accepted):
n, m = map(int, input().split())

time = 100 * (n - m) + 1900 * m
ans = time * 2**m
print(ans)

Diff:
 n, m = map(int, input().split())
 
-time = 100 * (n - m) + 19000 * m
+time = 100 * (n - m) + 1900 * m
 ans = time * 2**m
 print(ans)
Buggy program (verdict: Wrong Answer):
a = int(input())
x = []
for i in range(a - 1):
    if (i + 1) % 3 == 0:
        if (i + 1) % 5 == 0:
            continue
        else:
            continue
    elif (i + 1) % 5 == 0:
        continue
    else:
        x.append(i + 1)
print(sum(x))

Failing test case input:
1110001

Expected output:
328561110001


Actual output:
328560000000


Fixed program (verdict: Accepted):
a = int(input())
x = []
for i in range(a):
    if (i + 1) % 3 == 0:
        if (i + 1) % 5 == 0:
            continue
        else:
            continue
    elif (i + 1) % 5 == 0:
        continue
    else:
        x.append(i + 1)
print(sum(x))

Diff:
 a = int(input())
 x = []
-for i in range(a - 1):
+for i in range(a):
     if (i + 1) % 3 == 0:
         if (i + 1) % 5 == 0:
             continue
         else:
             continue
     elif (i + 1) % 5 == 0:
         continue
     else:
         x.append(i + 1)
 print(sum(x))
Buggy program (verdict: Wrong Answer):
A, B, C = input().split()
MC = [A, B, C]
if MC.count("5")==2:
  print("Yes")
else:
  print("No")

Failing test case input:
2 1 1

Expected output:
NO


Actual output:
No


Fixed program (verdict: Accepted):
A, B, C = map(int, input().split())
MC = [A, B, C]
if MC.count(5)==2 and MC.count(7)==1:
  print("YES")
else:
  print("NO")

Diff:
-A, B, C = input().split()
+A, B, C = map(int, input().split())
 MC = [A, B, C]
-if MC.count("5")==2:
-  print("Yes")
+if MC.count(5)==2 and MC.count(7)==1:
+  print("YES")
 else:
-  print("No")
+  print("NO")
Buggy program (verdict: Wrong Answer):
s=list(input())
t=list(input())
ss=len(set(s))

l=[]
for i,j in zip(s,t):
    l.append(i+j)

if len(set(l)) == ss:
    print("Yes")
else:
    print("No")


Failing test case input:
abcdefghijklmnopqrstuvwxyz
ibyhqfrekavclykstdwgpznonu

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
s=list(input())
t=list(input())
ss=len(set(s))
tt=len(set(t))

l=[]
for i,j in zip(s,t):
    l.append(i+j)

if len(set(l)) == ss == tt:
    print("Yes")
else:
    print("No")


Diff:
 s=list(input())
 t=list(input())
 ss=len(set(s))
+tt=len(set(t))
 
 l=[]
 for i,j in zip(s,t):
     l.append(i+j)
 
-if len(set(l)) == ss:
+if len(set(l)) == ss == tt:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
h = list(map(int, input().split()))
a = 0
for i in range(2):
  if h[i] << 4:
    a = a + 100000 * (4-h[i])
if h[0] == 1 and h[1] == 1:
  a = a + 400000
print(a)
    

Failing test case input:
17 10

Expected output:
0


Actual output:
-1900000


Fixed program (verdict: Accepted):
h = list(map(int, input().split()))
a = 0
for i in range(2):
  if h[i] <= 3:
    a = a + 100000 * (4-h[i])
if h[0] == 1 and h[1] == 1:
  a = a + 400000
print(a)
    

Diff:
 h = list(map(int, input().split()))
 a = 0
 for i in range(2):
-  if h[i] << 4:
+  if h[i] <= 3:
     a = a + 100000 * (4-h[i])
 if h[0] == 1 and h[1] == 1:
   a = a + 400000
 print(a)
Buggy program (verdict: Wrong Answer):
s=input()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
    cnt=0
    for i in words:
        length=len(i)
        word=s[add:add+length][::-1]
        if word==i:
            add +=length
            break
        else:cnt +=1
    if cnt==4:print("No");exit()
print("Yes")

Failing test case input:
mqefrte`d

Expected output:
NO


Actual output:
No


Fixed program (verdict: Accepted):
s=input()[::-1]
words=["dreamer","eraser","dream","erase"]
add=0
while add!=len(s):
    cnt=0
    for i in words:
        length=len(i)
        word=s[add:add+length][::-1]
        if word==i:
            add +=length
            break
        else:cnt +=1
    if cnt==4:print("NO");exit()
print("YES")

Diff:
 s=input()[::-1]
 words=["dreamer","eraser","dream","erase"]
 add=0
 while add!=len(s):
     cnt=0
     for i in words:
         length=len(i)
         word=s[add:add+length][::-1]
         if word==i:
             add +=length
             break
         else:cnt +=1
-    if cnt==4:print("No");exit()
-print("Yes")
+    if cnt==4:print("NO");exit()
+print("YES")

Buggy program (verdict: Wrong Answer):
S = input()
s = S.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s == "":
    print("Yes")
else:
    print("No")

Failing test case input:
mfeeqdq`at

Expected output:
NO


Actual output:
No


Fixed program (verdict: Accepted):
S = input()
s = S.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s == "":
    print("YES")
else:
    print("NO")

Diff:
 S = input()
 s = S.replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
 if s == "":
-    print("Yes")
+    print("YES")
 else:
-    print("No")
+    print("NO")
Buggy program (verdict: Wrong Answer):
H,A=map(int,input().split())
count = 0
while H >= 0:
  count+=1
  H -= A
print(count)

Failing test case input:
11001 3

Expected output:
3667


Actual output:
3668


Fixed program (verdict: Accepted):
H,A=map(int,input().split())
count = 0
while H > 0:
  count+=1
  H -= A
print(count)

Diff:
 H,A=map(int,input().split())
 count = 0
-while H >= 0:
+while H > 0:
   count+=1
   H -= A
 print(count)
Buggy program (verdict: Wrong Answer):
n,p=map(int,input().split())
for i in range(10000):
  if p**i<=n<p**(i+1):
    print(i-1)
    exit()

Failing test case input:
89316102 4

Expected output:
14


Actual output:
12


Fixed program (verdict: Accepted):
n,p=map(int,input().split())
for i in range(10000):
  if p**i<=n<p**(i+1):
    print(i+1)
    exit()


Diff:
 n,p=map(int,input().split())
 for i in range(10000):
   if p**i<=n<p**(i+1):
-    print(i-1)
+    print(i+1)
     exit()
+
Buggy program (verdict: Wrong Answer):
s = input()
a,b = list(map(lambda x: int(x), s.split(" ")))
print(a)
print(b)
if a % 2 == 0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")



Failing test case input:
15 0

Expected output:
Even


Actual output:
15
0
Even


Fixed program (verdict: Accepted):
s = input()
a,b = list(map(lambda x: int(x), s.split(" ")))
if a % 2 == 0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")



Diff:
 s = input()
 a,b = list(map(lambda x: int(x), s.split(" ")))
-print(a)
-print(b)
 if a % 2 == 0 or b % 2 == 0:
     print("Even")
 else:
     print("Odd")
Buggy program (verdict: Wrong Answer):
N,X,Y = map(int,input().split())
ans = [0 for i in range(N-1)]
for i in range(1,N):
    for j in range(i+1,N+1):
        mina = min(j-i, abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-i))
        ans[mina-1] += 1
for i in ans:
    print(i)

Failing test case input:
12 4 6

Expected output:
12
11
10
9
7
6
5
3
2
1
0


Actual output:
12
11
21
6
7
2
4
1
2
0
0


Fixed program (verdict: Accepted):
N,X,Y = map(int,input().split())
ans = [0 for i in range(N-1)]
for i in range(1,N):
    for j in range(i+1,N+1):
        mina = min(j-i, abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j))
        ans[mina-1] += 1
for i in ans:
    print(i)

Diff:
 N,X,Y = map(int,input().split())
 ans = [0 for i in range(N-1)]
 for i in range(1,N):
     for j in range(i+1,N+1):
-        mina = min(j-i, abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-i))
+        mina = min(j-i, abs(X-i)+1+abs(Y-j), abs(Y-i)+1+abs(X-j))
         ans[mina-1] += 1
 for i in ans:
     print(i)
Buggy program (verdict: Wrong Answer):
import math
n = int(input())
num = [int(input()) for i in range(5)]
if min(num)>=n:
    print(5)

print(4+math.ceil(n/min(num)))

Failing test case input:
10
127
130
27
123
123

Expected output:
5


Actual output:
5
5


Fixed program (verdict: Accepted):
import math
n = int(input())
num = [int(input()) for i in range(5)]
print(4+math.ceil(n/min(num)))

Diff:
 import math
 n = int(input())
 num = [int(input()) for i in range(5)]
-if min(num)>=n:
-    print(5)
-
 print(4+math.ceil(n/min(num)))
Buggy program (verdict: Wrong Answer):
N, T = map(int, input().split())
List = []
List2 = []
min = 1000

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List[n][0]

print(min)

Failing test case input:
-5 0
-1 0100
1 1
4 1100
6 45

Expected output:
TLE


Actual output:
1000


Fixed program (verdict: Accepted):
N, T = map(int, input().split())
List = []
List2 = []
min = 1001

for i in range(N):
    M, B = map(int, input().split())
    List.append([M,B])
    M, B = 0, 0

for k in range(N):
    if int(List[k][1]) <= T:
        List2.append(List[k])

for n in range(len(List2)):
    if List2[n][0] <= min:
        min = List2[n][0]

if min == 1001:
    print('TLE')
else:
    print(min)


Diff:
 N, T = map(int, input().split())
 List = []
 List2 = []
-min = 1000
+min = 1001
 
 for i in range(N):
     M, B = map(int, input().split())
     List.append([M,B])
     M, B = 0, 0
 
 for k in range(N):
     if int(List[k][1]) <= T:
         List2.append(List[k])
 
 for n in range(len(List2)):
     if List2[n][0] <= min:
-        min = List[n][0]
+        min = List2[n][0]
+
+if min == 1001:
+    print('TLE')
+else:
+    print(min)
 
-print(min)
Buggy program (verdict: Wrong Answer):
N, M = map(int, input().split())
if N >= M:
  print(0)
  exit()

X = [int(x) for x in input().split()]

X = sorted(X)
L = [ X[i] - X[i-1] for i in range(1, M)]
L = sorted(L)



print(sum(L[:-(N-1)]))

Failing test case input:
1 7
-8 -1 0 9 -100 2 17

Expected output:
117


Actual output:
0


Fixed program (verdict: Accepted):
N, M = map(int, input().split())
if N >= M:
  print(0)
  exit()

X = [int(x) for x in input().split()]

X = sorted(X)
L = [ X[i] - X[i-1] for i in range(1, M)]
L = sorted(L)



print(sum(L[:M-N]))

Diff:
 N, M = map(int, input().split())
 if N >= M:
   print(0)
   exit()
 
 X = [int(x) for x in input().split()]
 
 X = sorted(X)
 L = [ X[i] - X[i-1] for i in range(1, M)]
 L = sorted(L)
 
 
 
-print(sum(L[:-(N-1)]))
+print(sum(L[:M-N]))
Buggy program (verdict: Wrong Answer):
length = int(input())
mochi = [int(input()) for i in range(length)]
sorted_mochi = sorted(mochi,reverse=True)
stage = 0
for i in range(0,length-1):
  if sorted_mochi[i] > sorted_mochi[i+1]:
    stage +=1
  else:
    pass
print(stage)

Failing test case input:
7
50
30
50
100
50
80
59

Expected output:
5


Actual output:
4


Fixed program (verdict: Accepted):
length = int(input())
mochi = [int(input()) for i in range(length)]
sorted_mochi = sorted(mochi,reverse=True)
stage = 1
for i in range(0,length-1):
  if sorted_mochi[i] > sorted_mochi[i+1]:
    stage +=1
  else:
    pass
print(stage)

Diff:
 length = int(input())
 mochi = [int(input()) for i in range(length)]
 sorted_mochi = sorted(mochi,reverse=True)
-stage = 0
+stage = 1
 for i in range(0,length-1):
   if sorted_mochi[i] > sorted_mochi[i+1]:
     stage +=1
   else:
     pass
 print(stage)
Buggy program (verdict: Wrong Answer):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):
    print(s[:i]+s[i+l:])
    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')

Failing test case input:
slpt}n{exb

Expected output:
NO


Actual output:
t}n{exb
s}n{exb
sln{exb
slp{exb
slptexb
slpt}xb
slpt}nb
NO


Fixed program (verdict: Accepted):
import sys
s=input()
l=len(s)-7
if l<0:
    print('NO')
    sys.exit()
for i in range(7):

    if s[:i]+s[i+l:]=='keyence':
        print('YES')
        sys.exit()
if s[:7]=='keyence':
    print('YES')
else:
    print('NO')

Diff:
 import sys
 s=input()
 l=len(s)-7
 if l<0:
     print('NO')
     sys.exit()
 for i in range(7):
-    print(s[:i]+s[i+l:])
+
     if s[:i]+s[i+l:]=='keyence':
         print('YES')
         sys.exit()
 if s[:7]=='keyence':
     print('YES')
 else:
     print('NO')