ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
S = list(input())

if "S" in S:
    if S[1] == "S" and (S[0] != "S" or S[2] != "S"):
        print(1)
    elif S[0] == "S" and S[1] == "S" and S[2] == "S":
        print(0)
    elif S[1] == "R" and (S[0] != "R" or S[2] != "R"):
        print(1)
    else:
        print(2)
else:
    print(3)

Failing test case input:
SRR

Expected output:
2


Actual output:
1


Fixed program (verdict: Accepted):
S = list(input())

if "S" in S:
    if S[1] == "S" and (S[0] != "S" or S[2] != "S"):
        print(1)
    elif S[0] == "S" and S[1] == "S" and S[2] == "S":
        print(0)
    elif S[1] == "R" and S[0] != "R" and S[2] != "R":
        print(1)
    else:
        print(2)
else:
    print(3)

Diff:
 S = list(input())
 
 if "S" in S:
     if S[1] == "S" and (S[0] != "S" or S[2] != "S"):
         print(1)
     elif S[0] == "S" and S[1] == "S" and S[2] == "S":
         print(0)
-    elif S[1] == "R" and (S[0] != "R" or S[2] != "R"):
+    elif S[1] == "R" and S[0] != "R" and S[2] != "R":
         print(1)
     else:
         print(2)
 else:
     print(3)
Buggy program (verdict: Wrong Answer):
a,b,k = map(int,input().split())
if b-a <= 2 * k:
    for h in range(b-a+1):
        print(a + h)
else:
    for i in range(k):
        print(a + i)
    for m in range(k):
        print((b-k)+1+m)

Failing test case input:
2 4 001

Expected output:
2
4


Actual output:
2
3
4


Fixed program (verdict: Accepted):
a,b,k = map(int,input().split())
if b-a < 2 * k:
    for h in range(b-a+1):
        print(a + h)
else:
    for i in range(k):
        print(a + i)
    for m in range(k):
        print((b-k)+1+m)

Diff:
 a,b,k = map(int,input().split())
-if b-a <= 2 * k:
+if b-a < 2 * k:
     for h in range(b-a+1):
         print(a + h)
 else:
     for i in range(k):
         print(a + i)
     for m in range(k):
         print((b-k)+1+m)
Buggy program (verdict: Wrong Answer):
import re

s = input()
ptn = re.compile(r'maerd|remaerd|sare|resare')
tmp = s[::-1]

while(True):
  res = re.match(ptn , tmp)
  if res is None:
    print(tmp)
    break
  tmp = tmp.replace(res.group(),'',1)
  print(tmp)

if len(tmp) == 0:
  print('YES')
else:
  print('NO')

Failing test case input:
brr`lgdrccq

Expected output:
NO


Actual output:
qccrdgl`rrb
NO


Fixed program (verdict: Accepted):
import re

s = input()
ptn = re.compile(r'maerd|remaerd|resare|esare')
tmp = s[::-1]

while(True):
  res = re.match(ptn , tmp)
  if res is None:
    break
  tmp = tmp.replace(res.group(),'',1)

if len(tmp) == 0:
  print('YES')
else:
  print('NO')

Diff:
 import re
 
 s = input()
-ptn = re.compile(r'maerd|remaerd|sare|resare')
+ptn = re.compile(r'maerd|remaerd|resare|esare')
 tmp = s[::-1]
 
 while(True):
   res = re.match(ptn , tmp)
   if res is None:
-    print(tmp)
     break
   tmp = tmp.replace(res.group(),'',1)
-  print(tmp)
 
 if len(tmp) == 0:
   print('YES')
 else:
   print('NO')
Buggy program (verdict: Wrong Answer):
n = int(input())
a = map(int, input().split())
ans = 0
i = 0
for x in a:
  	if i % 2 == x % 2 == 1: ans += 1
  	i += 1
print(ans)

Failing test case input:
15
1 10 109 15 87 98 29 161 0 60 44 11 9 26 19

Expected output:
6


Actual output:
3


Fixed program (verdict: Accepted):
n = int(input())
a = map(int, input().split())
ans = 0
i = 1
for x in a:
  	if i % 2 == x % 2 == 1: ans += 1
  	i += 1
print(ans)

Diff:
 n = int(input())
 a = map(int, input().split())
 ans = 0
-i = 0
+i = 1
 for x in a:
   	if i % 2 == x % 2 == 1: ans += 1
   	i += 1
 print(ans)
Buggy program (verdict: Wrong Answer):
N=int(input())
A=list(map(int,input().split()))
a=0
s=[]
for i in A:
  if i<a:
    s.append(a-i)
    a=i
  else:
    a=i
print(sum(s))

Failing test case input:
5
5 -1 175 0 0

Expected output:
356


Actual output:
181


Fixed program (verdict: Accepted):
N=int(input())
A=list(map(int,input().split()))
a=0
s=[]
for i in A:
  if i<a:
    s.append(a-i)
    
  else:
    a=i
print(sum(s))


Diff:
 N=int(input())
 A=list(map(int,input().split()))
 a=0
 s=[]
 for i in A:
   if i<a:
     s.append(a-i)
-    a=i
+    
   else:
     a=i
 print(sum(s))
+
Buggy program (verdict: Wrong Answer):
y,z = map(int,input().split())
print(y*z)
print((y+z)*2)

Failing test case input:
1 122

Expected output:
122 246


Actual output:
122
246


Fixed program (verdict: Accepted):
y,z = map(int,input().split())
print((y*z),((y+z)*2),sep=' ')

Diff:
 y,z = map(int,input().split())
-print(y*z)
-print((y+z)*2)
+print((y*z),((y+z)*2),sep=' ')
Buggy program (verdict: Wrong Answer):
s = 'HASFJGHOGAKZZFEGA'
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)


