ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
n = int(input())
mod = 10**9+7

def pow(n, num):
  s = num
  for i in range(1,num):
    s = s*num%mod
    return s
print((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)

Failing test case input:
16756

Expected output:
461790329


Actual output:
2


Fixed program (verdict: Accepted):
n = int(input())
mod = 10**9+7

def pow(n, num):
  s = num
  for i in range(1,n):
    s = s*num%mod
  return s
print((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)


Diff:
 n = int(input())
 mod = 10**9+7
 
 def pow(n, num):
   s = num
-  for i in range(1,num):
+  for i in range(1,n):
     s = s*num%mod
-    return s
+  return s
 print((pow(n,10) - 2*pow(n,9) + pow(n,8))%mod)
+
Buggy program (verdict: Wrong Answer):
a=sorted(list(map(int,input().split())))
if (a[0]*a[1]*a[2])%2==0:
    print('0')
else:
    print(a[0]+a[1])

Failing test case input:
3 1 7

Expected output:
3


Actual output:
4


Fixed program (verdict: Accepted):
a=sorted(list(map(int,input().split())))
if (a[0]*a[1]*a[2])%2==0:
    print('0')
else:
    print(a[0]*a[1])

Diff:
 a=sorted(list(map(int,input().split())))
 if (a[0]*a[1]*a[2])%2==0:
     print('0')
 else:
-    print(a[0]+a[1])
+    print(a[0]*a[1])
Buggy program (verdict: Wrong Answer):
a = input()
count = 0



list_before = []
list_after = []
for i in a:
	if count < len(a)/2:
		list_before.append(i)
	else:
		list_after.append(i)
	count += 1

l = int(len(a)/2)
count = 0
if len(list_before)-len(list_after) == 1:
	for i in range(l-1):
		if list_before[i] != list_after[l-1 - i]:
			
			count += 1
else: 
	for i in range(l):
		if list_before[i] != list_after[l-1 - i]:
			
			count += 1
		

print(count)


Failing test case input:
dbb``bd

Expected output:
1


Actual output:
0


Fixed program (verdict: Accepted):
a = input()
count = 0



list_before = []
list_after = []
for i in a:
	if count < len(a)/2:
		list_before.append(i)
	else:
		list_after.append(i)
	count += 1




l = int(len(a)/2)
count = 0
if len(list_before)-len(list_after) == 1:
	for i in range(l):
		if list_before[i] != list_after[l-1 - i]:
			list_before[i] = list_after[l-1 - i]
			count += 1
else: 
	for i in range(l):
		if list_before[i] != list_after[l-1 - i]:
			list_before[i] = list_after[l-1 - i]
			count += 1
		



print(count)

Diff:
 a = input()
 count = 0
 
 
 
 list_before = []
 list_after = []
 for i in a:
 	if count < len(a)/2:
 		list_before.append(i)
 	else:
 		list_after.append(i)
 	count += 1
 
+
+
+
 l = int(len(a)/2)
 count = 0
 if len(list_before)-len(list_after) == 1:
-	for i in range(l-1):
+	for i in range(l):
 		if list_before[i] != list_after[l-1 - i]:
-			
+			list_before[i] = list_after[l-1 - i]
 			count += 1
 else: 
 	for i in range(l):
 		if list_before[i] != list_after[l-1 - i]:
-			
+			list_before[i] = list_after[l-1 - i]
 			count += 1
 		
 
-print(count)
 
+
+print(count)
Buggy program (verdict: Wrong Answer):
c = [list(map(int, input().split())) for _ in range(3)]

a2 = c[1][0] - c[0][0]
a3 = c[2][0] - c[0][0]

if any(c[1][x] != a2 + c[1][x] for x in [1, 2]) or any(c[2][x] != a3 + c[1][x] for x in [1, 2]):
	print('No')
else:
	print('Yes')


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

Expected output:
Yes

Actual output:
No


Fixed program (verdict: Accepted):
c = [list(map(int, input().split())) for _ in range(3)]

a2 = c[1][0] - c[0][0]
a3 = c[2][0] - c[0][0]

if any(c[1][x] != a2 + c[0][x] for x in [1, 2]) or any(c[2][x] != a3 + c[0][x] for x in [1, 2]):
	print('No')
else:
	print('Yes')


Diff:
 c = [list(map(int, input().split())) for _ in range(3)]
 
 a2 = c[1][0] - c[0][0]
 a3 = c[2][0] - c[0][0]
 
-if any(c[1][x] != a2 + c[1][x] for x in [1, 2]) or any(c[2][x] != a3 + c[1][x] for x in [1, 2]):
+if any(c[1][x] != a2 + c[0][x] for x in [1, 2]) or any(c[2][x] != a3 + c[0][x] for x in [1, 2]):
 	print('No')
 else:
 	print('Yes')
Buggy program (verdict: Wrong Answer):
n, a, b = map(int, input().split())

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

Failing test case input:
56 -1 -2

Expected output:
-56


Actual output:
-2


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

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

Diff:
 n, a, b = map(int, input().split())
 
 if (n*a) > b:
-    print(n*a)
-else:
     print(b)
+else:
+    print(n*a)
Buggy program (verdict: Wrong Answer):
x1,y1,x2,y2 = map(int,input().rstrip().split())
xx = x2-x1
yy = abs(y2-y1)
print(x2-yy,y2+xx,end=" ")
print(x2-yy-xx,y2+xx-yy)

Failing test case input:
0 22 8 2

Expected output:
28 10 20 30


Actual output:
-12 10 -20 -10


Fixed program (verdict: Accepted):
x1,y1,x2,y2 = map(int,input().rstrip().split())
xx = x2-x1
yy = y2-y1
print(x2-yy,y2+xx,end=" ")
print(x2-yy-xx,y2+xx-yy)


Diff:
 x1,y1,x2,y2 = map(int,input().rstrip().split())
 xx = x2-x1
-yy = abs(y2-y1)
+yy = y2-y1
 print(x2-yy,y2+xx,end=" ")
 print(x2-yy-xx,y2+xx-yy)
+
Buggy program (verdict: Wrong Answer):
s = str(input())
flag = 0
flag2 = 0
if s[0] == 'A':
    for i in range(2,len(s)-2):
        if s[i] == 'C':
            flag += 1
    for i in range(1,len(s)):
        if s[i] == s[i].upper():
            flag2 += 1
print(flag,flag2)
if flag == 1 and flag2 == 1:
    print("AC")
else:
    print("WA")

Failing test case input:
ddCAps

Expected output:
WA


Actual output:
0 0
WA


Fixed program (verdict: Accepted):
s = str(input())
flag = 0
flag2 = 0
if s[0] == 'A':
    for i in range(2,len(s)-1):
        if s[i] == 'C':
            flag += 1
    for i in range(1,len(s)):
        if s[i] == s[i].upper():
            flag2 += 1

if flag == 1 and flag2 == 1:
    print("AC")
else:
    print("WA")

Diff:
 s = str(input())
 flag = 0
 flag2 = 0
 if s[0] == 'A':
-    for i in range(2,len(s)-2):
+    for i in range(2,len(s)-1):
         if s[i] == 'C':
             flag += 1
     for i in range(1,len(s)):
         if s[i] == s[i].upper():
             flag2 += 1
-print(flag,flag2)
+
 if flag == 1 and flag2 == 1:
     print("AC")
 else:
     print("WA")
Buggy program (verdict: Wrong Answer):
c = [list(map(int, input().split())) for _ in range(3)]
for i in range(3):
  if c[i][0] - c[i][1] == c[i][1] - c[i][2] == c[i][2] - c[i][0]:
    print('No')
    quit()
print('Yes')

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

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
c = [list(map(int, input().split())) for _ in range(3)]
for i in range(2):
  if not (c[i][0] - c[i + 1][0] == c[i][1] - c[i + 1][1] == c[i][2] - c[i + 1][2] and
          c[0][i] - c[0][i + 1] == c[1][i] - c[1][i + 1] == c[2][i] - c[2][i + 1]):
    print('No')
    quit()
print('Yes')

Diff:
 c = [list(map(int, input().split())) for _ in range(3)]
-for i in range(3):
-  if c[i][0] - c[i][1] == c[i][1] - c[i][2] == c[i][2] - c[i][0]:
+for i in range(2):
+  if not (c[i][0] - c[i + 1][0] == c[i][1] - c[i + 1][1] == c[i][2] - c[i + 1][2] and
+          c[0][i] - c[0][i + 1] == c[1][i] - c[1][i + 1] == c[2][i] - c[2][i + 1]):
     print('No')
     quit()
 print('Yes')
Buggy program (verdict: Wrong Answer):

d = {"h":0, "i":0}
S = input()
if len(S) == 1:
    print("No")
    exit()
flag = True
for i in range(len(S)-1):
    if S[i:i+2] != "hi":
        flag = False
        break
print("Yes" if flag else "No")

Failing test case input:
hihi

Expected output:
Yes

Actual output:
No


Fixed program (verdict: Accepted):

d = {"h":0, "i":0}
S = input()
if len(S) % 2 == 1:
    print("No")
    exit()
flag = True
for i in range(0, len(S)-1, 2):
    if S[i:i+2] != "hi":
        flag = False
        break
print("Yes" if flag else "No")

Diff:
 
 d = {"h":0, "i":0}
 S = input()
-if len(S) == 1:
+if len(S) % 2 == 1:
     print("No")
     exit()
 flag = True
-for i in range(len(S)-1):
+for i in range(0, len(S)-1, 2):
     if S[i:i+2] != "hi":
         flag = False
         break
 print("Yes" if flag else "No")
Buggy program (verdict: Wrong Answer):
N, M, X, Y = map(int,input().split())
x1 = map(int,input().split())
x2 = map(int,input().split())

x1_max = max(x1)
x2_min = min(x2)

if x1_max <= x2_min and X <= Y and x2_min > X and x1_max < Y:   
    print("No War")
else:
    print("War")

Failing test case input:
3 2 10 40
8 11 9
16 11

Expected output:
War


Actual output:
No War


Fixed program (verdict: Accepted):
N, M, X, Y = map(int,input().split())
x1 = map(int,input().split())
x2 = map(int,input().split())

if max(X,max(x1)) < min(Y,min(x2)):   
    print("No War")
else:
    print("War")

Diff:
 N, M, X, Y = map(int,input().split())
 x1 = map(int,input().split())
 x2 = map(int,input().split())
 
-x1_max = max(x1)
-x2_min = min(x2)
-
-if x1_max <= x2_min and X <= Y and x2_min > X and x1_max < Y:   
+if max(X,max(x1)) < min(Y,min(x2)):   
     print("No War")
 else:
     print("War")
Buggy program (verdict: Wrong Answer):


N, K = map(int, input().split())



y = abs(N - K)
N = y
y2 = abs(N - K)
c=1
dif = (y, y2)

if dif[c-1] <= dif[c]:
    print(dif[-1])
    
if dif[c-1] > K:

    dif += (dif[c-1]-(dif[c-1]-K),)

while dif[c-1] > dif[c]:

    yy = abs(dif[c] - K)
    dif += (yy,)
    c += 1


print(min(dif))
    
    

Failing test case input:
36 53

Expected output:
17


Actual output:
36
17


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



y = abs(N - K)
N = y
y2 = abs(N - K)
c=1
dif = (y, y2)

if dif[c-1] < dif[c]:
    dif += (dif[-1],)
    
if dif[c-1] > K:

    dif += (dif[c-1]%K,)
    c += 1

while dif[c-1] > dif[c]:

    yy = abs(dif[c] - K)
    dif += (yy,)
    c += 1


print(min(dif))
    

Diff:
-
-
 N, K = map(int, input().split())
 
 
 
 y = abs(N - K)
 N = y
 y2 = abs(N - K)
 c=1
 dif = (y, y2)
 
-if dif[c-1] <= dif[c]:
-    print(dif[-1])
+if dif[c-1] < dif[c]:
+    dif += (dif[-1],)
     
 if dif[c-1] > K:
 
-    dif += (dif[c-1]-(dif[c-1]-K),)
+    dif += (dif[c-1]%K,)
+    c += 1
 
 while dif[c-1] > dif[c]:
 
     yy = abs(dif[c] - K)
     dif += (yy,)
     c += 1
 
 
 print(min(dif))
     
-
Buggy program (verdict: Wrong Answer):
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(1,t):
		if t%i==0:
			break
	else:
		c+=1
print(c)

Failing test case input:
5
4
3
7
5
6

Expected output:
3


Actual output:
0


Fixed program (verdict: Accepted):
import math
c = 0
n = int(input())
for _ in range(n):
	t = int(input())
	for i in range(2,int(math.sqrt(t)+1)):
		if t%i==0:
			break
	else:
		c+=1
print(c)

Diff:
+import math
 c = 0
 n = int(input())
 for _ in range(n):
 	t = int(input())
-	for i in range(1,t):
+	for i in range(2,int(math.sqrt(t)+1)):
 		if t%i==0:
 			break
 	else:
 		c+=1
 print(c)
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
if abs(a-b)==1:
    print("IMPOSSIBLE")
else:
    print(int((a+b)/2))

Failing test case input:
899758294 99824435

Expected output:
IMPOSSIBLE


Actual output:
499791364


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

Diff:
 a,b=map(int,input().split())
-if abs(a-b)==1:
+if abs(a-b)%2==1:
     print("IMPOSSIBLE")
 else:
     print(int((a+b)/2))
Buggy program (verdict: Wrong Answer):
A, B, C, K = map(int, input().split()) 

if A + B >= K:
    print(K)
else:
    print(A - (K - (A + B)))


Failing test case input:
0 6 8 6

Expected output:
0


Actual output:
6


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

if A >= K:
    print(K)
elif A + B >= K:
    print(K - (K - A))
else:
    print(A - (K - (A + B)))


Diff:
 A, B, C, K = map(int, input().split()) 
 
-if A + B >= K:
+if A >= K:
     print(K)
+elif A + B >= K:
+    print(K - (K - A))
 else:
     print(A - (K - (A + B)))
Buggy program (verdict: Wrong Answer):
w, a, b = map(int, input().split())

if a + w < b:
  ans = b - (a + w)
elif a > b + w:
  ans = a - (b + w)
else:
  ans = 0

Failing test case input:
3 -88 -1

Expected output:
84


Actual output:

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

if a + w < b:
  ans = b - (a + w)
elif a > b + w:
  ans = a - (b + w)
else:
  ans = 0
  
print(ans)

Diff:
 w, a, b = map(int, input().split())
 
 if a + w < b:
   ans = b - (a + w)
 elif a > b + w:
   ans = a - (b + w)
 else:
   ans = 0
+  
+print(ans)
Buggy program (verdict: Wrong Answer):
m = 0
f = 0
r = 0

while(True):
    I = input().split()
    m = int(I[0])
    f = int(I[1])
    r = int(I[2])
    if m == -1 and f == -1 and r == -1:
        break
    score = m + f
    if score >= 80:
        print('A')
    if 65 <= score and score < 80:
        print('B')
    if 50 <= score and score < 65:
        print('C')
    if 30 <= score and score < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    if score < 30:
        print('F')

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed program (verdict: Accepted):
m = 0
f = 0
r = 0

while(True):
    I = input().split()
    m = int(I[0])
    f = int(I[1])
    r = int(I[2])
    if m == -1 and f == -1 and r == -1:
        break
    score = m + f
    if m == -1 or f == -1:
        print('F')
        continue
    if score >= 80:
        print('A')
    if 65 <= score and score < 80:
        print('B')
    if 50 <= score and score < 65:
        print('C')
    if 30 <= score and score < 50:
        if r >= 50:
            print('C')
        else:
            print('D')
    if score < 30:
        print('F')

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

if s in t and  0<=len(s)<=10 and len(t)==len(s)+1 :
    
    print('Yes')
else:
    print('No')

Failing test case input:
a
ea

Expected output:
No


Actual output:
Yes


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

if t[0:len(s)]==s and  0<=len(s)<=10 and len(t)==len(s)+1 and s in t:
    
    print('Yes')
else:
    print('No')

Diff:
 s =input()
 t =input()
 
-if s in t and  0<=len(s)<=10 and len(t)==len(s)+1 :
+if t[0:len(s)]==s and  0<=len(s)<=10 and len(t)==len(s)+1 and s in t:
     
     print('Yes')
 else:
     print('No')
Buggy program (verdict: Wrong Answer):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i <= len(S)-1 and j <= len(S)-1:
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)


Failing test case input:
bxbbx

Expected output:
2


Actual output:
3


Fixed program (verdict: Accepted):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i+j < len(S)-1 and i <= len(S)-1 and j <= len(S)-1 :
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)


