ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
n=int(input())
h = [input() for d in range (n)]
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list=[]


for k in range(26):
    for i in range (n):
         m=50
         x =h[i].count(alphabet[k])
         m =min(x,m)
    list.append(alphabet[k]*m)

print(''.join(list))



Failing test case input:
3
cbaa
d`acc
acacac

Expected output:
ac


Actual output:
aaaccc


Fixed program (verdict: Accepted):
n=int(input())
h = [input() for d in range (n)]
alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
list=[]


for k in range(26):
    m=50
    for i in range (n):
         x =h[i].count(alphabet[k])
         m =min(x,m)
    list.append(alphabet[k]*m)

print(''.join(list))



Diff:
 n=int(input())
 h = [input() for d in range (n)]
 alphabet=['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']
 list=[]
 
 
 for k in range(26):
+    m=50
     for i in range (n):
-         m=50
          x =h[i].count(alphabet[k])
          m =min(x,m)
     list.append(alphabet[k]*m)
 
 print(''.join(list))
Buggy program (verdict: Wrong Answer):
W, H, x, y, r = map(int, input().split())
if (x-r) < 0 or (x+r) > W:
    print("No")
elif (x-r) > 0 and (x+r) < W:
    print("Yes")
else:
    print("No")

Failing test case input:
2 13 3 2 -1

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
W, H, x, y, r = map(int, input().split())
if x-r >= 0 and y-r >= 0 and x+r <= W and y+r <= H:
    print("Yes")
else:
    print("No")

Diff:
 W, H, x, y, r = map(int, input().split())
-if (x-r) < 0 or (x+r) > W:
-    print("No")
-elif (x-r) > 0 and (x+r) < W:
+if x-r >= 0 and y-r >= 0 and x+r <= W and y+r <= H:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
anss = []
for i in range(len(A1)):
    anss.append(sum(A1[:i])+sum(A2[i-1:]))
print(max(anss))

Failing test case input:
7
0 2 0 0 -2 30 -8
11 0 1 -1 -2 -11 1

Expected output:
23


Actual output:
20


Fixed program (verdict: Accepted):
N = int(input())
A1 = list(map(int,input().split()))
A2 = list(map(int,input().split()))
anss = []
for i in range(len(A1)):
    anss.append(sum(A1[:i+1])+sum(A2[i:]))
print(max(anss))


Diff:
 N = int(input())
 A1 = list(map(int,input().split()))
 A2 = list(map(int,input().split()))
 anss = []
 for i in range(len(A1)):
-    anss.append(sum(A1[:i])+sum(A2[i-1:]))
+    anss.append(sum(A1[:i+1])+sum(A2[i:]))
 print(max(anss))
+
Buggy program (verdict: Wrong Answer):
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
count=0
D=[]
BC.sort(key=lambda x:x[1],reverse=True)
A.sort()
for B,C in BC:
  D+=[C]*B
  count+=B
  if count>=N:
    break

D=D[:N]
for i in range(len(D)):
  d=D[i]
  if A[i]<d:
    A[i]=d
  else:
    break
  


Failing test case input:
10 2
0 8 5 7 110 4 7 33 13 10
3 14
8 30
1 4

Expected output:
383


Actual output:

Fixed program (verdict: Accepted):
N,M=map(int,input().split())
A=list(map(int,input().split()))
BC=[list(map(int,input().split())) for _ in range(M)]
count=0
D=[]
BC.sort(key=lambda x:x[1],reverse=True)
A.sort()
for B,C in BC:
  D+=[C]*B
  count+=B
  if count>=N:
    break

D=D[:N]
for i in range(len(D)):
  d=D[i]
  if A[i]<d:
    A[i]=d
  else:
    break
  
print(sum(A))

Diff:
 N,M=map(int,input().split())
 A=list(map(int,input().split()))
 BC=[list(map(int,input().split())) for _ in range(M)]
 count=0
 D=[]
 BC.sort(key=lambda x:x[1],reverse=True)
 A.sort()
 for B,C in BC:
   D+=[C]*B
   count+=B
   if count>=N:
     break
 
 D=D[:N]
 for i in range(len(D)):
   d=D[i]
   if A[i]<d:
     A[i]=d
   else:
     break
   
-
+print(sum(A))
Buggy program (verdict: Wrong Answer):
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 20000000
sum1 = sum(card[:1])
sum2 = sum(card[1:])
for i in range(n - 1):
    dif  = abs(sum1-sum2)
    print(dif)
    if dif  < min_s:
        min_s = dif
    sum1 += card[i+1]
    sum2 = sum2 - card[i+1]
print(min_s)


Failing test case input:
2
-22 3

Expected output:
25


Actual output:
25
25


Fixed program (verdict: Accepted):
n= int(input())
card = input().split(' ')
card = [int(s) for s in card]
min_s = 20000000000
sum1 = sum(card[:1])
sum2 = sum(card[1:])
for i in range(n - 1):
    dif  = abs(sum1-sum2)

    if dif  < min_s:
        min_s = dif
    sum1 += card[i+1]
    sum2 = sum2 - card[i+1]
print(min_s)


Diff:
 n= int(input())
 card = input().split(' ')
 card = [int(s) for s in card]
-min_s = 20000000
+min_s = 20000000000
 sum1 = sum(card[:1])
 sum2 = sum(card[1:])
 for i in range(n - 1):
     dif  = abs(sum1-sum2)
-    print(dif)
+
     if dif  < min_s:
         min_s = dif
     sum1 += card[i+1]
     sum2 = sum2 - card[i+1]
 print(min_s)
Buggy program (verdict: Wrong Answer):
N=input()
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] :
    print("Good")
else:
    print("Bad")

Failing test case input:
8243

Expected output:
Good


Actual output:
Bad


Fixed program (verdict: Accepted):
N=input()
if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] :
    print("Bad")
else:
    print("Good")

Diff:
 N=input()
 if N[0]==N[1] or N[1]==N[2] or N[2]==N[3] :
-    print("Good")
-else:
     print("Bad")
+else:
+    print("Good")
Buggy program (verdict: Wrong Answer):



n = int(input())
turns = [input() for i in range(n)]

taro, hanako = 0, 0
for turn in turns:
    t, h = turn.split(' ')
    min_len = len(t) if len(t) <= len(h) else len(h)

    win_flag = 0 
    for i in range(min_len):
        if ord(t[i]) < ord(h[i]):
            win_flag = 1
        elif ord(h[i]) < ord(t[i]):
            win_flag = -1

    if win_flag == 0:
        if len(t) < len(h):
            win_flag = 1
        elif len(h) < len(t):
            win_flag = -1

    if win_flag == -1:
        taro += 3
    elif win_flag == 1:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)


Failing test case input:
3
v`f ngg
jrhd jugf
knok hvtgf

Expected output:
6 3


Actual output:
3 6


Fixed program (verdict: Accepted):



n = int(input())
turns = [input() for i in range(n)]