Failing test case input:
SEAG[IHNGFKJZHCGB

Expected output:
11


Actual output:
12


Fixed program (verdict: Accepted):
s = input()
rs = s[::-1]
x = s.index('A')
y = rs.index('Z')
print(len(s)-y-x)


Diff:
-s = 'HASFJGHOGAKZZFEGA'
+s = input()
 rs = s[::-1]
 x = s.index('A')
 y = rs.index('Z')
 print(len(s)-y-x)
Buggy program (verdict: Wrong Answer):
a,b = map(int, input().split())
if a != b:
    x= a*2 -1
else:
    x =a*2
print(x)


Failing test case input:
-3 47

Expected output:
93


Actual output:
-7


Fixed program (verdict: Accepted):
a,b = map(int, input().split())
if a != b:
    x= max([a,b])*2 -1
else:
    x =a*2
print(x)


Diff:
 a,b = map(int, input().split())
 if a != b:
-    x= a*2 -1
+    x= max([a,b])*2 -1
 else:
     x =a*2
 print(x)
Buggy program (verdict: Wrong Answer):
a,b,c = map(int, input().split())

if a*b > c:
    print(a*b)
else:
    print(c)

Failing test case input:
7 17 120

Expected output:
119

Actual output:
120


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

if a*b < c:
    print(a*b)
else:
    print(c)

Diff:
 a,b,c = map(int, input().split())
 
-if a*b > c:
+if a*b < c:
     print(a*b)
 else:
     print(c)
Buggy program (verdict: Wrong Answer):
s = input()
ans = True
for i in s:
    if(abs(s.find(i)-s.rfind(i)) == 1):
        ans = False
if ans == True:
    print("Good")
else:
    print("Bad")


Failing test case input:
47440

Expected output:
Bad


Actual output:
Good


Fixed program (verdict: Accepted):
s = input()
ans = True
for i in s:
    if(s.count(i+i)):
        ans = False
if ans == True:
    print("Good")
else:
    print("Bad")


Diff:
 s = input()
 ans = True
 for i in s:
-    if(abs(s.find(i)-s.rfind(i)) == 1):
+    if(s.count(i+i)):
         ans = False
 if ans == True:
     print("Good")
 else:
     print("Bad")
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
ans = 1
tmp = 1

while N >= tmp:
    tmp = tmp * K
    ans += 1

print(tmp)
print(ans-1)

Failing test case input:
4000772700 2

Expected output:
32


Actual output:
4294967296
32


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

while N >= tmp:
    tmp = tmp * K
    ans += 1


print(ans-1)

Diff:
 N, K = map(int, input().split())
 ans = 1
 tmp = 1
 
 while N >= tmp:
     tmp = tmp * K
     ans += 1
 
-print(tmp)
+
 print(ans-1)
Buggy program (verdict: Wrong Answer):
n = int(input())
p = [int(input()) for _ in range(n)]

q = [0] * n
for i in range(n):
    q[p[i]-1] = i
mxk = 1
k = 1
for i in range(n-1):
    if q[i] < q[i+1]:
        k += 1
        if k > mxk:
            mxk = k
    else:
        k = 1
print(n-k)


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

Expected output:
3


Actual output:
4


Fixed program (verdict: Accepted):
n = int(input())
p = [int(input()) for _ in range(n)]

q = [0] * n
for i in range(n):
    q[p[i]-1] = i
mxk = 1
k = 1
for i in range(n-1):
    if q[i] < q[i+1]:
        k += 1
        if k > mxk:
            mxk = k
    else:
        k = 1
print(n-mxk)


Diff:
 n = int(input())
 p = [int(input()) for _ in range(n)]
 
 q = [0] * n
 for i in range(n):
     q[p[i]-1] = i
 mxk = 1
 k = 1
 for i in range(n-1):
     if q[i] < q[i+1]:
         k += 1
         if k > mxk:
             mxk = k
     else:
         k = 1
-print(n-k)
+print(n-mxk)
Buggy program (verdict: Wrong Answer):
a = input()
if a[0]==a[1] or a[1]==a[2]:
  print("No")
else:
  print("Yes")

Failing test case input:
dad

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
a = input()
if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
  print("No")
else:
  print("Yes")

Diff:
 a = input()
-if a[0]==a[1] or a[1]==a[2]:
+if a[0]==a[1] or a[1]==a[2] or a[2]==a[0]:
   print("No")
 else:
   print("Yes")
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
count = 0
import bisect
for i in range(n):
    A = bisect.bisect(a,b[i]-1)
    B = bisect.bisect(c,b[i]+1)
    count += A*(n-B)
print(count)

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

Expected output:
9


Actual output:
0


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
count = 0
import bisect
for i in range(n):
    A = bisect.bisect_right(a,b[i]-1)
    C = bisect.bisect_left(c,b[i]+1)
    count += A*(n-C)
print(count)

Diff:
 n = int(input())
 a = list(map(int,input().split()))
 b = list(map(int,input().split()))
 c = list(map(int,input().split()))
 a = sorted(a)
 b = sorted(b)
 c = sorted(c)
 count = 0
 import bisect
 for i in range(n):
-    A = bisect.bisect(a,b[i]-1)
-    B = bisect.bisect(c,b[i]+1)
-    count += A*(n-B)
+    A = bisect.bisect_right(a,b[i]-1)
+    C = bisect.bisect_left(c,b[i]+1)
+    count += A*(n-C)
 print(count)
Buggy program (verdict: Wrong Answer):
x,a,b = list(map(lambda x: int(x), input().split(" ")))

if x+a<=b:
  if a<=b:
    print("delicious")
  else:
    print("safe")
else:
  print("dangerous")

Failing test case input:
-1 7 14

Expected output:
dangerous


Actual output:
delicious


Fixed program (verdict: Accepted):
x,a,b = list(map(lambda x: int(x), input().split(" ")))

if x>=b-a:
  if b<=a:
    print("delicious")
  else:
    print("safe")
else:
  print("dangerous")

Diff:
 x,a,b = list(map(lambda x: int(x), input().split(" ")))
 
-if x+a<=b:
-  if a<=b:
+if x>=b-a:
+  if b<=a:
     print("delicious")
   else:
     print("safe")
 else:
   print("dangerous")
Buggy program (verdict: Wrong Answer):
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())
    count = 0

    input_data.sort()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Failing test case input:
15
18
26
30
21
2

Expected output:
:(


Actual output:
Yay!


Fixed program (verdict: Accepted):
def main():
    input_data = [int(input()) for i in range(5)]
    k = int(input())

    input_data.sort()
    input_data.reverse()

    temp = input_data[0] - input_data[4]
    if temp > k :
        print(":(")
    else:
        print('Yay!')

if __name__ == '__main__':
    main()

Diff:
 def main():
     input_data = [int(input()) for i in range(5)]
     k = int(input())
-    count = 0
 
     input_data.sort()
+    input_data.reverse()
 
     temp = input_data[0] - input_data[4]
     if temp > k :
         print(":(")
     else:
         print('Yay!')
 
 if __name__ == '__main__':
     main()
Buggy program (verdict: Wrong Answer):
N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N):
  w = S + T[-(i+1):]
  if w[:N] == S and w[N:] == T:
    ans = min(ans,i+N+1)

if S == T:
  ans = N
    
print(ans)
    


Failing test case input:
4
gtrx
xofr

Expected output:
7


Actual output:
8


Fixed program (verdict: Accepted):
N = int(input())
S = list(input())
T = list(input())

ans = N + N
for i in range(N):
  w = S + T[-(i+1):]
  if w[:N] == S and w[-N:] == T:
    ans = min(ans,i+N+1)

if S == T:
  ans = N
    
print(ans)
    


Diff:
 N = int(input())
 S = list(input())
 T = list(input())
 
 ans = N + N
 for i in range(N):
   w = S + T[-(i+1):]
-  if w[:N] == S and w[N:] == T:
+  if w[:N] == S and w[-N:] == T:
     ans = min(ans,i+N+1)
 
 if S == T:
   ans = N
     
 print(ans)