Diff:
 S = list(input())
 invS = []
 for s in reversed(S):
     invS.append(s)
 cnt = 0
 loop = 0
 i,j = 0,0
-while i <= len(S)-1 and j <= len(S)-1:
+while i+j < len(S)-1 and i <= len(S)-1 and j <= len(S)-1 :
     if S[i] == invS[j]:
         i += 1
         j += 1
     elif S[i] == "x":
         cnt += 1
         i += 1
     elif invS[j] == "x":
         cnt += 1
         j += 1
     else:
         cnt = -1
         break
 print(cnt)
Buggy program (verdict: Wrong Answer):
N = int(input())
S = input()
n = len(S)
ans = ''
for i in range(n):
    a = ord(S[i])-97+N
    if a >= 26:
        a = a - 26
    a += 97
    b = chr(a)
    ans += b
print(ans)


Failing test case input:
2
ACXBXZ

Expected output:
CEZDZB


Actual output:
CEZDZ\


Fixed program (verdict: Accepted):
N = int(input())
S = input()
n = len(S)
ans = ''
for i in range(n):
    a = (ord(S[i])-65+N)%26
    a += 65
    b = chr(a)
    ans += b
print(ans)

Diff:
 N = int(input())
 S = input()
 n = len(S)
 ans = ''
 for i in range(n):