taro, hanako = 0, 0
for turn in turns:
    t, h = turn.split(' ')
    min_len = len(t) if len(t) <= len(h) else len(h)

    win_flag = 0 
    for i in range(min_len):
        if ord(t[i]) < ord(h[i]):
            win_flag = 1
            break
        elif ord(h[i]) < ord(t[i]):
            win_flag = -1
            break

    if win_flag == 0:
        if len(t) < len(h):
            win_flag = 1
        elif len(h) < len(t):
            win_flag = -1

    if win_flag == -1:
        taro += 3
    elif win_flag == 1:
        hanako += 3
    else:
        taro += 1
        hanako += 1

print(taro, hanako)


Diff:
 
 
 
 n = int(input())
 turns = [input() for i in range(n)]
 
 taro, hanako = 0, 0
 for turn in turns:
     t, h = turn.split(' ')
     min_len = len(t) if len(t) <= len(h) else len(h)
 
     win_flag = 0 
     for i in range(min_len):
         if ord(t[i]) < ord(h[i]):
             win_flag = 1
+            break
         elif ord(h[i]) < ord(t[i]):
             win_flag = -1
+            break
 
     if win_flag == 0:
         if len(t) < len(h):
             win_flag = 1
         elif len(h) < len(t):
             win_flag = -1
 
     if win_flag == -1:
         taro += 3
     elif win_flag == 1:
         hanako += 3
     else:
         taro += 1
         hanako += 1
 
 print(taro, hanako)
Buggy program (verdict: Wrong Answer):
a, b, k =map(int,input().split())
if a>k:
    print(a-k,b)
elif a+b>=k:
    print(0,b-k-a)
else:
    print(0,0)

Failing test case input:
9875757521 933260677 0010110110000

Expected output:
0 698908198


Actual output:
0 -19052606844


Fixed program (verdict: Accepted):
a, b, k =map(int,input().split())
if a>k:
    print(a-k,b)
elif a+b>=k:
    print(0,b-(k-a))
else:
    print(0,0)

Diff:
 a, b, k =map(int,input().split())
 if a>k:
     print(a-k,b)
 elif a+b>=k:
-    print(0,b-k-a)
+    print(0,b-(k-a))
 else:
     print(0,0)
Buggy program (verdict: Wrong Answer):
import math
a,b,t=map(float,input().split())
c = math.floor(t/a)
print(c*b)

Failing test case input:
2 9 12

Expected output:
54


Actual output:
54.0


Fixed program (verdict: Accepted):
import math
a,b,t=map(float,input().split())
c = round(math.floor(t/a))
print(c*round(b))

Diff:
 import math
 a,b,t=map(float,input().split())
-c = math.floor(t/a)
-print(c*b)
+c = round(math.floor(t/a))
+print(c*round(b))
Buggy program (verdict: Wrong Answer):
i = input()
a,b = map(int, i.split())
cnt = 1

while(a>b) :
    a -= b
    cnt +=1

    if(a <= b):
        print(cnt)
        break

Failing test case input:
2 10000

Expected output:
1


Actual output:

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

while(a>b) :
    a -= b
    cnt +=1


print(cnt)

Diff:
 i = input()
 a,b = map(int, i.split())
 cnt = 1
 
 while(a>b) :
     a -= b
     cnt +=1
 
-    if(a <= b):
-        print(cnt)
-        break
+
+print(cnt)
Buggy program (verdict: Wrong Answer):
s = list(input())
t = list(input())

def eq(s, t):
    for i in range(len(s)):
        if s[i] != t[i] and s[i] != '?':
            return False
    return True

for i in reversed(range(len(s) - len(t)+1)):
    if eq(s[i:i+len(t)], t[:]):
        s[i:i + len(t)] = t[:]
        ans = ''.join(s)
        print(ans.replace('?', 'b'))
        quit()
print('UNRESTORABLE')

Failing test case input:
>q???d?>
_ba

Expected output:
>q_bada>


Actual output:
>q_badb>


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

def eq(s, t):
    for i in range(len(s)):
        if s[i] != t[i] and s[i] != '?':
            return False
    return True

for i in reversed(range(len(s) - len(t)+1)):
    if eq(s[i:i+len(t)], t[:]):
        s[i:i + len(t)] = t[:]
        ans = ''.join(s)
        print(ans.replace('?', 'a'))
        quit()
print('UNRESTORABLE')

Diff:
 s = list(input())
 t = list(input())
 
 def eq(s, t):
     for i in range(len(s)):
         if s[i] != t[i] and s[i] != '?':
             return False
     return True
 
 for i in reversed(range(len(s) - len(t)+1)):
     if eq(s[i:i+len(t)], t[:]):
         s[i:i + len(t)] = t[:]
         ans = ''.join(s)
-        print(ans.replace('?', 'b'))
+        print(ans.replace('?', 'a'))
         quit()
 print('UNRESTORABLE')
Buggy program (verdict: Wrong Answer):
n = int(input())
T = H = 0
for x in range(n):
    t, h = input().split()
    tl = list(t)
    hl = list(h)
    z = min([int(len(tl)),int(len(hl))])
    for k in range(z):
        if ord(tl[k]) > ord(hl[k]):
            T += 3
            break
        elif ord(tl[k]) == ord(hl[k]):
            pass
        else:
            H += 3
            break
    else:
        if len(hl) == len(tl):
            T += 1
            H += 1
        elif z == len(tl):
            H += 3
        else:
            T += 3
    print(f"{str(T)} {str(H)}")
print(f"{str(T)} {str(H)}")





Failing test case input:
3
act eog
fish gith
lion tiger

Expected output:
0 9


Actual output:
0 3
0 6
0 9
0 9


Fixed program (verdict: Accepted):
n = int(input())
T = H = 0
for x in range(n):
    t, h = input().split()
    tl = list(t)
    hl = list(h)
    z = min([int(len(tl)),int(len(hl))])
    for k in range(z):
        if ord(tl[k]) > ord(hl[k]):
            T += 3
            break
        elif ord(tl[k]) == ord(hl[k]):
            pass
        else:
            H += 3
            break
    else:
        if len(hl) == len(tl):
            T += 1
            H += 1
        elif z == len(tl):
            H += 3
        else:
            T += 3
print(f"{str(T)} {str(H)}")





Diff:
 n = int(input())
 T = H = 0
 for x in range(n):
     t, h = input().split()
     tl = list(t)
     hl = list(h)
     z = min([int(len(tl)),int(len(hl))])
     for k in range(z):
         if ord(tl[k]) > ord(hl[k]):
             T += 3
             break
         elif ord(tl[k]) == ord(hl[k]):
             pass
         else:
             H += 3
             break
     else:
         if len(hl) == len(tl):
             T += 1
             H += 1
         elif z == len(tl):
             H += 3
         else:
             T += 3
-    print(f"{str(T)} {str(H)}")
 print(f"{str(T)} {str(H)}")