Buggy program (verdict: Wrong Answer):

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
d = []
for i in range(m):
    b, c = map(int, input().split())
    d.append([b, c])
print(d)
d = sorted(d, key=lambda x: x[1], reverse=True)
print(d)
k = 0
for i in range(n):
    if d[k][0] == 0:
        k += 1
        if k == len(d):  
            break
    if a[i] >= d[k][1]:  
        break
    a[i] = d[k][1]  
    d[k][0] -= 1  
print(sum(a))

Failing test case input:
10 2
0 4 5 7 100 4 7 33 33 5
3 15
4 39
1 4

Expected output:
367


Actual output:
[[3, 15], [4, 39]]
[[4, 39], [3, 15]]
367


Fixed program (verdict: Accepted):

n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
d = []
for i in range(m):
    b, c = map(int, input().split())
    d.append([b, c])

d = sorted(d, key=lambda x: x[1], reverse=True)

k = 0
for i in range(n):
    if d[k][0] == 0:
        k += 1
        if k == len(d):  
            break
    if a[i] >= d[k][1]:  
        break
    a[i] = d[k][1]  
    d[k][0] -= 1  
print(sum(a))

Diff:
 
 n, m = map(int, input().split())
 a = list(map(int, input().split()))
 a.sort()
 d = []
 for i in range(m):
     b, c = map(int, input().split())
     d.append([b, c])
-print(d)
+
 d = sorted(d, key=lambda x: x[1], reverse=True)
-print(d)
+
 k = 0
 for i in range(n):
     if d[k][0] == 0:
         k += 1
         if k == len(d):  
             break
     if a[i] >= d[k][1]:  
         break
     a[i] = d[k][1]  
     d[k][0] -= 1  
 print(sum(a))
Buggy program (verdict: Wrong Answer):
n,m = list(map(int, input().split()))

print(1900*(2**m))

Failing test case input:
000 2

Expected output:
14400


Actual output:
7600


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

print((1900*m+100*(n-m))*(2**m))

Diff:
 n,m = list(map(int, input().split()))
 
-print(1900*(2**m))
+print((1900*m+100*(n-m))*(2**m))
Buggy program (verdict: Wrong Answer):
THP,TAT,AHP,AAT = map(int,input().split())
while THP and AHP >= 0 :
    AHP -= TAT
    THP -= AAT
if THP <= 0 and AHP >= 0 :
    print("No")
elif AHP <= 0 and THP >= 0 :
    print("Yes")
else:
    print("Yes")

Failing test case input:
5 9 13 10

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
THP,TAT,AHP,AAT = map(int,input().split())
while THP > 0 and AHP > 0 :
    AHP -= TAT
    THP -= AAT
if THP <= 0 and AHP > 0 :
    print("No")
elif AHP <= 0 and THP > 0 :
    print("Yes")
else:
    print("Yes")

Diff:
 THP,TAT,AHP,AAT = map(int,input().split())
-while THP and AHP >= 0 :
+while THP > 0 and AHP > 0 :
     AHP -= TAT
     THP -= AAT
-if THP <= 0 and AHP >= 0 :
+if THP <= 0 and AHP > 0 :
     print("No")
-elif AHP <= 0 and THP >= 0 :
+elif AHP <= 0 and THP > 0 :
     print("Yes")
 else:
     print("Yes")
Buggy program (verdict: Wrong Answer):
import sys
sp=input()
t=input()

m=len(sp)
n=len(t)
for i in range(m-n,-1,-1):
  cand=sp[:i].replace('?','a')+t+sp[i+n+1:].replace('?','a')
  f=0
  for j,w in enumerate(t):
    if sp[j+i]!=w and sp[j+i]!='?':
      f=1
      break
  if f==0:
    print(cand)
    sys.exit()
print('UNRESTOREBLE')


Failing test case input:
??b@@t@
gbrnc

Expected output:
UNRESTORABLE


Actual output:
UNRESTOREBLE


Fixed program (verdict: Accepted):
import sys
sp=input()
t=input()

m=len(sp)
n=len(t)
for i in range(m-n,-1,-1):
  cand=sp[:i].replace('?','a')+t+sp[i+n:].replace('?','a')
  for j,w in enumerate(t):
    if sp[j+i]!=w and sp[j+i]!='?':
      break
  else:
    print(cand)
    sys.exit()
print('UNRESTORABLE')

Diff:
 import sys
 sp=input()
 t=input()
 
 m=len(sp)
 n=len(t)
 for i in range(m-n,-1,-1):
-  cand=sp[:i].replace('?','a')+t+sp[i+n+1:].replace('?','a')
-  f=0
+  cand=sp[:i].replace('?','a')+t+sp[i+n:].replace('?','a')
   for j,w in enumerate(t):
     if sp[j+i]!=w and sp[j+i]!='?':
-      f=1
       break
-  if f==0:
+  else:
     print(cand)
     sys.exit()
-print('UNRESTOREBLE')
-
+print('UNRESTORABLE')
Buggy program (verdict: Wrong Answer):
N, X, T = map(int,input().split())

ans = 0
while(N >= X):
    if N >= X:
        ans += T
        N = N - X
    else:
        ans += T
        break
    
    
print(ans)

Failing test case input:
149 10 1

Expected output:
15


Actual output:
14


Fixed program (verdict: Accepted):
N, X, T = map(int,input().split())

ans = 0
while(N >= 0):
    if N == 0:
        break
    if N >= X:
        ans += T
        N = N - X
    else:
        ans += T
        break
    
print(ans)

Diff:
 N, X, T = map(int,input().split())
 
 ans = 0
-while(N >= X):
+while(N >= 0):
+    if N == 0:
+        break
     if N >= X:
         ans += T
         N = N - X
     else:
         ans += T
         break
     
-    
 print(ans)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
for i in range(1,N):
  count = 0
  for i in range(1,N):
    if A[i-1] == i:
      count += 1
  print(count)
print(0)

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

Expected output:
1
2
0
1
1
1
0


Actual output:
5
5
5
5
5
5
0