-    a = ord(S[i])-97+N
-    if a >= 26:
-        a = a - 26
-    a += 97
+    a = (ord(S[i])-65+N)%26
+    a += 65
     b = chr(a)
     ans += b
 print(ans)
-
Buggy program (verdict: Wrong Answer):
if __name__ == '__main__':
    N = int(input())
    A = sorted({i: int(input()) for i in range(N)}.items(), key=lambda x: x[1])
    print(A)
    for index in range(N):
        if not A[-1][0] == index:
            print(A[-1][1])
        else:
            print(A[-2][1])
            
                

Failing test case input:
3
1
4
3

Expected output:
4
3
4

Actual output:
[(0, 1), (2, 3), (1, 4)]
4
3
4


Fixed program (verdict: Accepted):
if __name__ == '__main__':
    N = int(input())
    A = sorted({i: int(input()) for i in range(N)}.items(), key=lambda x: x[1])
    for index in range(N):
        if not A[-1][0] == index:
            print(A[-1][1])
        else:
            print(A[-2][1])
            
                

Diff:
 if __name__ == '__main__':
     N = int(input())
     A = sorted({i: int(input()) for i in range(N)}.items(), key=lambda x: x[1])
-    print(A)
     for index in range(N):
         if not A[-1][0] == index:
             print(A[-1][1])
         else:
             print(A[-2][1])
Buggy program (verdict: Wrong Answer):
n, m = list(map(int, input().split()))
ac = set()
wa = 0
for i in range(m):
  p, s = input().split()
  p = int(p)
  if p in ac:
    continue
  if s == 'WA':
    wa += 1
  else:
    ac.add(p)
print("%d %d" % (len(ac), wa))

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed program (verdict: Accepted):
n, m = list(map(int, input().split()))
ac = set()
wa = {}
for i in range(m):
  p, s = input().split()
  p = int(p)
  if p in ac:
    continue
  if s == 'WA':
    wa[p] = wa.get(p, 0) + 1
  else:
    ac.add(p)
pe = 0
for p in set(ac) & set(wa.keys()):
    pe += wa[p]
print("%d %d" % (len(ac), pe))

Diff:
 n, m = list(map(int, input().split()))
 ac = set()
-wa = 0
+wa = {}
 for i in range(m):
   p, s = input().split()
   p = int(p)
   if p in ac:
     continue
   if s == 'WA':
-    wa += 1
+    wa[p] = wa.get(p, 0) + 1
   else:
     ac.add(p)