Buggy program (verdict: Wrong Answer):
def main():
    n = int(input())
    a = list(map(int, input().split()))
    cnt = 0
    for i in range(0, n-1):
        if a[i] < a[i+1]:
            step = a[i+1] - a[i]
            a[i] = a[i] + step
            cnt = cnt+step

    print(cnt)
main()

Failing test case input:
5
4 0 0 96 -1

Expected output:
105


Actual output:
96


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

    print(cnt)
main()

Diff:
 def main():
     n = int(input())
     a = list(map(int, input().split()))
     cnt = 0
     for i in range(0, n-1):
-        if a[i] < a[i+1]:
-            step = a[i+1] - a[i]
-            a[i] = a[i] + step
-            cnt = cnt+step
+        if a[i] > a[i+1]:
+            step = a[i] - a[i+1]
+            a[i+1] = a[i+1] + step
+            cnt = cnt + step
 
     print(cnt)
 main()
Buggy program (verdict: Wrong Answer):
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]

lis.sort(key=lambda k: k[1], reverse=True)
lis.sort(key=lambda k: k[0])

for j in lis:
    print(j[2])


Failing test case input:
10
yakutsk 10
yakstul 28
yakutsk 30
y`kutsk 0
yakvtsk 18
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

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


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


Fixed program (verdict: Accepted):
N = int(input())
lis = [(input() + " " + str(i+1)).split() for i in range(N)]

lis = [k for k in lis]

lis.sort(key=lambda k: int(k[1]), reverse=True)
lis.sort(key=lambda k: k[0])


for j in lis:
    print(j[2])


Diff:
 N = int(input())
 lis = [(input() + " " + str(i+1)).split() for i in range(N)]
 
-lis.sort(key=lambda k: k[1], reverse=True)
+lis = [k for k in lis]
+
+lis.sort(key=lambda k: int(k[1]), reverse=True)
 lis.sort(key=lambda k: k[0])
 
+
 for j in lis:
     print(j[2])
Buggy program (verdict: Wrong Answer):
import collections
N = int(input())
S = [input() for i in range(N)]
print(S)
SI = [S[i][0] for i in range(N)]
cnt = collections.Counter(SI)
n = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]
ans = 0
for i in range(3):
    for j in range(i+1,5):
        for k in range(j+1,5):
          ans += n[i]*n[j]*n[k]
print(ans)

Failing test case input:
5
CHOKUD@I
RNG
MAKOTO
AOKI
RINGN

Expected output:
7


Actual output:
['CHOKUD@I', 'RNG', 'MAKOTO', 'AOKI', 'RINGN']
7


Fixed program (verdict: Accepted):
import collections
N = int(input())
S = [input() for i in range(N)]
SI = [S[i][0] for i in range(N)]
cnt = collections.Counter(SI)
n = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]
ans = 0
for i in range(3):
    for j in range(i+1,5):
        for k in range(j+1,5):
            ans += n[i]*n[j]*n[k]
print(ans)

Diff:
 import collections
 N = int(input())
 S = [input() for i in range(N)]
-print(S)
 SI = [S[i][0] for i in range(N)]
 cnt = collections.Counter(SI)
 n = [cnt["M"],cnt["A"],cnt["R"],cnt["C"],cnt["H"]]
 ans = 0
 for i in range(3):
     for j in range(i+1,5):
         for k in range(j+1,5):
-          ans += n[i]*n[j]*n[k]
+            ans += n[i]*n[j]*n[k]
 print(ans)
Buggy program (verdict: Wrong Answer):
color = input()

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    kosuu[_] = int(kosuu[_]) -1
    break
      
  _= _+1
    
print(kosuu)


Failing test case input:
red tmbe
3 -2
red

Expected output:
2 -2


Actual output:
2, -2

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

kosuu = input()

trashc = input()

_ = 0

color = color.split()
kosuu = kosuu.split()
trashc = trashc.split()


while True:
  if(trashc[0] == color[_]):
    kosuu[_] = int(kosuu[_]) -1
    break
      
  _= _+1
    
print(" ".join(map(str, kosuu)))


Diff:
 color = input()
 
 kosuu = input()
 
 trashc = input()
 
 _ = 0
 
 color = color.split()
 kosuu = kosuu.split()
 trashc = trashc.split()
 
 
 while True:
   if(trashc[0] == color[_]):
     kosuu[_] = int(kosuu[_]) -1
     break
       
   _= _+1
     
-print(kosuu)
+print(" ".join(map(str, kosuu)))
Buggy program (verdict: Wrong Answer):
import math
n=int(input("n:"))
R=[0]*n
sum=0
for i in range(n):
    R[i]=int(input(""))
for i in range(n):
    s=math.sqrt(R[i])
    s=int(s)+1
    for j in range(2,s+1):
        if R[i]==j:
            sum=sum+1
        if R[i]%j==0:
            break
        if j==s:
            sum=sum+1
print(sum)


Failing test case input:
11
7
8
9
13
11
22
17
14
27
8
17

Expected output:
5


Actual output:
n:5


Fixed program (verdict: Accepted):
import math
n=int(input())
R=[0]*n
sum=0
for i in range(n):
    R[i]=int(input())
for i in range(n):
    if R[i]<0:
        continue
    s=math.sqrt(R[i])
    s=int(s)+1
    for j in range(2,s+1):
        if R[i]==j:
            sum=sum+1
        if R[i]%j==0:
            break
        if j==s:
            sum=sum+1
print(sum)


Diff:
 import math
-n=int(input("n:"))
+n=int(input())
 R=[0]*n
 sum=0
 for i in range(n):
-    R[i]=int(input(""))
+    R[i]=int(input())
 for i in range(n):
+    if R[i]<0:
+        continue
     s=math.sqrt(R[i])
     s=int(s)+1
     for j in range(2,s+1):
         if R[i]==j:
             sum=sum+1
         if R[i]%j==0:
             break
         if j==s:
             sum=sum+1
 print(sum)
Buggy program (verdict: Wrong Answer):
n,k=map(int,input().split())
d=list()
array=list()
for i in range(k):
	d.extend(input())
	array.extend(input())


print(n-len(set(array)))

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

Expected output:
3


Actual output:
2


Fixed program (verdict: Accepted):
n,k=map(int,input().split())
d=list()
array=list()
for i in range(k):
	d.extend(input())
	array.extend(input().split())

print(n-len(set(array)))

Diff:
 n,k=map(int,input().split())
 d=list()
 array=list()
 for i in range(k):
 	d.extend(input())
-	array.extend(input())
-
+	array.extend(input().split())
 
 print(n-len(set(array)))
Buggy program (verdict: Wrong Answer):
def rren(): return list(map(int, input().split()))
N = int(input())
R = rren()

for i in range(1,N):
    take = R[i]
    j = i-1
    while j >= 0 and R[j] > take:
        R[j+1] = R[j]
        j -= 1
    R[j+1] = take
    print(" ".join(map(str, R)))

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

Expected output:
2 0 2 -1 4 -2
0 2 2 -1 4 -2
0 2 2 -1 4 -2
-1 0 2 2 4 -2
-1 0 2 2 4 -2
-2 -1 0 2 2 4


Actual output:
0 2 2 -1 4 -2
0 2 2 -1 4 -2
-1 0 2 2 4 -2
-1 0 2 2 4 -2
-2 -1 0 2 2 4


Fixed program (verdict: Accepted):
def rren(): return list(map(int, input().split()))
N = int(input())
R = rren()

print(" ".join(map(str, R)))
for i in range(1,N):
    take = R[i]
    j = i-1
    while j >= 0 and R[j] > take:
        R[j+1] = R[j]
        j -= 1
    R[j+1] = take
    print(" ".join(map(str, R)))

Diff:
 def rren(): return list(map(int, input().split()))
 N = int(input())
 R = rren()
 
+print(" ".join(map(str, R)))
 for i in range(1,N):
     take = R[i]
     j = i-1
     while j >= 0 and R[j] > take:
         R[j+1] = R[j]
         j -= 1
     R[j+1] = take
     print(" ".join(map(str, R)))
Buggy program (verdict: Wrong Answer):
x = int(input())
for a in range(300):
  for b in range(300):
    if a**5-b**5==x or a**5+b**5==x:
      print(a,b)
      break

Failing test case input:
244

Expected output:
1 -3


Actual output:
1 3
3 1


Fixed program (verdict: Accepted):
x = int(input())
for a in range(300):
  for b in range(300):
    if a**5-b**5==x:
      print(a,b)
      exit()
    if a**5+b**5==x:
      print(a,b*-1)
      exit()



Diff:
 x = int(input())
 for a in range(300):
   for b in range(300):
-    if a**5-b**5==x or a**5+b**5==x:
+    if a**5-b**5==x:
       print(a,b)
-      break
+      exit()
+    if a**5+b**5==x:
+      print(a,b*-1)
+      exit()
+
+
Buggy program (verdict: Wrong Answer):
N, M = map(int, input().split())
pSs = [list(map(str, input().split())) for _ in range(M)]



ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

print(sum(ACs), sum(WAs))

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 = map(int, input().split())
pSs = [list(map(str, input().split())) for _ in range(M)]



ACs = [False for _ in range(N)]
WAs = [0 for _ in range(N)]

for pS in pSs:
    problem = int(pS[0]) -1
    answer = pS[1]
    if ACs[problem] == True:
        continue
    else:
        if answer == "WA":
            WAs[problem] += 1
        else:
            ACs[problem] = True

num_WA = 0
for i, WA in enumerate(WAs):
    if ACs[i] == True:
        num_WA += WA

print(sum(ACs), num_WA)

Diff:
 N, M = map(int, input().split())
 pSs = [list(map(str, input().split())) for _ in range(M)]
 
 
 
 ACs = [False for _ in range(N)]
 WAs = [0 for _ in range(N)]
 
 for pS in pSs:
     problem = int(pS[0]) -1
     answer = pS[1]
     if ACs[problem] == True:
         continue
     else:
         if answer == "WA":
             WAs[problem] += 1
         else:
             ACs[problem] = True
 
-print(sum(ACs), sum(WAs))
+num_WA = 0
+for i, WA in enumerate(WAs):
+    if ACs[i] == True:
+        num_WA += WA
+
+print(sum(ACs), num_WA)
Buggy program (verdict: Wrong Answer):
n=int(input())
l=sorted(list(map(int,input().split())))
for i,x in enumerate(l):
  l[i]=format(x,'63b')
memo=[0]*63
for i in range(61):
  for j in range(n):
    if l[j][i]=='1':
      memo[-i-1]+=1
now=1
ans=0
mod=10**9+7
for x in memo:
  ans+=(now*x*(n-x))%mod
  now*=2
print(ans%mod)


Failing test case input:
10
0 0 1 387 39763 3606555 92549 663262 332665684 12968449561

Expected output:
711332179


Actual output:
711332107


Fixed program (verdict: Accepted):
n=int(input())
l=sorted(list(map(int,input().split())))
for i,x in enumerate(l):
  l[i]=format(x,'63b')
memo=[0]*63
for i in range(63):
  for j in range(n):
    if l[j][i]=='1':
      memo[-i-1]+=1
now=1
ans=0
mod=10**9+7
for x in memo:
  ans+=(now*x*(n-x))%mod
  now*=2
print(ans%mod)


Diff:
 n=int(input())
 l=sorted(list(map(int,input().split())))
 for i,x in enumerate(l):
   l[i]=format(x,'63b')
 memo=[0]*63
-for i in range(61):
+for i in range(63):
   for j in range(n):
     if l[j][i]=='1':
       memo[-i-1]+=1
 now=1
 ans=0
 mod=10**9+7
 for x in memo:
   ans+=(now*x*(n-x))%mod
   now*=2
 print(ans%mod)
Buggy program (verdict: Wrong Answer):
a, b = map(int, input().split(" "))
if b * 2 >= a:
  print(0)
else:
  print(b*2 - a)

Failing test case input:
194 13

Expected output:
168


Actual output:
-168


Fixed program (verdict: Accepted):
a, b = map(int, input().split(" "))
if b * 2 >= a:
  print(0)
else:
  print(a - b*2)

Diff:
 a, b = map(int, input().split(" "))
 if b * 2 >= a:
   print(0)
 else:
-  print(b*2 - a)
+  print(a - b*2)
Buggy program (verdict: Wrong Answer):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a,b=nii()
p=lnii()

x=0
y=0
z=0

for i in p:
  if i<=a:
    x+=1
  if i>=b+1:
    z+=1
  else:
    y+=1

print(min(x,y,z))

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

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
from sys import stdin
nii=lambda:map(int,stdin.readline().split())
lnii=lambda:list(map(int,stdin.readline().split()))

n=int(input())
a,b=nii()
p=lnii()

x=0
y=0
z=0

for i in p:
  if i<=a:
    x+=1
  elif i>=b+1:
    z+=1
  else:
    y+=1

print(min(x,y,z))

Diff:
 from sys import stdin
 nii=lambda:map(int,stdin.readline().split())
 lnii=lambda:list(map(int,stdin.readline().split()))
 
 n=int(input())
 a,b=nii()
 p=lnii()
 
 x=0
 y=0
 z=0
 
 for i in p:
   if i<=a:
     x+=1
-  if i>=b+1:
+  elif i>=b+1:
     z+=1
   else:
     y+=1
 
 print(min(x,y,z))
Buggy program (verdict: Wrong Answer):
K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
for k in range(K):
    n+=k
    if A<=n and n<=B:
        s='OK'
print(s)

Failing test case input:
4
12 18

Expected output:
OK


Actual output:
NG


Fixed program (verdict: Accepted):
K = int(input())
A,B = map(int,input().split(" "))
n=0
s='NG'
while(n<=B):
    n+=K
    if A<=n and n<=B:
        s='OK'
print(s)

Diff:
 K = int(input())
 A,B = map(int,input().split(" "))
 n=0
 s='NG'
-for k in range(K):
-    n+=k
+while(n<=B):
+    n+=K
     if A<=n and n<=B:
         s='OK'
 print(s)
Buggy program (verdict: Wrong Answer):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
    v = int(input())
    if a <= v < b:
        ans_list.append(v)
print(len(ans_list))


Failing test case input:
5 5 5
3
6
11
15
18

Expected output:
5


Actual output:
0


Fixed program (verdict: Accepted):
n, a, b = [ int(v) for v in input().split() ]
ans_list = []
for i in range(n):
    v = int(input())
    if not a <= v < b:
        ans_list.append(v)
print(len(ans_list))

Diff:
 n, a, b = [ int(v) for v in input().split() ]
 ans_list = []
 for i in range(n):
     v = int(input())
-    if a <= v < b:
+    if not a <= v < b:
         ans_list.append(v)
 print(len(ans_list))
-
Buggy program (verdict: Wrong Answer):
list=[int(x) for x in input().split()]
count=0
for i in range(1,len(list)):
  if list[i-1]==list[i]:
    count=count+1
if count==1:
  print("Yes")
else:
  print("No")
  

Failing test case input:
4 3 4

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
list=[int(x) for x in input().split()]
count=0
list.sort()
for i in range(1,len(list)):
  if list[i-1]==list[i]:
    count=count+1
if count==1:
  print("Yes")
else:
  print("No")
  

Diff:
 list=[int(x) for x in input().split()]
 count=0
+list.sort()
 for i in range(1,len(list)):
   if list[i-1]==list[i]:
     count=count+1
 if count==1:
   print("Yes")
 else:
   print("No")
Buggy program (verdict: Wrong Answer):






A,B = map(int, input().split())





if A > B + 1:
    print(2 * A -1)
else:
    print(A + B)









Failing test case input:
1 52

Expected output:
103


Actual output:
53


Fixed program (verdict: Accepted):






A,B = map(int, input().split())





if A > B:
    print(2 * A -1)
elif A == B:
    print(A + B)
else:
    print(2 * B -1)









Diff:
 
 
 
 
 
 
 A,B = map(int, input().split())
 
 
 
 
 
-if A > B + 1:
+if A > B:
     print(2 * A -1)
-else:
+elif A == B:
     print(A + B)
+else:
+    print(2 * B -1)
Buggy program (verdict: Wrong Answer):
s = input()

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True or isEven == True:
    print("Yes")
else:
    print("No")

Failing test case input:
URUJU

Expected output:
No


Actual output:
Yes


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

isOdd = True
for i in range(len(s)):
    if i % 2 == 1:
        if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
            isOdd = False

isEven = True
for i in range(len(s)):
    if i == 0 or i % 2 == 0:
        if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
            isEven = False

if isOdd == True and isEven == True:
    print("Yes")
else:
    print("No")

Diff:
 s = input()
 
 isOdd = True
 for i in range(len(s)):
     if i % 2 == 1:
         if s[i] != 'L' and s[i] != 'U' and s[i] != 'D':
             isOdd = False
 
 isEven = True
 for i in range(len(s)):
     if i == 0 or i % 2 == 0:
         if s[i] != 'R' and s[i] != 'U' and s[i] != 'D':
             isEven = False
 
-if isOdd == True or isEven == True:
+if isOdd == True and isEven == True:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
n,k=input().split(" ") 
h=input().split(" ") 
c=0
for i in h:
  if int(i )>int(k):
    c+=1
print (c)

Failing test case input:
4 150
150 140 100 282

Expected output:
2


Actual output:
1


Fixed program (verdict: Accepted):
n,k=input().split(" ") 
h=input().split(" ") 
c=0
for i in h:
  if int(i)>=int(k):
    c+=1
print (c)

Diff:
 n,k=input().split(" ") 
 h=input().split(" ") 
 c=0
 for i in h:
-  if int(i )>int(k):
+  if int(i)>=int(k):
     c+=1
 print (c)
Buggy program (verdict: Wrong Answer):
S = input()
T = input()
for i in range(len(S)):
  U = S[-i: ] + S[: len(S) - i]
  print(S[-i: ], S[: len(S) - i], U)
  if U == T or S == T:
    print('Yes')
    exit()
print('No')

Failing test case input:
ospyk
kmtyn

Expected output:
No


Actual output:
ospyk ospyk ospykospyk
k ospy kospy
yk osp ykosp
pyk os pykos
spyk o spyko
No


Fixed program (verdict: Accepted):
S = input()
T = input()
for i in range(len(S)):
  U = S[-i: ] + S[: len(S) - i]
  if U == T or S == T:
    print('Yes')
    exit()
print('No')


Diff:
 S = input()
 T = input()
 for i in range(len(S)):
   U = S[-i: ] + S[: len(S) - i]
-  print(S[-i: ], S[: len(S) - i], U)
   if U == T or S == T:
     print('Yes')
     exit()
 print('No')
+
Buggy program (verdict: Wrong Answer):
C = [list(map(int, input().split())) for _ in range(3)]
a1 = 0
b1 = C[0][0] - a1
b2 = C[0][1] - a1
b3 = C[0][2] - a1
a2 = C[1][0] - b1
a3 = C[2][0] - b1
if C[1][1] == a2 + b2 :
    if C[1][2] == a2 + b3 :
        if C[2][1] == a3 + b2:
            if C[2][2] == a3 + b3 :
                print('Yes')
else :
    print('No')

Failing test case input:
0 8 2
0 8 8
0 0 8

Expected output:
No


Actual output:

Fixed program (verdict: Accepted):
C = [list(map(int, input().split())) for _ in range(3)]
a1 = 0
b1 = C[0][0] - a1
b2 = C[0][1] - a1
b3 = C[0][2] - a1
a2 = C[1][0] - b1
a3 = C[2][0] - b1
if C[1][1] == a2 + b2 and C[1][2] == a2 + b3 and C[2][1] == a3 + b2 and C[2][2] == a3 + b3:
    print('Yes')
else :
    print('No')

Diff:
 C = [list(map(int, input().split())) for _ in range(3)]
 a1 = 0
 b1 = C[0][0] - a1
 b2 = C[0][1] - a1
 b3 = C[0][2] - a1
 a2 = C[1][0] - b1
 a3 = C[2][0] - b1
-if C[1][1] == a2 + b2 :
-    if C[1][2] == a2 + b3 :
-        if C[2][1] == a3 + b2:
-            if C[2][2] == a3 + b3 :
-                print('Yes')
+if C[1][1] == a2 + b2 and C[1][2] == a2 + b3 and C[2][1] == a3 + b2 and C[2][2] == a3 + b3:
+    print('Yes')
 else :
     print('No')
Buggy program (verdict: Wrong Answer):
N = input()
s = input()
s1 = s
s2 = ''
while s1 != s2: 
    s2 = s1
    s1 = s1.replace('()','')
print(s1)
s2 = s1.replace('(','')

print(len(s2)*'(' + s + (len(s1)-len(s2))*')')


Failing test case input:
6
))()))

Expected output:
(((())()))


Actual output:
))))
(((())()))


Fixed program (verdict: Accepted):
N = input()
s = input()
s1 = s
s2 = ''
while s1 != s2: 
    s2 = s1
    s1 = s1.replace('()','')
s2 = s1.replace('(','')

print(len(s2)*'(' + s + (len(s1)-len(s2))*')')


Diff:
 N = input()
 s = input()
 s1 = s
 s2 = ''
 while s1 != s2: 
     s2 = s1
     s1 = s1.replace('()','')
-print(s1)
 s2 = s1.replace('(','')
 
 print(len(s2)*'(' + s + (len(s1)-len(s2))*')')
Buggy program (verdict: Wrong Answer):
def main():
  import sys
  n,h,w=map(int,open(0).read().split())
  ans=(n-h-1)*(n-w+1)
  print(ans)

Failing test case input:
100
0
21

Expected output:
8080


Actual output:

Fixed program (verdict: Accepted):
def main():
  import sys
  n,h,w=map(int,open(0).read().split())
  ans=(n-h+1)*(n-w+1)
  print(ans)
if __name__=="__main__":
  main()


Diff:
 def main():
   import sys
   n,h,w=map(int,open(0).read().split())
-  ans=(n-h-1)*(n-w+1)
+  ans=(n-h+1)*(n-w+1)
   print(ans)
+if __name__=="__main__":
+  main()
+
Buggy program (verdict: Wrong Answer):
n = int(input())
l = list(map(int,input().split()))
bucket = [0]*n
for i in range(n):
    for j in range(n):
        if i == l[j]:
            bucket[i] += 1
            flg = i
for i in range(flg-1):
    for j in range(bucket[i]):
        print(i,end = ' ')
for i in range(bucket[flg]-1):
    print(flg,end=' ')
print(flg)


Failing test case input:
7
4 12 1 0 6 3 3

Expected output:
0 1 3 3 4 6 12


Actual output:
0 1 3 3 4 6


Fixed program (verdict: Accepted):
flg = 0
n = int(input())
l = list(map(int,input().split()))
bucket = [0]*10000
for i in range(n):
    bucket[l[i]] += 1
    if flg < l[i]:
        flg = l[i]
for i in range(flg):
    for j in range(bucket[i]):
        print(i,end = ' ')
for i in range(bucket[flg]-1):
    print(flg,end=' ')
print(flg)


Diff:
+flg = 0
 n = int(input())
 l = list(map(int,input().split()))
-bucket = [0]*n
+bucket = [0]*10000
 for i in range(n):
-    for j in range(n):
-        if i == l[j]:
-            bucket[i] += 1
-            flg = i
-for i in range(flg-1):
+    bucket[l[i]] += 1
+    if flg < l[i]:
+        flg = l[i]
+for i in range(flg):
     for j in range(bucket[i]):
         print(i,end = ' ')
 for i in range(bucket[flg]-1):
     print(flg,end=' ')
 print(flg)
Buggy program (verdict: Wrong Answer):
N = int(input())
input_list = [int(i) for i in input().split()]

index = 1
ruiseki_list = [0]*(N+1)
result = 10*9

if N == 2:
    print(abs(input_list[0]-input_list[1]))
else:
    for i in input_list:
        ruiseki_list[index] = ruiseki_list[index-1] + i
        index += 1

    for i in range(2, N):
        cal = abs(ruiseki_list[N] - 2 * ruiseki_list[i])
        print(cal)
        if cal < result:
            result = cal
    print(result)

Failing test case input:
6
0 2 3 7 5 6

Expected output:
1


Actual output:
19
13
1
11
1


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

index = 1
ruiseki_list = [0]*(N+1)
result = 10*9

if N == 2:
    print(abs(input_list[0]-input_list[1]))
else:
    for i in input_list:
        ruiseki_list[index] = ruiseki_list[index-1] + i
        index += 1

    mapped_list = map(lambda x: ruiseki_list[N]-x, ruiseki_list)
    result_list = [abs(a-b) for (a, b) in zip(ruiseki_list, mapped_list)]
    print(min(result_list[2:N]))

Diff:
 N = int(input())
 input_list = [int(i) for i in input().split()]
 
 index = 1
 ruiseki_list = [0]*(N+1)
 result = 10*9
 
 if N == 2:
     print(abs(input_list[0]-input_list[1]))
 else:
     for i in input_list:
         ruiseki_list[index] = ruiseki_list[index-1] + i
         index += 1
 
-    for i in range(2, N):
-        cal = abs(ruiseki_list[N] - 2 * ruiseki_list[i])
-        print(cal)
-        if cal < result:
-            result = cal
-    print(result)
+    mapped_list = map(lambda x: ruiseki_list[N]-x, ruiseki_list)
+    result_list = [abs(a-b) for (a, b) in zip(ruiseki_list, mapped_list)]
+    print(min(result_list[2:N]))
Buggy program (verdict: Wrong Answer):
N,M = (int(x) for x in input().split())
 
K = N/M
if N < M:
  print(1)
elif N%M == 0:
  print(K)
else:
  print(K+1)

Failing test case input:
11011 5

Expected output:
2203


Actual output:
2203.2


Fixed program (verdict: Accepted):
N,M = (int(x) for x in input().split())
 
K = int(N/M)
if N < M:
  print(1)
elif N%M == 0:
  print(K)
else:
  print(K+1)

Diff:
 N,M = (int(x) for x in input().split())
  
-K = N/M
+K = int(N/M)
 if N < M:
   print(1)
 elif N%M == 0:
   print(K)
 else:
   print(K+1)
Buggy program (verdict: Wrong Answer):

n = int(input())
an = list(map(int,input().split()))
sum_an = sum(an)
from itertools import accumulate
an_acc = accumulate(an)
print(min(list(map(lambda x : abs(sum_an-x*2),an_acc))))


Failing test case input:
2
-75 1

Expected output:
76


Actual output:
74


Fixed program (verdict: Accepted):

n = int(input())
an = list(map(int,input().split()))
sum_an = sum(an)
from itertools import accumulate
an_acc = list(accumulate(an))[0:-1]
print(min(list(map(lambda x : abs(sum_an-x*2),an_acc))))


Diff:
 
 n = int(input())
 an = list(map(int,input().split()))
 sum_an = sum(an)
 from itertools import accumulate
-an_acc = accumulate(an)
+an_acc = list(accumulate(an))[0:-1]
 print(min(list(map(lambda x : abs(sum_an-x*2),an_acc))))
Buggy program (verdict: Wrong Answer):
Inp1 = list(input().split())
Inp1.extend(input().replace(' ',''))
Inp1.extend(input().replace(' ',''))

Inp_dict = {'1':0,'2':0,'3':0,'4':0}
for i in Inp1:
	Inp_dict[i] +=1

ans = list()
for k in Inp_dict.keys():
	if Inp_dict[k] == 2 : ans.extend(k)

if len(ans) == 2: print('Yes')
else: print('No') 

Failing test case input:
1 2
2 2
4 3

Expected output:
NO


Actual output:
No


Fixed program (verdict: Accepted):
Inp1 = list(input().split())
Inp1.extend(input().replace(' ',''))
Inp1.extend(input().replace(' ',''))

Inp_dict = {'1':0,'2':0,'3':0,'4':0}
for i in Inp1:
	Inp_dict[i] +=1

ans = list()
for k in Inp_dict.keys():
	if Inp_dict[k] == 2 : ans.extend(k)

if len(ans) == 2: print('YES')
else: print('NO') 

Diff:
 Inp1 = list(input().split())
 Inp1.extend(input().replace(' ',''))
 Inp1.extend(input().replace(' ',''))
 
 Inp_dict = {'1':0,'2':0,'3':0,'4':0}
 for i in Inp1:
 	Inp_dict[i] +=1
 
 ans = list()
 for k in Inp_dict.keys():
 	if Inp_dict[k] == 2 : ans.extend(k)
 
-if len(ans) == 2: print('Yes')
-else: print('No') 
+if len(ans) == 2: print('YES')
+else: print('NO')
Buggy program (verdict: Wrong Answer):
n=int(input())
A=list(input())
t=0
ans=-105
for i in A:
  if i=="D":
    t-=1
    ans=max(ans,t)
  else:
    t+=1
    ans=max (ans,t)
print(ans)
    

Failing test case input:
7
DDIDIDI

Expected output:
0


Actual output:
-1


Fixed program (verdict: Accepted):
n=int(input())
A=list(input())
t=0
ans=0
for i in A:
  if i=="D":
    t-=1
    ans=max(ans,t)
  else:
    t+=1
    ans=max (ans,t)
print(ans)
    


Diff:
 n=int(input())
 A=list(input())
 t=0
-ans=-105
+ans=0
 for i in A:
   if i=="D":
     t-=1
     ans=max(ans,t)
   else:
     t+=1
     ans=max (ans,t)
 print(ans)
     
+
Buggy program (verdict: Wrong Answer):
N = int(input())
G1 = [int(i) for i in input().split()] 
G2 = [int(i) for i in input().split()] 
one = [0 for i in range(N)]
two = [0 for i in range(N)]
i = j = 0

for i in range(N):
    for j in range(i+1):
        one[i] = one[i] + G1[j]
    for k in range(i,N):
        two[i] = two[i] + G2[k]

sum = 0
for i in range(N):
    if sum < one[i] + two[N-1]:
        sum = one[i] + two[N-1]

print(sum)


Failing test case input:
7
-2 -1 1 0 1 19 1
136 -2 0 7 -8 -2 0

Expected output:
129


Actual output:
19


Fixed program (verdict: Accepted):
N = int(input())
G1 = [int(i) for i in input().split()] 
G2 = [int(i) for i in input().split()] 
one = [0 for i in range(N)]
two = [0 for i in range(N)]
i = j = 0

for i in range(N):
    for j in range(0,i+1):
        one[i] = one[i] + G1[j]
    for k in range(i,N):
        two[i] = two[i] + G2[k]

sum = 0
for i in range(N):
    if sum < one[i] + two[i]:
        sum = one[i] + two[i]

print(sum)


Diff:
 N = int(input())
 G1 = [int(i) for i in input().split()] 
 G2 = [int(i) for i in input().split()] 
 one = [0 for i in range(N)]
 two = [0 for i in range(N)]
 i = j = 0
 
 for i in range(N):
-    for j in range(i+1):
+    for j in range(0,i+1):
         one[i] = one[i] + G1[j]
     for k in range(i,N):
         two[i] = two[i] + G2[k]
 
 sum = 0
 for i in range(N):
-    if sum < one[i] + two[N-1]:
-        sum = one[i] + two[N-1]
+    if sum < one[i] + two[i]:
+        sum = one[i] + two[i]
 
 print(sum)
Buggy program (verdict: Wrong Answer):
N = int(input())
H = [int(i) for i in input().split()]

ans = 0
max = 0
T = H[0]
for i in range(N-1):
    if H[i] >= H[i+1]:
        ans += 1
        if ans >= max :
            max = ans
    
    else:
        ans = 0
        
print(ans)
    

Failing test case input:
7
20 7 0 0 3 -1 2

Expected output:
3


Actual output:
0


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

ans = 0
max = 0
T = H[0]
for i in range(N-1):
    if H[i] >= H[i+1]:
        ans += 1
        if ans >= max :
            max = ans
    
    else:
        ans = 0
        

print(max)
    

Diff:
 N = int(input())
 H = [int(i) for i in input().split()]
 
 ans = 0
 max = 0
 T = H[0]
 for i in range(N-1):
     if H[i] >= H[i+1]:
         ans += 1
         if ans >= max :
             max = ans
     
     else:
         ans = 0
         
-print(ans)
+
+print(max)
Buggy program (verdict: Wrong Answer):
n=int(input())
a=set(map(int,input().split()))
k=len(a)

if n-k % 2 == 0:
  print(k)
else:
  print(k-1)

Failing test case input:
5
2 -1 -6 16 27

Expected output:
5


Actual output:
4


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

if (n-k) % 2 == 0:
  print(k)
else:
  print(k-1)

Diff:
 n=int(input())
 a=set(map(int,input().split()))
 k=len(a)
 
-if n-k % 2 == 0:
+if (n-k) % 2 == 0:
   print(k)
 else:
   print(k-1)
Buggy program (verdict: Wrong Answer):
n = int(input())
lengths = list(map(int, input().split(' ')))
total = 0
longest = 0
for i in lengths:
  total += i
  if (i > longest):
    longest = i
possible = True
if (total - longest) < longest:
    possible = False
   
if possible:
  print("Yes")
else:
  print("No")

Failing test case input:
4
3 8 4 1

Expected output:
No

Actual output:
Yes


Fixed program (verdict: Accepted):
n = int(input())
lengths = list(map(int, input().split(' ')))
total = 0
longest = 0
for i in lengths:
  total += i
  if (i > longest):
    longest = i
possible = True
if (total - longest) <= longest:
    possible = False
   
if possible:
  print("Yes")
else:
  print("No")

Diff:
 n = int(input())
 lengths = list(map(int, input().split(' ')))
 total = 0
 longest = 0
 for i in lengths:
   total += i
   if (i > longest):
     longest = i
 possible = True
-if (total - longest) < longest:
+if (total - longest) <= longest:
     possible = False
    
 if possible:
   print("Yes")
 else:
   print("No")
Buggy program (verdict: Wrong Answer):
a,b,c = map(int, input().split())

if a < b:
    if b < c:
        print('No')
    else:
        print('Yes')
else:
    if b < c:
        print('Yes')
    else :
        print('No')


Failing test case input:
5 6 -1

Expected output:
No


Actual output:
Yes


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

if a < b:
    if a < c < b:
        print('Yes')
    else :
        print('No')
else:
    if a > c > b:
        print('Yes')
    else:
        print('No')


Diff:
 a,b,c = map(int, input().split())
 
 if a < b:
-    if b < c:
-        print('No')
-    else:
+    if a < c < b:
         print('Yes')
+    else :
+        print('No')
 else:
-    if b < c:
+    if a > c > b:
         print('Yes')
-    else :
+    else:
         print('No')
Buggy program (verdict: Wrong Answer):
s = int(input())

f = [s]

for i in range(100000):
    if f[i] % 2 == 0:
        s /= 2
    else:
        s = 3 * s + 1
    if s in f:
        print(i)
        break
    else:
        f.append(s)


Failing test case input:
297

Expected output:
75


Actual output:
73


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

f = [s]

for i in range(100000):
    if f[i] % 2 == 0:
        s /= 2
    else:
        s = 3 * s + 1
    if s in f:
        print(i + 2)
        break
    else:
        f.append(s)


Diff:
 s = int(input())
 
 f = [s]
 
 for i in range(100000):
     if f[i] % 2 == 0:
         s /= 2
     else:
         s = 3 * s + 1
     if s in f:
-        print(i)
+        print(i + 2)
         break
     else:
         f.append(s)
Buggy program (verdict: Wrong Answer):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

mini = a[0]
b = -100000

for i in a:
    if mini > i:
        mini = i
    if b < i - mini:
        b = i - mini

print(b)




Failing test case input:
3
1
-5
-43

Expected output:
-6


Actual output:
0


Fixed program (verdict: Accepted):
n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

mini = a[0]
b = -10000000000
del a[0]
for i in a:
    if b < i - mini:
        b = i - mini
    if mini > i:
        mini = i

print(b)



Diff:
 n = int(input())
 a = []
 for i in range(n):
     a.append(int(input()))
 
 mini = a[0]
-b = -100000
-
+b = -10000000000
+del a[0]
 for i in a:
-    if mini > i:
-        mini = i
     if b < i - mini:
         b = i - mini
+    if mini > i:
+        mini = i
 
 print(b)
 
 
-
Buggy program (verdict: Wrong Answer):
a = int(input())
b = [a]
c = 0
while True:
  c += 1
  if a % 2 == 0:
    a /= 2
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)


Failing test case input:
295

Expected output:
57


Actual output:
56


Fixed program (verdict: Accepted):
a = int(input())
b = [a]
c = 1
while True:
  c += 1
  if a % 2 == 0:
    a /= 2
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)
  else:
    a = a * 3 + 1
    if a in b:
      print(c)
      exit()
    else:
      b.append(a)


Diff:
 a = int(input())
 b = [a]
-c = 0
+c = 1
 while True:
   c += 1
   if a % 2 == 0:
     a /= 2
     if a in b:
       print(c)
       exit()
     else:
       b.append(a)
   else:
     a = a * 3 + 1
     if a in b:
       print(c)
       exit()
     else:
       b.append(a)
Buggy program (verdict: Wrong Answer):
num = int(input())
str = input()

ans_ls = []
for x in str:
    i = ord(x)
    if i <= 90:
        ans_ls.append(i)
    else:
        ans_ls.append(i - 26)
ls = []
for y in ans_ls:
    l = chr(y)
    ls.append(l)

ans = ''.join(ls)
print(ans)

Failing test case input:
13
AJSKMBGOEDKSWOGPQEUTUEXJYZ

Expected output:
NWFXZOTBRQXFJBTCDRHGHRKWLM


Actual output:
AJSKMBGOEDKSWOGPQEUTUEXJYZ


Fixed program (verdict: Accepted):
num = int(input())
str = input()

ans_ls = []
for x in str:
    i = ord(x) + num
    if i <= 90:
        ans_ls.append(i)
    else:
        ans_ls.append(i - 26)
ls = []
for y in ans_ls:
    l = chr(y)
    ls.append(l)

ans = ''.join(ls)
print(ans)

Diff:
 num = int(input())
 str = input()
 
 ans_ls = []
 for x in str:
-    i = ord(x)
+    i = ord(x) + num
     if i <= 90:
         ans_ls.append(i)
     else:
         ans_ls.append(i - 26)
 ls = []
 for y in ans_ls:
     l = chr(y)
     ls.append(l)
 
 ans = ''.join(ls)
 print(ans)
Buggy program (verdict: Wrong Answer):
def selectsort(A):
	t=0
	for i in range(0,len(A)):
		mini=i
		for j in range(i, len(A)):
			if A[j]<A[mini]:
				mini=j
		if i!=mini:
			temp=A[i]
			A[i]=A[mini]
			A[mini]=temp
			t+=1
	return t		

input=input()
A=[int(s) for s in input.split(' ')]
t=selectsort(A)
print (A,t)

Failing test case input:
6
6 4 8 -1 1 -1

Expected output:
-1 -1 1 4 6 8
5


Actual output:
[6] 0


Fixed program (verdict: Accepted):
def selectsort(A):
	t=0
	for i in range(0,len(A)):
		mini=i
		for j in range(i, len(A)):
			if A[j]<A[mini]:
				mini=j
		if i!=mini:
			temp=A[i]
			A[i]=A[mini]
			A[mini]=temp
			t+=1
	return t		

input()
input=input()
A=[int(s) for s in input.split(' ')]
t=selectsort(A)
print (' '.join(map(str,A)))
print(t)

Diff:
 def selectsort(A):
 	t=0
 	for i in range(0,len(A)):
 		mini=i
 		for j in range(i, len(A)):
 			if A[j]<A[mini]:
 				mini=j
 		if i!=mini:
 			temp=A[i]
 			A[i]=A[mini]
 			A[mini]=temp
 			t+=1
 	return t		
 
+input()
 input=input()
 A=[int(s) for s in input.split(' ')]
 t=selectsort(A)
-print (A,t)
+print (' '.join(map(str,A)))
+print(t)
Buggy program (verdict: Wrong Answer):
import math
a,b = map(int,input().split())
ans = 1
while True:
    if math.floor(ans*0.08) == a:
        while ans*0.08 == a:
            if math.floor(ans*0.1) == b:
                print(ans)
                exit()
            ans+=1
        print(-1)
        exit()
    ans+=1

Failing test case input:
12 16

Expected output:
160


Actual output:
-1


Fixed program (verdict: Accepted):
import math
a,b = map(int,input().split())
ans = 1
while True:
    if math.floor(ans*0.08) == a:
        while math.floor(ans*0.08) == a:
            if math.floor(ans*0.1) == b:
                print(ans)
                exit()
            ans+=1
        print(-1)
        exit()
    ans+=1

Diff:
 import math
 a,b = map(int,input().split())
 ans = 1
 while True:
     if math.floor(ans*0.08) == a:
-        while ans*0.08 == a:
+        while math.floor(ans*0.08) == a:
             if math.floor(ans*0.1) == b:
                 print(ans)
                 exit()
             ans+=1
         print(-1)
         exit()
     ans+=1