Fixed program (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
l = [0]*N
for i in range(1,N):
  l[A[i-1]-1] += 1
for i in range(N):
  print(l[i])
  

Diff:
 N = int(input())
 A = list(map(int,input().split()))
+l = [0]*N
 for i in range(1,N):
-  count = 0
-  for i in range(1,N):
-    if A[i-1] == i:
-      count += 1
-  print(count)
-print(0)
+  l[A[i-1]-1] += 1
+for i in range(N):
+  print(l[i])
+
Buggy program (verdict: Wrong Answer):
x, y, z = map(int, input().split())

tmp = z
y = x
z = y
x = tmp

print(x, y, z)


Failing test case input:
41 82 46

Expected output:
46 41 82


Actual output:
46 41 41


Fixed program (verdict: Accepted):
x, y, z = map(int, input().split())

tmp = x
x = z
z = y
y = tmp

print(x, y, z)

Diff:
 x, y, z = map(int, input().split())
 
-tmp = z
-y = x
+tmp = x
+x = z
 z = y
-x = tmp
+y = tmp
 
 print(x, y, z)
-
Buggy program (verdict: Wrong Answer):
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  if pos == 2:
    print(count)
    break

Failing test case input:
3
3
2
3

Expected output:
-1


Actual output:

Fixed program (verdict: Accepted):
n = int(input())
A = [int(input()) for _ in range(n)]
used = {1}
pos = 1
count = 0
for _ in range(n):
  pos = A[pos - 1]
  count += 1
  if pos in used:
    print(-1)
    break
  used.add(pos)
  if pos == 2:
    print(count)
    break


Diff:
 n = int(input())
 A = [int(input()) for _ in range(n)]
 used = {1}
 pos = 1
 count = 0
 for _ in range(n):
   pos = A[pos - 1]
   count += 1
   if pos in used:
     print(-1)
     break
+  used.add(pos)
   if pos == 2:
     print(count)
     break
+
Buggy program (verdict: Wrong Answer):


n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 1

for idx, i in enumerate(seq[1:]):
  if i > idx+2:
   continue
  else:
    count += 1
print(count)

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

Expected output:
1


Actual output:
5


Fixed program (verdict: Accepted):
n = int(input())
seq = [int(e) for e in input().split(' ')]

count = 1

current_min = seq[0]

for idx, i in enumerate(seq[1:]):
  if i < current_min:
    current_min = i
    count += 1
print(count)

Diff:
-
-
 n = int(input())
 seq = [int(e) for e in input().split(' ')]
 
 count = 1
 
+current_min = seq[0]
+
 for idx, i in enumerate(seq[1:]):
-  if i > idx+2:
-   continue
-  else:
+  if i < current_min:
+    current_min = i
     count += 1
 print(count)
Buggy program (verdict: Wrong Answer):
N,K = map(int,input().split())
tmp = 1
for i in range(1,30):
    if N > K**i:
        tmp = i+1
    else:
        print(tmp)
        break

Failing test case input:
1568902019 2

Expected output:
31


Actual output:

Fixed program (verdict: Accepted):
N,K = map(int,input().split())
tmp = 1
for i in range(1,40):
    if N >= K**i:
        tmp = i+1
    else:
        print(tmp)
        break


Diff:
 N,K = map(int,input().split())
 tmp = 1
-for i in range(1,30):
-    if N > K**i:
+for i in range(1,40):
+    if N >= K**i:
         tmp = i+1
     else:
         print(tmp)
         break
+
Buggy program (verdict: Wrong Answer):
n = int(input())
R = []

for i in range(n): R.append(int(input()))

maxv = R[1] - R[0]
minv = R[0]
for j in range(1, n):
    for i in range(j):
        minv = min(minv, R[j])
        maxv = max(maxv, R[j]-minv)

print(maxv)


Failing test case input:
3
1
-2
-24

Expected output:
-3


Actual output:
0


Fixed program (verdict: Accepted):
n = int(input())
R = []

for i in range(n): R.append(int(input()))

maxv = R[1] - R[0]
minv = R[0]
for j in range(1, n):
    maxv = max(maxv, R[j]-minv)
    minv = min(minv, R[j])

print(maxv)


Diff:
 n = int(input())
 R = []
 
 for i in range(n): R.append(int(input()))
 
 maxv = R[1] - R[0]
 minv = R[0]
 for j in range(1, n):
-    for i in range(j):
-        minv = min(minv, R[j])
-        maxv = max(maxv, R[j]-minv)
+    maxv = max(maxv, R[j]-minv)
+    minv = min(minv, R[j])
 
 print(maxv)
Buggy program (verdict: Wrong Answer):
A, B, C, D = map(int, input().split())
 
ans = 0
 
for i in range(max(A, B, C, D)+1):
  if (A <= i and i <= B) and (C <= i and i <= D):
    ans += 1
  print(i)
 
if ans <= 1:
  print(0)
elif A == C and B == D:
  print(ans)
else:
  print(ans-1)

Failing test case input:
0 6 1 5

Expected output:
4


Actual output:
0
1
2
3
4
5
6
4


Fixed program (verdict: Accepted):
A, B, C, D = map(int, input().split())
 
ans = 0
 
for i in range(max(A, B, C, D)+1):
  if (A <= i and i <= B) and (C <= i and i <= D):
    ans += 1
 
if ans <= 1:
  print(0)
elif A == C and B == D:
  print(ans - 1)
else:
  print(ans-1)

Diff:
 A, B, C, D = map(int, input().split())
  
 ans = 0
  
 for i in range(max(A, B, C, D)+1):
   if (A <= i and i <= B) and (C <= i and i <= D):
     ans += 1
-  print(i)
  
 if ans <= 1:
   print(0)
 elif A == C and B == D:
-  print(ans)
+  print(ans - 1)
 else:
   print(ans-1)
Buggy program (verdict: Wrong Answer):
n = int(input())
s = [input() for _ in range(n)]
a = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for i in a:
    mi = 50
    for j in s:
        print(i, j, j.count(i))
        mi = min(mi, j.count(i))
    cnt.append(mi)
ans = ""
for i in range(26):
    ans += a[i] * cnt[i]
print(ans)


Failing test case input:
3
caaa
ccb_c
abaacd

Expected output:
c


Actual output:
a caaa 3
a ccb_c 0
a abaacd 3
b caaa 0
b ccb_c 1
b abaacd 1
c caaa 1
c ccb_c 3
c abaacd 1
d caaa 0
d ccb_c 0
d abaacd 1
e caaa 0
e ccb_c 0
e abaacd 0
f caaa 0
f ccb_c 0
f abaacd 0
g caaa 0
g ccb_c 0
g abaacd 0
h caaa 0
h ccb_c 0
h abaacd 0
i caaa 0
i ccb_c 0
i abaacd 0
j caaa 0
j ccb_c 0
j abaacd 0
k caaa 0
k ccb_c 0
k abaacd 0
l caaa 0
l ccb_c 0
l abaacd 0
m caaa 0
m ccb_c 0
m abaacd 0
n caaa 0
n ccb_c 0
n abaacd 0
o caaa 0
o ccb_c 0
o abaacd 0
p caaa 0
p ccb_c 0
p abaacd 0
q caaa 0
q ccb_c 0
q abaacd 0
r caaa 0
r ccb_c 0
r abaacd 0
s caaa 0
s ccb_c 0
s abaacd 0
t caaa 0
t ccb_c 0
t abaacd 0
u caaa 0
u ccb_c 0
u abaacd 0
v caaa 0
v ccb_c 0
v abaacd 0
w caaa 0
w ccb_c 0
w abaacd 0
x caaa 0
x ccb_c 0
x abaacd 0
y caaa 0
y ccb_c 0
y abaacd 0
z caaa 0
z ccb_c 0
z abaacd 0
c


Fixed program (verdict: Accepted):
n = int(input())
s = [input() for _ in range(n)]
a = "abcdefghijklmnopqrstuvwxyz"
cnt = []
for i in a:
    mi = 50
    for j in s:
        mi = min(mi, j.count(i))
    cnt.append(mi)
ans = ""
for i in range(26):
    ans += a[i] * cnt[i]
print(ans)


Diff:
 n = int(input())
 s = [input() for _ in range(n)]
 a = "abcdefghijklmnopqrstuvwxyz"
 cnt = []
 for i in a:
     mi = 50
     for j in s:
-        print(i, j, j.count(i))
         mi = min(mi, j.count(i))
     cnt.append(mi)
 ans = ""
 for i in range(26):
     ans += a[i] * cnt[i]
 print(ans)
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
k=(a+b)/2
if k%1==0:
    print(k)
else:
    print('IMPOSSIBLE')


Failing test case input:
314794616 44782566

Expected output:
179788591


Actual output:
179788591.0


Fixed program (verdict: Accepted):
a,b=map(int,input().split())
k=(a+b)/2
if k%1==0:
    print(int(k))
else:
    print('IMPOSSIBLE')


Diff:
 a,b=map(int,input().split())
 k=(a+b)/2
 if k%1==0:
-    print(k)
+    print(int(k))
 else:
     print('IMPOSSIBLE')
Buggy program (verdict: Wrong Answer):
import bisect
import collections
n=int(input())
a=sorted(list(map(int,input().split())))
q=int(input())
A=collections.Counter(a)
ans=sum(a)
for _ in range(q):
  b,c=map(int,input().split())
  k=A[b]
  ans=(c-b)*k+ans
  print(ans)
  del A[b]
  A[c]=k

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

Expected output:
6
4
4


Actual output:
6
5
5


Fixed program (verdict: Accepted):
import bisect
import collections
n=int(input())
a=sorted(list(map(int,input().split())))
q=int(input())
A=collections.Counter(a)
ans=sum(a)
for _ in range(q):
  b,c=map(int,input().split())
  k=A[b]
  ans=(c-b)*k+ans
  print(ans)
  del A[b]
  A[c]+=k


Diff:
 import bisect
 import collections
 n=int(input())
 a=sorted(list(map(int,input().split())))
 q=int(input())
 A=collections.Counter(a)
 ans=sum(a)
 for _ in range(q):
   b,c=map(int,input().split())
   k=A[b]
   ans=(c-b)*k+ans
   print(ans)
   del A[b]
-  A[c]=k
+  A[c]+=k
+
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
if a%2==0 and b%2==0:
    print("Yes")
else:
    print("No")


Failing test case input:
-12 -2

Expected output:
No


Actual output:
Yes


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


Diff:
 a,b=map(int,input().split())
-if a%2==0 and b%2==0:
+if a%2==1 and b%2==1:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
a = list(input())
if a[0] == a[1] and a[1] == a[2] and a[2] == a[0]:
    print("No")
else:
    print("Yes")


Failing test case input:
ada

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
a = list(input())
if a[0] == a[1] or a[1] == a[2] or a[2] == a[0]:
    print("No")
else:
    print("Yes")


Diff:
 a = list(input())
-if a[0] == a[1] and a[1] == a[2] and a[2] == a[0]:
+if a[0] == a[1] or a[1] == a[2] or a[2] == a[0]:
     print("No")
 else:
     print("Yes")
Buggy program (verdict: Wrong Answer):
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
  sys.exit()
for i in range(2,k+1):
  x=7%k
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Failing test case input:
726903

Expected output:
342000


Actual output:
-1


Fixed program (verdict: Accepted):
import sys
k=int(input())
l=[]
x=7%k
if x == 0:
  print(1)
  sys.exit()
for i in range(2,k+1):
  num=(x*10+7)%k
  x=num
  l.append(num)
  if num==0:
    print(i)
    break
if 0 not in l:
  print(-1)

Diff:
 import sys
 k=int(input())
 l=[]
 x=7%k
 if x == 0:
   print(1)
   sys.exit()
 for i in range(2,k+1):
-  x=7%k
   num=(x*10+7)%k
   x=num
   l.append(num)
   if num==0:
     print(i)
     break
 if 0 not in l:
   print(-1)
Buggy program (verdict: Wrong Answer):
k,n=input().split();
a=input().split();
k=int(k);
n=int(n);
by=0;
for i in range(n):
	a[i]=int(a[i]);
for i in range(n-1):
	if a[i+1]-a[i]>by:
		by=a[i+1]-a[i];
if (k-a[n-1])+a[0]>by :
	by=(k-a[n-1])+a[0];
print(by);


Failing test case input:
20 3
1 2 15

Expected output:
7


Actual output:
13


Fixed program (verdict: Accepted):
k,n=input().split();
a=input().split();
k=int(k);
n=int(n);
by=0;
for i in range(n):
	a[i]=int(a[i]);
for i in range(n-1):
	if a[i+1]-a[i]>by:
		by=a[i+1]-a[i];
if (k-a[n-1])+a[0]>by :
	by=(k-a[n-1])+a[0];
print(k-by);


Diff:
 k,n=input().split();
 a=input().split();
 k=int(k);
 n=int(n);
 by=0;
 for i in range(n):
 	a[i]=int(a[i]);
 for i in range(n-1):
 	if a[i+1]-a[i]>by:
 		by=a[i+1]-a[i];
 if (k-a[n-1])+a[0]>by :
 	by=(k-a[n-1])+a[0];
-print(by);
+print(k-by);
Buggy program (verdict: Wrong Answer):
n = int(input())
total = 0
for i in range(n+1):
  if n % 3 != 0 and n % 5 != 0:
    total += n
    
print(total)

Failing test case input:
1110010

Expected output:
328565550022


Actual output:
0


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

Diff:
 n = int(input())
 total = 0
 for i in range(n+1):
-  if n % 3 != 0 and n % 5 != 0:
-    total += n
+  if i % 3 != 0 and i % 5 != 0:
+    total += i
     
 print(total)
Buggy program (verdict: Wrong Answer):
a,b = map(int, input().split())
s = input()
if len(s) == a+b+1:
    print("Yes")
else:
    print("No")

Failing test case input:
1 1
---

Expected output:
No

Actual output:
Yes


Fixed program (verdict: Accepted):
a,b = map(int, input().split())
s = input()
if len(s) == a+b+1 and s.count("-") == 1 and s[a] == "-":
    print("Yes")
else:
    print("No")

Diff:
 a,b = map(int, input().split())
 s = input()
-if len(s) == a+b+1:
+if len(s) == a+b+1 and s.count("-") == 1 and s[a] == "-":
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):