-print("%d %d" % (len(ac), wa))
+pe = 0
+for p in set(ac) & set(wa.keys()):
+    pe += wa[p]
+print("%d %d" % (len(ac), pe))
Buggy program (verdict: Wrong Answer):
s = list(input())
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A':
        a = i+1
        break
for i in range(1, len(s)):
    if s[-i] == 'Z':
        z = len(s)-i+1
print(z-a+1)

Failing test case input:
HASFJGHOGAKZZFEGA

Expected output:
12

Actual output:
11


Fixed program (verdict: Accepted):
s = list(input())
a = 0
z = 0
for i in range(len(s)):
    if s[i] == 'A':
        a = i+1
        break
for i in range(1, len(s)):
    if s[-i] == 'Z':
        z = len(s)-i+1
        break
print(z-a+1)

Diff:
 s = list(input())
 a = 0
 z = 0
 for i in range(len(s)):
     if s[i] == 'A':
         a = i+1
         break
 for i in range(1, len(s)):
     if s[-i] == 'Z':
         z = len(s)-i+1
+        break
 print(z-a+1)
Buggy program (verdict: Wrong Answer):
import math
n=int(input())
if int(math.ceil(n/1.08)*1.08)==n:
    print(math.ceil(n/1.08))
else:
    print(":()")

Failing test case input:
1079

Expected output:
:(

Actual output:
:()


Fixed program (verdict: Accepted):
import math
n=int(input())
if int(math.ceil(n/1.08)*1.08)==n:
    print(math.ceil(n/1.08))
else:
    print(":(")

Diff:
 import math
 n=int(input())
 if int(math.ceil(n/1.08)*1.08)==n:
     print(math.ceil(n/1.08))
 else:
-    print(":()")
+    print(":(")
Buggy program (verdict: Wrong Answer):
list = list(map(int,input().split()))

x=list[0]
a=list[1]
b=list[2]

if a>x:
    s=a-x
else:
    s=x-a

if b>x:
    t=b-x
else:
    t=x-b
    
if s<t:
    print('B')
else:
    print('A')

Failing test case input:
0 25 0011

Expected output:
B


Actual output:
A


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

x=list[0]
a=list[1]
b=list[2]

if a>x:
    s=a-x
else:
    s=x-a

if b>x:
    t=b-x
else:
    t=x-b
    
if s<t:
    print('A')
else:
    print('B')

Diff:
 list = list(map(int,input().split()))
 
 x=list[0]
 a=list[1]
 b=list[2]
 
 if a>x:
     s=a-x
 else:
     s=x-a
 
 if b>x:
     t=b-x
 else:
     t=x-b
     
 if s<t:
-    print('B')
-else:
     print('A')
+else:
+    print('B')
Buggy program (verdict: Wrong Answer):
rotate = lambda x,y: x[-y:] + x[:-y]
S = input()
S = "??2??5"
mod = 13
amari = 5
dp_tmp = [0]*13
dp_tmp[0] = 1
mul = 1
for s in S[::-1]:
    dp = [0]*13
    if s == "?":
        for n in range(10):
            dp_tmp_roll = rotate(dp_tmp,n*mul%mod)
            for k in range(13):
                dp[k] += dp_tmp_roll[k]
    else:
        dp_tmp_roll = rotate(dp_tmp,int(s)*mul%mod)
        for k in range(13):
            dp[k] += dp_tmp_roll[k]
    for n in range(13):
        dp[n] = dp[n]%(10**9+7)
    dp_tmp = dp
    mul = mul*10%13
print(dp[amari])


Failing test case input:
?6?426??8??29?06233????9??3???7258??5??7???????774????4?1??17?????5?70???8????

Expected output:
153716913


Actual output:
768


Fixed program (verdict: Accepted):
rotate = lambda x,y: x[-y:] + x[:-y]
S = input()
mod = 13
amari = 5
dp_tmp = [0]*13
dp_tmp[0] = 1
mul = 1
for s in S[::-1]:
    dp = [0]*13
    if s == "?":
        for n in range(10):
            dp_tmp_roll = rotate(dp_tmp,n*mul%mod)
            for k in range(13):
                dp[k] += dp_tmp_roll[k]
    else:
        dp_tmp_roll = rotate(dp_tmp,int(s)*mul%mod)
        for k in range(13):
            dp[k] += dp_tmp_roll[k]
    for n in range(13):
        dp[n] = dp[n]%(10**9+7)
    dp_tmp = dp
    mul = mul*10%13
print(dp[amari])


Diff:
 rotate = lambda x,y: x[-y:] + x[:-y]
 S = input()
-S = "??2??5"
 mod = 13
 amari = 5
 dp_tmp = [0]*13
 dp_tmp[0] = 1
 mul = 1
 for s in S[::-1]:
     dp = [0]*13
     if s == "?":
         for n in range(10):
             dp_tmp_roll = rotate(dp_tmp,n*mul%mod)
             for k in range(13):
                 dp[k] += dp_tmp_roll[k]
     else:
         dp_tmp_roll = rotate(dp_tmp,int(s)*mul%mod)
         for k in range(13):
             dp[k] += dp_tmp_roll[k]
     for n in range(13):
         dp[n] = dp[n]%(10**9+7)
     dp_tmp = dp
     mul = mul*10%13
 print(dp[amari])
Buggy program (verdict: Wrong Answer):

a_n, b_n, m = map(int, input().split())
a = input().split()
b = input().split()
x = [input().split() for i in range(m)]


min_price = 200000
for p in x:
   tmp_price = int(a[int(p[0])-1]) + int(b[int(p[1])-1]) - int(p[2])
   if tmp_price < min_price:
       min_price = tmp_price
print(min_price)       

Failing test case input:
2 4 0
1 6
3 9 0
1 2 1

Expected output:
1


Actual output:
200000


Fixed program (verdict: Accepted):

a_n, b_n, m = map(int, input().split())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
x = [input().split() for i in range(m)]


min_price = min(a) + min(b)
for p in x:
   tmp_price = int(a[int(p[0])-1]) + int(b[int(p[1])-1]) - int(p[2])
   if tmp_price < min_price:
       min_price = tmp_price
print(min_price)       

Diff:
 
 a_n, b_n, m = map(int, input().split())
-a = input().split()
-b = input().split()
+a = list(map(int, input().split()))
+b = list(map(int, input().split()))
 x = [input().split() for i in range(m)]
 
 
-min_price = 200000
+min_price = min(a) + min(b)
 for p in x:
    tmp_price = int(a[int(p[0])-1]) + int(b[int(p[1])-1]) - int(p[2])
    if tmp_price < min_price:
        min_price = tmp_price
 print(min_price)
Buggy program (verdict: Wrong Answer):
import math
N, M = map(int, input().split())
judge = [0]*10**5
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    wa += 1
print(ac,wa)

Failing test case input:
5 5
1 WA
1 AC
0 WA
2 AC
2 WA

Expected output:
2 1


Actual output:
2 2


Fixed program (verdict: Accepted):
import math
N, M = map(int, input().split())
judge = [0]*N
ac = 0
wa = 0
for i in range(M):
  p, S = input().split()
  if judge[int(p)-1] == 'AC':
    pass
  elif S == 'AC':
    wa += judge[int(p)-1]
    judge[int(p)-1] = 'AC'
    ac += 1
  else:
    judge[int(p)-1] += 1
print(ac,wa)

Diff:
 import math
 N, M = map(int, input().split())
-judge = [0]*10**5
+judge = [0]*N
 ac = 0
 wa = 0
 for i in range(M):
   p, S = input().split()
   if judge[int(p)-1] == 'AC':
     pass
   elif S == 'AC':
+    wa += judge[int(p)-1]
     judge[int(p)-1] = 'AC'
     ac += 1
   else:
-    wa += 1
+    judge[int(p)-1] += 1
 print(ac,wa)
Buggy program (verdict: Wrong Answer):
N,M = map(int, input().split())
d = ['x']*N

flg = 0
for i in range(M):
  s,c = map(int, input().split())
  s -= 1
  if d[s] == 'x':
    d[s] = c
  if d[s] != c or (s==0 and c==0 and N>1):
    flg = -1

ans = 0
for j in range(N):
  N-=1
  if d[j]=='x':
    if j == 0:
      d[j] = 1
    else:
      d[j] = 0
  ans += d[j]*(10**N)

print(flg if flg == -1 else ans)

Failing test case input:
1 0
0 0
2 3

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
N,M = map(int, input().split())
d = ['x']*N

flg = 0
for i in range(M):
  s,c = map(int, input().split())
  s -= 1
  if d[s] == 'x':
    d[s] = c
  if d[s] != c or (s==0 and c==0 and N>1):
    flg = -1

ans = 0
for j in range(N):
  N-=1
  if d[j]=='x':
    if j == 0 and N>0:
      d[j] = 1
    else:
      d[j] = 0
  ans += d[j]*(10**N)

print(flg if flg == -1 else ans)

Diff:
 N,M = map(int, input().split())
 d = ['x']*N
 
 flg = 0
 for i in range(M):
   s,c = map(int, input().split())
   s -= 1
   if d[s] == 'x':
     d[s] = c
   if d[s] != c or (s==0 and c==0 and N>1):
     flg = -1
 
 ans = 0
 for j in range(N):
   N-=1
   if d[j]=='x':
-    if j == 0:
+    if j == 0 and N>0:
       d[j] = 1
     else:
       d[j] = 0
   ans += d[j]*(10**N)
 
 print(flg if flg == -1 else ans)
Buggy program (verdict: Wrong Answer):
A, B = map(int, input().split())
S = input()
flag = False
for i in range(len(S)):
    if i == A:
        if S[i]=="-":
            flag = True
        else:
            flag = False
    else:
        if S[i]=="-":
            flag = False
print("Yes") if flag else print("No")

Failing test case input:
2 -1
-+-

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
A, B = map(int, input().split())
S = input()
flag = False
for i in range(len(S)):
    if i == A:
        if S[i]=="-":
            flag = True
    else:
        if S[i]=="-":
            flag = False
            break
print("Yes")if flag else print("No")

Diff:
 A, B = map(int, input().split())
 S = input()
 flag = False
 for i in range(len(S)):
     if i == A:
         if S[i]=="-":
             flag = True
-        else:
-            flag = False
     else:
         if S[i]=="-":
             flag = False
-print("Yes") if flag else print("No")
+            break
+print("Yes")if flag else print("No")
Buggy program (verdict: Wrong Answer):
n=int(input())
a=[0]+list(map(int,input().split()))
ans=0
for i in range(1,n+1):
  if a[a[i]]==i:
    ans+=1
print(ans)

Failing test case input:
5
5 1 5 5 1

Expected output:
1


Actual output:
2


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

Diff:
 n=int(input())
 a=[0]+list(map(int,input().split()))
 ans=0
 for i in range(1,n+1):
   if a[a[i]]==i:
     ans+=1
-print(ans)
+print(ans
Buggy program (verdict: Wrong Answer):
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  if i % 2 == 0:
    a = list(map(int, input().split()))
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))


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

Expected output:
2


Actual output:
1


Fixed program (verdict: Accepted):
n,k = list(map(int, input().split()))
hoge = [1] * n

for i in range(k * 2):
  a = list(map(int, input().split()))
  if i % 2 != 0:
    for j in a:
      hoge[j - 1] = 0
      
print(sum(hoge))

Diff:
 n,k = list(map(int, input().split()))
 hoge = [1] * n
 
 for i in range(k * 2):
-  if i % 2 == 0:
-    a = list(map(int, input().split()))
+  a = list(map(int, input().split()))
+  if i % 2 != 0:
     for j in a:
       hoge[j - 1] = 0
       
 print(sum(hoge))
-
Buggy program (verdict: Wrong Answer):
from collections import defaultdict
N, K = map(int,input().split())
A = list(map(int,input().split()))
D = defaultdict(int)
for a in A:
  D[a]+=1
D = sorted(D.values())
ans = 0
if len(D)<=K:
  print(ans)
else:
    print(sum(D[:K]))

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

Expected output:
3


Actual output:
5


Fixed program (verdict: Accepted):
from collections import defaultdict
N, K = map(int,input().split())
A = list(map(int,input().split()))
D = defaultdict(int)
for a in A:
  D[a]+=1
D = sorted(D.values())
ans = 0
if len(D)<=K:
  print(ans)
else:
    print(sum(D[:len(D)-K]))

Diff:
 from collections import defaultdict
 N, K = map(int,input().split())
 A = list(map(int,input().split()))
 D = defaultdict(int)
 for a in A:
   D[a]+=1
 D = sorted(D.values())
 ans = 0
 if len(D)<=K:
   print(ans)
 else:
-    print(sum(D[:K]))
+    print(sum(D[:len(D)-K]))
Buggy program (verdict: Wrong Answer):
S=input()

A=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=='<':
        A[i+1]=max(A[i+1],A[i]+1)
    
for i in range(len(S)-2,0,-1):
    if S[i]=='>':
        A[i]=max(A[i],A[i+1]+1)

print(sum(A))


Failing test case input:
><><><<<<<<<>>>>

Expected output:
37


Actual output:
33


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

A=[0]*(len(S)+1)
for i in range(len(S)):
    if S[i]=='<':
        A[i+1]=max(A[i+1],A[i]+1)
    
for i in range(len(S)-1,-1,-1):
    if S[i]=='>':
        A[i]=max(A[i],A[i+1]+1)

print(sum(A))


Diff:
 S=input()
 
 A=[0]*(len(S)+1)
 for i in range(len(S)):
     if S[i]=='<':
         A[i+1]=max(A[i+1],A[i]+1)
     
-for i in range(len(S)-2,0,-1):
+for i in range(len(S)-1,-1,-1):
     if S[i]=='>':
         A[i]=max(A[i],A[i+1]+1)
 
 print(sum(A))