n = input()

N = int(n.split()[0])
A = int(n.split()[1])
B = int(n.split()[2])

if A > B:
    print(int(B*N))

else:
    print(int(A*N))



Failing test case input:
-69 2 -1

Expected output:
-138


Actual output:
69


Fixed program (verdict: Accepted):

n = input()

N = int(n.split()[0])
A = int(n.split()[1])
B = int(n.split()[2])

if A*N > B:
    print(int(B))

else:
    print(int(A*N))



Diff:
 
 n = input()
 
 N = int(n.split()[0])
 A = int(n.split()[1])
 B = int(n.split()[2])
 
-if A > B:
-    print(int(B*N))
+if A*N > B:
+    print(int(B))
 
 else:
     print(int(A*N))
Buggy program (verdict: Wrong Answer):
import collections
n = input()
print(len(collections.Counter(input().replace(" ",""))))

Failing test case input:
8
P X X H Y X Y Y

Expected output:
Four


Actual output:
4


Fixed program (verdict: Accepted):
import collections
n = input()
ans = len(collections.Counter(input().replace(" ","")))
if ans == 4: print("Four")
else: print("Three")

Diff:
 import collections
 n = input()
-print(len(collections.Counter(input().replace(" ",""))))
+ans = len(collections.Counter(input().replace(" ","")))
+if ans == 4: print("Four")
+else: print("Three")
Buggy program (verdict: Wrong Answer):
S = list(input())