Buggy program (verdict: Wrong Answer):
S = input()
d = int(S[0])
T = []
U = []
for i in range(len(S)):
  T.append(d)
  d = (d + 1) % 2
  U.append(d)
count1 = 0
count2 = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count1 += 1
  if S[i] != U[i]:
    count2 += 1
print(min(count1, count2))

  

Failing test case input:
01000101

Expected output:
1


Actual output:
8


Fixed program (verdict: Accepted):
S = input()
d = int(S[0])
T = []
U = []
for i in range(len(S)):
  T.append(d)
  d = (d + 1) % 2
  U.append(d)
count1 = 0
count2 = 0
for i in range(len(S)):
  if int(S[i]) != T[i]:
    count1 += 1
  if int(S[i]) != U[i]:
    count2 += 1
print(min(count1, count2))

  


Diff:
 S = input()
 d = int(S[0])
 T = []
 U = []
 for i in range(len(S)):
   T.append(d)
   d = (d + 1) % 2
   U.append(d)
 count1 = 0
 count2 = 0
 for i in range(len(S)):
-  if S[i] != T[i]:
+  if int(S[i]) != T[i]:
     count1 += 1
-  if S[i] != U[i]:
+  if int(S[i]) != U[i]:
     count2 += 1
 print(min(count1, count2))
 
   
+
Buggy program (verdict: Wrong Answer):
n = input()
d = len(n)

s = 0
for i in range(1, d):
    s += 9 * 10 ** (i - 1) if i % 2 else 0
s += int(n) - 10 ** (d - 1) if d % 2 else int(0)

print(s)

Failing test case input:
215

Expected output:
125


Actual output:
124


Fixed program (verdict: Accepted):
n = input()
d = len(n)

s = 0
for i in range(1, d):
    s += 9 * 10 ** (i - 1) if i % 2 else 0
s += int(n) - 10 ** (d - 1) + 1 if d % 2 else 0

print(s)

Diff:
 n = input()
 d = len(n)
 
 s = 0
 for i in range(1, d):
     s += 9 * 10 ** (i - 1) if i % 2 else 0
-s += int(n) - 10 ** (d - 1) if d % 2 else int(0)
+s += int(n) - 10 ** (d - 1) + 1 if d % 2 else 0
 
 print(s)
Buggy program (verdict: Wrong Answer):
A,B,M=map(int, input().split())
As=list(map(int, input().split()))
Bs=list(map(int, input().split()))
List=[]

ans=min(As)+min(Bs)
for i in As:
  for j in Bs:
    ans=min(ans, i+j)
for l in List:
  candidate=As[l[0]-1]+Bs[l[1]-1]-l[2]
  ans = min(ans, candidate)
print(ans)

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

Expected output:
10


Actual output:
20


Fixed program (verdict: Accepted):
A,B,M=map(int, input().split())
As=list(map(int, input().split()))
Bs=list(map(int, input().split()))
List=[]
for i in range(M):
  List.append(list(map(int, input().split())))

ans=min(As)+min(Bs)
for l in List:
  candidate=As[l[0]-1]+Bs[l[1]-1]-l[2]
  ans = min(ans, candidate)
print(ans)


Diff:
 A,B,M=map(int, input().split())
 As=list(map(int, input().split()))
 Bs=list(map(int, input().split()))
 List=[]
+for i in range(M):
+  List.append(list(map(int, input().split())))
 
 ans=min(As)+min(Bs)
-for i in As:
-  for j in Bs:
-    ans=min(ans, i+j)
 for l in List:
   candidate=As[l[0]-1]+Bs[l[1]-1]-l[2]
   ans = min(ans, candidate)
 print(ans)
+
Buggy program (verdict: Wrong Answer):
a,b,c = map(str,input().split())

ls = [a.capitalize(),b.capitalize(),c.capitalize()]
print("".join(ls))

Failing test case input:
sdpfcsa mgmefqfb tcoreqr

Expected output:
SMT


Actual output:
SdpfcsaMgmefqfbTcoreqr


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

ls = [a[0].upper(),b[0].upper(),c[0].upper()]
print("".join(ls))

Diff:
 a,b,c = map(str,input().split())
 
-ls = [a.capitalize(),b.capitalize(),c.capitalize()]
+ls = [a[0].upper(),b[0].upper(),c[0].upper()]
 print("".join(ls))
Buggy program (verdict: Wrong Answer):
import sys

alphabets = range(ord('a'), ord('z') + 1)
dic = { chr(c): 0 for c in alphabets }

text = sys.stdin.read()
for c in text:
  c = c.lower()
  if ord(c) in alphabets:
    dic[c] += 1

for item in sorted(dic.items()):
  print(*item)

Failing test case input:
Yhmf wi X rf*p

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


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


Fixed program (verdict: Accepted):
import sys

alphabets = range(ord('a'), ord('z') + 1)
dic = { chr(c): 0 for c in alphabets }

text = sys.stdin.read()
for c in text:
  c = c.lower()
  if ord(c) in alphabets:
    dic[c] += 1

for c, n in sorted(dic.items()):
  print(c, ":", n)

Diff:
 import sys
 
 alphabets = range(ord('a'), ord('z') + 1)
 dic = { chr(c): 0 for c in alphabets }
 
 text = sys.stdin.read()
 for c in text:
   c = c.lower()
   if ord(c) in alphabets:
     dic[c] += 1
 
-for item in sorted(dic.items()):
-  print(*item)
+for c, n in sorted(dic.items()):
+  print(c, ":", n)
Buggy program (verdict: Wrong Answer):
import bisect
n=int(input())
l=list(map(int,input().split()))
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)    
    


Failing test case input:
7
218 786 704 271 645 728 389

Expected output:
24


Actual output:
32


Fixed program (verdict: Accepted):
import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-1):
  for j in range(i+1,n):
    x=l[i]+l[j]
    y=bisect.bisect_left(l,x)-1
    ans+=max((y-j),0)
    
print(ans)    
    


Diff:
 import bisect
 n=int(input())
 l=list(map(int,input().split()))
+l.sort()
 ans=0
 for i in range(0,n-1):
   for j in range(i+1,n):
     x=l[i]+l[j]
     y=bisect.bisect_left(l,x)-1
     ans+=max((y-j),0)
     
 print(ans)
Buggy program (verdict: Wrong Answer):

a,b = [int(x) for x in input().split(" ")]
if a<b:
    tmp = a
    a = b
    b = a
print(str(b) * a)

Failing test case input:
10 40

Expected output:
10101010101010101010101010101010101010101010101010101010101010101010101010101010


Actual output:
40404040404040404040404040404040404040404040404040404040404040404040404040404040


Fixed program (verdict: Accepted):

a,b = [int(x) for x in input().split(" ")]
if a<b:
    tmp = a
    a = b
    b = tmp
print(str(b) * a)

Diff:
 
 a,b = [int(x) for x in input().split(" ")]
 if a<b:
     tmp = a
     a = b
-    b = a
+    b = tmp
 print(str(b) * a)
Buggy program (verdict: Wrong Answer):
a, b = map(int, input().split())
ans = 0
if ans < a+b: 
    ans = a+b
if ans < a-b: 
    ans = a-b
if ans < a*b:
    ans = a*b
print(ans)



Failing test case input:
-34 17

Expected output:
-17


Actual output:
0


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



Diff:
 a, b = map(int, input().split())
-ans = 0
+ans = -100000
 if ans < a+b: 
     ans = a+b
 if ans < a-b: 
     ans = a-b
 if ans < a*b:
     ans = a*b
 print(ans)
Buggy program (verdict: Wrong Answer):
import sys




def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = 0
    if d > b:
        if c < b:
            res = b - c
        else:
            res = 0
    if d < b:
        if c > a:
            res = d - c
        else:
            res = d - a
    print(res)


main()


Failing test case input:
-1 0 1 -1

Expected output:
0


Actual output:
-2


Fixed program (verdict: Accepted):
import sys




def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(input())


def read_str():
    return input()


def main():
    a, b, c, d = read_int_list()
    res = abs(max(a, c) - min(b, d))
    if c >= b or a >= d:
        res = 0
    print(res)


main()


Diff:
 import sys
 
 
 
 
 def read_int_list():
     return list(map(int, input().split()))
 
 
 def read_str_list():
     return input().split()
 
 
 def read_int():
     return int(input())
 
 
 def read_str():
     return input()
 
 
 def main():
     a, b, c, d = read_int_list()
-    res = 0
-    if d > b:
-        if c < b:
-            res = b - c
-        else:
-            res = 0
-    if d < b:
-        if c > a:
-            res = d - c
-        else:
-            res = d - a
+    res = abs(max(a, c) - min(b, d))
+    if c >= b or a >= d:
+        res = 0
     print(res)
 
 
 main()
Buggy program (verdict: Wrong Answer):
x = int(input())
while x<=0:
  x -=1000
print(abs(x))

Failing test case input:
699

Expected output:
301


Actual output:
699


Fixed program (verdict: Accepted):
x = int(input())
while x > 0:
    x -= 1000
print(abs(x))

Diff:
 x = int(input())
-while x<=0:
-  x -=1000
+while x > 0:
+    x -= 1000
 print(abs(x))
Buggy program (verdict: Wrong Answer):
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))




Hminus = list(map(lambda x: x*(-1), H))

heapify(Hminus)

if K > len(H):
    print(len(H))
else:
    for _ in range(K):
        heappop(Hminus)
    print(sum(Hminus)*(-1))

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

Expected output:
0

Actual output:
8


Fixed program (verdict: Accepted):
from heapq import heapify, heappop
from math import ceil
N, K = map(int, input().split())
H = list(map(int, input().split()))




Hminus = list(map(lambda x: x*(-1), H))

heapify(Hminus)

if K > len(H):
    print(0)
else:
    for _ in range(K):
        heappop(Hminus)
    print(sum(Hminus)*(-1))

Diff:
 from heapq import heapify, heappop
 from math import ceil
 N, K = map(int, input().split())
 H = list(map(int, input().split()))
 
 
 
 
 Hminus = list(map(lambda x: x*(-1), H))
 
 heapify(Hminus)
 
 if K > len(H):
-    print(len(H))
+    print(0)
 else:
     for _ in range(K):
         heappop(Hminus)
     print(sum(Hminus)*(-1))
Buggy program (verdict: Wrong Answer):
a = int(input())
sum = 0
for i in range(a):
    sum += a ** (i+1)
    if i == 2:
        break
print(int(sum))

Failing test case input:
-15

Expected output:
-3165


Actual output:
0


Fixed program (verdict: Accepted):
a = int(input())
sum = 0
for i in range(3):
    sum += a ** (i+1)
print(int(sum))

Diff:
 a = int(input())
 sum = 0
-for i in range(a):
+for i in range(3):
     sum += a ** (i+1)
-    if i == 2:
-        break
 print(int(sum))
Buggy program (verdict: Wrong Answer):
N, X = map(int, input().split())
x = [abs(X - int(i)) for i in input().split()]

def f(a, b):
    if b == 0:
        return a
    return f(b, a % b)

tmp = 0
for i in range(1, len(x)):
    tmp = f(x[i-1], x[i])

print(tmp)


Failing test case input:
1 2
1010000000

Expected output:
1009999998


Actual output:
0


Fixed program (verdict: Accepted):
N, X = map(int, input().split())
x = [abs(X - int(i)) for i in input().split()]

def f(a, b):
    if b == 0:
        return a
    return f(b, a % b)

tmp = 1
for i in range(len(x)-1):
    x[i+1] = f(x[i], x[i+1])

print(x[len(x)-1])


Diff:
 N, X = map(int, input().split())
 x = [abs(X - int(i)) for i in input().split()]
 
 def f(a, b):
     if b == 0:
         return a
     return f(b, a % b)
 
-tmp = 0
-for i in range(1, len(x)):
-    tmp = f(x[i-1], x[i])
+tmp = 1
+for i in range(len(x)-1):
+    x[i+1] = f(x[i], x[i+1])
 
-print(tmp)
+print(x[len(x)-1])
Buggy program (verdict: Wrong Answer):
w1 = input()
length = len(w1)
num_list = [-1]*(length+1)
c1 = 0
c2 = 0
for i in range(length):
    if i==0 and w1[i] == "<":
        num_list[0] = 0
    if i==(length-1) and w1[i] == ">":
        num_list[length] = 0
    if not i==length-1:
        if w1[i] == ">" and w1[i+1] =="<":
            num_list[i+1] = 0

    if(w1[i] == "<"):
        num_list[i+1] = num_list[i] + 1

for i in range(length-1,-1,-1):
    if (w1[i] == ">"):
        if(num_list[i] < num_list[i+1] + 1):
            num_list[i] = num_list[i+1] + 1

allsum = 0
print(num_list)
print(sum(num_list))





Failing test case input:
<<>>>>><<><<><<<

Expected output:
28


Actual output:
[0, 1, 5, 4, 3, 2, 1, 0, 1, 2, 0, 1, 2, 0, 1, 2, 3]
28


Fixed program (verdict: Accepted):
w1 = input()
length = len(w1)
num_list = [-1]*(length+1)
c1 = 0
c2 = 0
for i in range(length):
    if i==0 and w1[i] == "<":
        num_list[0] = 0
    if i==(length-1) and w1[i] == ">":
        num_list[length] = 0
    if not i==length-1:
        if w1[i] == ">" and w1[i+1] =="<":
            num_list[i+1] = 0

    if(w1[i] == "<"):
        num_list[i+1] = num_list[i] + 1

for i in range(length-1,-1,-1):
    if (w1[i] == ">"):
        if(num_list[i] < num_list[i+1] + 1):
            num_list[i] = num_list[i+1] + 1