if S == "RSR":
    ans = 1
else:
    ans = S.count("R")

print(ans)


Failing test case input:
RSR

Expected output:
1

Actual output:
2


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

if S == "RSR":
    ans = 1
else:
    S = list(S)
    ans = S.count("R")

print(ans)


Diff:
-S = list(input())
+S = input()
 
 if S == "RSR":
     ans = 1
 else:
+    S = list(S)
     ans = S.count("R")
 
 print(ans)
Buggy program (verdict: Wrong Answer):
N=int(input())
num_list=[]
for i in range(N+1):
  if i%3!=0 or i%5!=0:
    num_list.append(i)
print(sum(num_list))

Failing test case input:
1101100

Expected output:
323311955632


Actual output:
565797298735


Fixed program (verdict: Accepted):
N=int(input())
num_list=[]
for i in range(N+1):
  if i%3!=0 and i%5!=0:
    num_list.append(i)
print(sum(num_list))

Diff:
 N=int(input())
 num_list=[]
 for i in range(N+1):
-  if i%3!=0 or i%5!=0:
+  if i%3!=0 and i%5!=0:
     num_list.append(i)
 print(sum(num_list))
Buggy program (verdict: Wrong Answer):
n = int(input())
S = sorted(list(map(int, input().split())))
sumS = sum(S)
if sumS%10:
  print(sumS)
else:
  for i in S:
    if i%10:
      print(sumS - i)
      exit()
  print(0)

Failing test case input:
3
-260
0
-1

Expected output:
-261


Actual output:
0


Fixed program (verdict: Accepted):
n = int(input())
S = sorted([ int(input()) for _ in range(n) ])
sumS = sum(S)
if sumS%10:
  print(sumS)
else:
  for i in S:
    if i%10:
      print(sumS - i)
      exit()
  print(0)


Diff:
 n = int(input())
-S = sorted(list(map(int, input().split())))
+S = sorted([ int(input()) for _ in range(n) ])
 sumS = sum(S)
 if sumS%10:
   print(sumS)
 else:
   for i in S:
     if i%10:
       print(sumS - i)
       exit()
   print(0)
+
Buggy program (verdict: Wrong Answer):
n = int(input())

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
a = n/min(max_nums)
print(int(a)*5 + (0 if a == int(a) else 1))



Failing test case input:
10
104
811
2
9
123

Expected output:
9


Actual output:
25


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

max_nums = []
for i in range(5):
  max_nums.append(int(input()))
max_nums.append(n)
a = n/min(max_nums)
print(int(a) +4+ (0 if a == int(a) else 1))

Diff:
 n = int(input())
 
 max_nums = []
 for i in range(5):
   max_nums.append(int(input()))
+max_nums.append(n)
 a = n/min(max_nums)
-print(int(a)*5 + (0 if a == int(a) else 1))
-
-
+print(int(a) +4+ (0 if a == int(a) else 1))
Buggy program (verdict: Wrong Answer):
a, _ = map(int, input().split())
c, d = map(int, input().split())
 
if a == c and d == 1:
    print("1")
else:
    print("0")

Failing test case input:
11 30
35 1

Expected output:
1


Actual output:
0


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

if a != c and d == 1:
    print("1")
else:
    print("0")


Diff:
 a, _ = map(int, input().split())
 c, d = map(int, input().split())
- 
-if a == c and d == 1:
+
+if a != c and d == 1:
     print("1")
 else:
     print("0")
+
Buggy program (verdict: Wrong Answer):
s = input()
odd = ["R","U","D"]
even = ["L","U","D"]
flag1=True
flag2=True
for i in range(1,len(s)+1):
    if (i%2==1) and not(s[i-1] in odd):
        flag1 =False
    if (i%2==0) and not(s[i-1] in even):
        flag2 = False

print(flag1,flag2)
if flag1 and flag2:
    print("Yes")
else:
    print("No")

Failing test case input:
DVMLCRKVQJRRDRKSVWW

Expected output:
No


Actual output:
False False
No


Fixed program (verdict: Accepted):
s = input()
odd = ["R","U","D"]
even = ["L","U","D"]
flag1=True
flag2=True
for i in range(1,len(s)+1):
    if (i%2==1) and not(s[i-1] in odd):
        flag1 =False
    if (i%2==0) and not(s[i-1] in even):
        flag2 = False

if flag1 and flag2:
    print("Yes")
else:
    print("No")

Diff:
 s = input()
 odd = ["R","U","D"]
 even = ["L","U","D"]
 flag1=True
 flag2=True
 for i in range(1,len(s)+1):
     if (i%2==1) and not(s[i-1] in odd):
         flag1 =False
     if (i%2==0) and not(s[i-1] in even):
         flag2 = False
 
-print(flag1,flag2)
 if flag1 and flag2:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
n = 0
list = []
while n < 10:
    x = input()
    list.append(x)
    n += 1

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

Failing test case input:
100
-2
-1
6269
000
98
1
24
1
297

Expected output:
6269
297
100


Actual output:
297
6269
98


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[7])
-print(list[8])
 print(list[9])
+print(list[8])
+print(list[7])
Buggy program (verdict: Wrong Answer):

A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            print(A)
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])

Failing test case input:
1 4 + 3 4 - *

Expected output:
-5


Actual output:
[5, -1, '*']
-5


Fixed program (verdict: Accepted):

A=input().split()
while(len(A)>1):
    for i in range(len(A)):
        if(A[i]=="+"):
            A[i]=int(A[i-2])+int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="-"):
            A[i]=int(A[i-2])-int(A[i-1])
            A=A[:i-2]+A[i:]
            break
        elif(A[i]=="*"):
            A[i]=int(A[i-2])*int(A[i-1])
            A=A[:i-2]+A[i:]
            break