print(sum(num_list))





Diff:
 w1 = input()
 length = len(w1)
 num_list = [-1]*(length+1)
 c1 = 0
 c2 = 0
 for i in range(length):
     if i==0 and w1[i] == "<":
         num_list[0] = 0
     if i==(length-1) and w1[i] == ">":
         num_list[length] = 0
     if not i==length-1:
         if w1[i] == ">" and w1[i+1] =="<":
             num_list[i+1] = 0
 
     if(w1[i] == "<"):
         num_list[i+1] = num_list[i] + 1
 
 for i in range(length-1,-1,-1):
     if (w1[i] == ">"):
         if(num_list[i] < num_list[i+1] + 1):
             num_list[i] = num_list[i+1] + 1
 
-allsum = 0
-print(num_list)
+
 print(sum(num_list))
Buggy program (verdict: Wrong Answer):
A, B, C, D = map(int, input().split())

ans = ''
for i in range(100):
    if i%2 == 1:
        C -= B
    else:
        A -= C
    if A <= 0:
        ans = 'No'
        break
    else:
        ans = 'Yes'
        break

print(ans)

Failing test case input:
2 14 3 12

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
A, B, C, D = map(int, input().split())

ans = ''
for i in range(200):
    if i%2 == 0:
        C -= B
    else:
        A -= D
    if A <= 0:
        ans = 'No'
        break
    elif C <= 0:
        ans = 'Yes'
        break

print(ans)

Diff:
 A, B, C, D = map(int, input().split())
 
 ans = ''
-for i in range(100):
-    if i%2 == 1:
+for i in range(200):
+    if i%2 == 0:
         C -= B
     else:
-        A -= C
+        A -= D
     if A <= 0:
         ans = 'No'
         break
-    else:
+    elif C <= 0:
         ans = 'Yes'
         break
 
 print(ans)
Buggy program (verdict: Wrong Answer):
while True:
    points = list(map(int,input().split()))

    if points == [-1,-1,-1]:
        break

    gou = points[0] + points[1]
    if gou >= 80:
        print("A")
    elif 65 <= gou < 80:
        print("B")
    elif 50 <= gou < 65:
        print("C")
    elif 30 <= gou < 50:
        if points[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Failing test case input:
86 -1 0
22 57 -1
0 2 -2
-1 -1 -1

Expected output:
F
B
F


Actual output:
A
B
F


Fixed program (verdict: Accepted):
while True:
    points = list(map(int,input().split()))

    if points == [-1,-1,-1]:
        break

    gou = points[0] + points[1]
    if points[0]==-1 or points[1]==-1:
        print("F")
    elif gou >= 80:
        print("A")
    elif 65 <= gou < 80:
        print("B")
    elif 50 <= gou < 65:
        print("C")
    elif 30 <= gou < 50:
        if points[2] >= 50:
            print("C")
        else:
            print("D")
    else:
        print("F")

Diff:
 while True:
     points = list(map(int,input().split()))
 
     if points == [-1,-1,-1]:
         break
 
     gou = points[0] + points[1]
-    if gou >= 80:
+    if points[0]==-1 or points[1]==-1:
+        print("F")
+    elif gou >= 80:
         print("A")
     elif 65 <= gou < 80:
         print("B")
     elif 50 <= gou < 65:
         print("C")
     elif 30 <= gou < 50:
         if points[2] >= 50:
             print("C")
         else:
             print("D")
     else:
         print("F")
Buggy program (verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(5)]

res = N 

print(res)


Failing test case input:
10
123
219
123
123
123

Expected output:
5


Actual output:
10


Fixed program (verdict: Accepted):
import math

N = int(input())
A = [int(input()) for _ in range(5)]

res = math.ceil(N / min(A)) + 4

print(res)


Diff:
+import math
+
 N = int(input())
 A = [int(input()) for _ in range(5)]
 
-res = N 
+res = math.ceil(N / min(A)) + 4
 
 print(res)
Buggy program (verdict: Wrong Answer):
k,n=map(int,input().split())
lista=list(map(int,input().split())) 
ans=[]
for i in range(1,n):
  ans.append(lista[i]-lista[i-1])
print(k-max(ans))

Failing test case input:
20 3
5 11 15

Expected output:
10


Actual output:
14


Fixed program (verdict: Accepted):
k,n=map(int,input().split())
lista=list(map(int,input().split())) 
lista.append(lista[0]+k)
ans=[]
for i in range(1,n+1):
  ans.append(lista[i]-lista[i-1])
print(k-max(ans))

Diff:
 k,n=map(int,input().split())
 lista=list(map(int,input().split())) 
+lista.append(lista[0]+k)
 ans=[]
-for i in range(1,n):
+for i in range(1,n+1):
   ans.append(lista[i]-lista[i-1])
 print(k-max(ans))
Buggy program (verdict: Wrong Answer):
for _ in[0]*int(input()):
 a,b,c=map(int,sorted(input().split()))
 print(['No','Yes'][a*a+b*b==c*c])


Failing test case input:
3
2 2 -2
-1 5 -1
3 11 -2

Expected output:
NO
NO
NO


Actual output:
No
No
No


Fixed program (verdict: Accepted):
for _ in[0]*int(input()):
 a,b,c=sorted(map(int,input().split()))
 print(['NO','YES'][a*a+b*b==c*c])


Diff:
 for _ in[0]*int(input()):
- a,b,c=map(int,sorted(input().split()))
- print(['No','Yes'][a*a+b*b==c*c])
+ a,b,c=sorted(map(int,input().split()))
+ print(['NO','YES'][a*a+b*b==c*c])
Buggy program (verdict: Wrong Answer):

pas = input("password: ")
pas = list(pas)

for i in range(3):
    if pas[i] == pas[i+1]:
        print("Bad")
        exit()
    a = i
print("Good")


Failing test case input:
5970

Expected output:
Good


Actual output:
password: Good


Fixed program (verdict: Accepted):

pas = input()
pas = list(pas)

for i in range(3):
    if pas[i] == pas[i+1]:
        print('Bad')
        exit()
    a = i
print('Good')


Diff:
 
-pas = input("password: ")
+pas = input()
 pas = list(pas)
 
 for i in range(3):
     if pas[i] == pas[i+1]:
-        print("Bad")
+        print('Bad')
         exit()
     a = i
-print("Good")
+print('Good')
Buggy program (verdict: Wrong Answer):
A, B = map(int, input().split())

if 2 * B < A:
  answer = 2 * B - A
  print(answer)
else:
  print(0)

Failing test case input:
2 -839

Expected output:
1680


Actual output:
-1680


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

if 2 * B < A:
  answer = A - 2 * B
  print(answer)
else:
  print(0)


Diff:
 A, B = map(int, input().split())
 
 if 2 * B < A:
-  answer = 2 * B - A
+  answer = A - 2 * B
   print(answer)
 else:
   print(0)
+