print(A[0])

Diff:
 
 A=input().split()
 while(len(A)>1):
     for i in range(len(A)):
         if(A[i]=="+"):
             A[i]=int(A[i-2])+int(A[i-1])
             A=A[:i-2]+A[i:]
             break
         elif(A[i]=="-"):
             A[i]=int(A[i-2])-int(A[i-1])
             A=A[:i-2]+A[i:]
             break
         elif(A[i]=="*"):
-            print(A)
             A[i]=int(A[i-2])*int(A[i-1])
             A=A[:i-2]+A[i:]
             break
 print(A[0])
Buggy program (verdict: Wrong Answer):
a,b,c=map(int,input().split())
if b<c:
    if c-b>a:
        print("dangerous")
    else:
        print("safe")
else:
    print("delisious")

Failing test case input:
6 5 -1

Expected output:
delicious


Actual output:
delisious


Fixed program (verdict: Accepted):
a,b,c=map(int,input().split())
if b<c:
    if c-b>a:
        print("dangerous")
    else:
        print("safe")
else:
    print("delicious")

Diff:
 a,b,c=map(int,input().split())
 if b<c:
     if c-b>a:
         print("dangerous")
     else:
         print("safe")
 else:
-    print("delisious")
+    print("delicious")
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(1,n):
    if a[i-1]>a[i]:
        c += (a[i-1]-a[i])
print(c)

Failing test case input:
5
21 -1 1 14 6

Expected output:
64


Actual output:
30


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
c = 0
for i in range(1,n):
    if a[i-1]>a[i]:
        q = (a[i-1]-a[i])
        c += q
        a[i] = a[i]+q
print(c)

Diff:
 n = int(input())
 a = list(map(int,input().split()))
 c = 0
 for i in range(1,n):
     if a[i-1]>a[i]:
-        c += (a[i-1]-a[i])
+        q = (a[i-1]-a[i])
+        c += q
+        a[i] = a[i]+q
 print(c)
Buggy program (verdict: Wrong Answer):
N = int(input())

l = [None] * 5

for i in range(5):
    l[i] = int(input())

split = 0 if int(N/min(l)) <= 1 else int(N/min(l))
print(5+split)

Failing test case input:
10
123
1239
27
9
123

Expected output:
6


Actual output:
5


Fixed program (verdict: Accepted):
from math import ceil
N = int(input())

l = [None] * 5

for i in range(5):
    l[i] = int(input())

print(4 + ceil(N/min(l)))

Diff:
+from math import ceil
 N = int(input())
 
 l = [None] * 5
 
 for i in range(5):
     l[i] = int(input())
 
-split = 0 if int(N/min(l)) <= 1 else int(N/min(l))
-print(5+split)
+print(4 + ceil(N/min(l)))
Buggy program (verdict: Wrong Answer):
a,b,c=map(int,input().split())
if a==b or b==c or c==a:
    if a==b==c:
        print(1)
    else:
        print(2)
else:
    print(2)

Failing test case input:
11 20 -1

Expected output:
3


Actual output:
2


Fixed program (verdict: Accepted):
a,b,c=map(int,input().split())
if a==b or b==c or c==a:
    if a==b==c:
        print(1)
    else:
        print(2)
else:
    print(3)

Diff:
 a,b,c=map(int,input().split())
 if a==b or b==c or c==a:
     if a==b==c:
         print(1)
     else:
         print(2)
 else:
-    print(2)
+    print(3)
Buggy program (verdict: Wrong Answer):
n,T=map(int,input().split())
ans=10**9
for _ in range(n):
  c,t=map(int,input().split())
  if t<=T:
    ans=min(ans, c)
print(ans)

Failing test case input:
-5 -8
0 0100
1 1
2 0101
3 31

Expected output:
TLE


Actual output:
1000000000


Fixed program (verdict: Accepted):
n,T=map(int,input().split())
ans=10**9
isOk=False
for _ in range(n):
  c,t=map(int,input().split())
  if t<=T:
    ans=min(ans, c)
    isOk=True
print(ans) if isOk else print("TLE")


Diff:
 n,T=map(int,input().split())
 ans=10**9
+isOk=False
 for _ in range(n):
   c,t=map(int,input().split())
   if t<=T:
     ans=min(ans, c)
-print(ans)
+    isOk=True
+print(ans) if isOk else print("TLE")
+
Buggy program (verdict: Wrong Answer):
import bisect
n = int(input())
A = [0]
for i in range(n):
    num  = int(input())
    if num>A[-1]:
        A.append(num)
    else:
        j = bisect.bisect_left(A, num)
        A[j] = num
print(len(A) - 1)

Failing test case input:
5
5
1
0
1
6

Expected output:
3


Actual output:
2


Fixed program (verdict: Accepted):
import bisect
n = int(input())
A = []
for i in range(n):
    num  = int(input())
    if A == []:
        A.append(num)
    elif num > A[-1]:
        A.append(num)
    else:
        j = bisect.bisect_left(A, num)
        A[j] = num
print(len(A))

Diff:
 import bisect
 n = int(input())
-A = [0]
+A = []
 for i in range(n):
     num  = int(input())
-    if num>A[-1]:
+    if A == []:
+        A.append(num)
+    elif num > A[-1]:
         A.append(num)
     else:
         j = bisect.bisect_left(A, num)
         A[j] = num
-print(len(A) - 1)
+print(len(A))
Buggy program (verdict: Wrong Answer):
t,h=0,0
n=int(input())
for i in range(n):
    a,b=input().split()
    if a > b:
        h+=3
    elif a < b:
        t+=3
    else:
         t+=1
         h+=1
print(t, h)

Failing test case input:
3
f`v gpg
jrhd igug
nojk rheug

Expected output:
3 6


Actual output:
6 3


Fixed program (verdict: Accepted):
t,h=0,0
n=int(input())
for i in range(n):
    a,b=input().split()
    if a > b:
        t+=3
    elif a < b:
        h+=3
    else:
         t+=1
         h+=1
print(t, h)

Diff:
 t,h=0,0
 n=int(input())
 for i in range(n):
     a,b=input().split()
     if a > b:
-        h+=3
-    elif a < b:
         t+=3
+    elif a < b:
+        h+=3
     else:
          t+=1
          h+=1
 print(t, h)
Buggy program (verdict: Wrong Answer):
c,d=(int(x) for x in input().split())
a=c
print(a)

Failing test case input:
10001 2

Expected output:
5001


Actual output:
10001


Fixed program (verdict: Accepted):
c,d=(int(x) for x in input().split())
a=-(-c
print(a)

Diff:
 c,d=(int(x) for x in input().split())
-a=c
+a=-(-c
 print(a)
Buggy program (verdict: Wrong Answer):




Hitachi="Hitachi"
hitachi="hitachi"

s=input()
if "hihi" in s:print("Yes")
else:print("No")

Failing test case input:
hi

Expected output:
Yes

Actual output:
No


Fixed program (verdict: Accepted):



Hitachi="Hitachi"
hitachi="hitachi"

s=input()
if "hi"*(len(s)
else:print("No")


Diff:
 
 
 
-
 Hitachi="Hitachi"
 hitachi="hitachi"
 
 s=input()
-if "hihi" in s:print("Yes")
+if "hi"*(len(s)
 else:print("No")
+

Buggy program (verdict: Wrong Answer):
S = list(input())

if len(S) % 2 != 0:
    print("No")
    exit()

if len(S) == 2 and S == "hi":
    print("Yes")
    exit()
elif len(S) == 4 and S == "hihi":
    print("Yes")
    exit()
elif len(S) == 6 and S == "hihihi":
    print("Yes")
    exit()
elif len(S) == 8 and S == "hihihihi":
    print("Yes")
    exit()
elif len(S) == 10 and S == "hihihihihi":
    print("Yes")
    exit()

Failing test case input:
glfd

Expected output:
No


Actual output:

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

if len(S) % 2 != 0:
    print("No")
    exit()

if len(S) == 2 and S == "hi":
    print("Yes")
    exit()
elif len(S) == 4 and S == "hihi":
    print("Yes")
    exit()
elif len(S) == 6 and S == "hihihi":
    print("Yes")
    exit()
elif len(S) == 8 and S == "hihihihi":
    print("Yes")
    exit()
elif len(S) == 10 and S == "hihihihihi":
    print("Yes")
    exit()

print("No")

Diff:
-S = list(input())
+S = input()
 
 if len(S) % 2 != 0:
     print("No")
     exit()
 
 if len(S) == 2 and S == "hi":
     print("Yes")
     exit()
 elif len(S) == 4 and S == "hihi":
     print("Yes")
     exit()
 elif len(S) == 6 and S == "hihihi":
     print("Yes")
     exit()
 elif len(S) == 8 and S == "hihihihi":
     print("Yes")
     exit()
 elif len(S) == 10 and S == "hihihihihi":
     print("Yes")
     exit()
+
+print("No")
Buggy program (verdict: Wrong Answer):


def main():
    N, Z, W = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))
    
    if N == 1:
        print(abs(a[0] - W))
    else:
        print(max(abs(a[0] - W), abs(a[N - 2] - a[N - 1])))

if __name__ == '__main__':
    main()


Failing test case input:
5 0 0
0 -2 2 1 1

Expected output:
1


Actual output:
0


Fixed program (verdict: Accepted):


def main():
    N, Z, W = map(int, input().split(" "))
    a = list(map(int, input().split(" ")))
    
    if N == 1:
        print(abs(a[0] - W))
    else:
        print(max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])))

if __name__ == '__main__':
    main()


Diff:
 
 
 def main():
     N, Z, W = map(int, input().split(" "))
     a = list(map(int, input().split(" ")))
     
     if N == 1:
         print(abs(a[0] - W))
     else:
-        print(max(abs(a[0] - W), abs(a[N - 2] - a[N - 1])))
+        print(max(abs(a[N - 1] - W), abs(a[N - 2] - a[N - 1])))
 
 if __name__ == '__main__':
     main()
Buggy program (verdict: Wrong Answer):
K = int(input())
A, B = map(int, input().split())

for i in range(A, B+1):
    if i % K == 0:
        print('OK')
    else:
        print('NG')

Failing test case input:
4
2 37

Expected output:
OK


Actual output:
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG
NG
NG
OK
NG


Fixed program (verdict: Accepted):
K = int(input())
A, B = map(int, input().split())
ans = 'NG'
for i in range(A, B+1):
    if i % K == 0:
        print('OK')
        break
else:
    print(ans)

Diff:
 K = int(input())
 A, B = map(int, input().split())
-
+ans = 'NG'
 for i in range(A, B+1):
     if i % K == 0:
         print('OK')
-    else:
-        print('NG')
+        break
+else:
+    print(ans)
Buggy program (verdict: Wrong Answer):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
flg = 'War'
for i in range(X, Y+1):
	if max(x) < i and i <= min(y):
		flg = 'No ' + flg
		break
print(flg)

Failing test case input:
5 3 6 8
-10 4 0 5 -100
101 6 14

Expected output:
War


Actual output:
No War


Fixed program (verdict: Accepted):
N, M, X, Y = map(int, input().split())
x = list(map(int, input().split()))
y = list(map(int, input().split()))
flg = 'War'
for i in range(X+1, Y+1):
	if max(x) < i and i <= min(y):
		flg = 'No ' + flg
		break
print(flg)

Diff:
 N, M, X, Y = map(int, input().split())
 x = list(map(int, input().split()))
 y = list(map(int, input().split()))
 flg = 'War'
-for i in range(X, Y+1):
+for i in range(X+1, Y+1):
 	if max(x) < i and i <= min(y):
 		flg = 'No ' + flg
 		break
 print(flg)
Buggy program (verdict: Wrong Answer):
A,op,B = [str(i) for i in input().split()]

if op == '+':
    ans = int(A)+int(B)
else:
    ans =int(A)-int(B)
    
    print(ans)

Failing test case input:
0 + 55

Expected output:
55


Actual output:

Fixed program (verdict: Accepted):
A,op,B = [str(i) for i in input().split()]

if op == '+':
    ans = int(A)+int(B)
else:
    ans =int(A)-int(B)
    
print(ans)

Diff:
 A,op,B = [str(i) for i in input().split()]
 
 if op == '+':
     ans = int(A)+int(B)
 else:
     ans =int(A)-int(B)
     
-    print(ans)
+print(ans)
Buggy program (verdict: Wrong Answer):
a=[list(map(int,input().split()))for i in range(3)]
cnt=[0,0,0,0]
for i in range(3):
    cnt[a[i][0]-1]+=1
    cnt[a[i][1]-1]+=1
flag=False
for i in range(3):
    if cnt[i]==3:
        flag=True
print("NO") if flag else print("YES")

Failing test case input:
1 2
4 4
4 3

Expected output:
NO


Actual output:
YES


Fixed program (verdict: Accepted):
a=[list(map(int,input().split()))for i in range(3)]
cnt=[0,0,0,0]
for i in range(3):
    cnt[a[i][0]-1]+=1
    cnt[a[i][1]-1]+=1
flag=False
for i in range(4):
    if cnt[i]==3:
        flag=True
print("NO") if flag else print("YES")

Diff:
 a=[list(map(int,input().split()))for i in range(3)]
 cnt=[0,0,0,0]
 for i in range(3):
     cnt[a[i][0]-1]+=1
     cnt[a[i][1]-1]+=1
 flag=False
-for i in range(3):
+for i in range(4):
     if cnt[i]==3:
         flag=True
 print("NO") if flag else print("YES")