ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
tm = 0

for i in range(1, n):
    tm = a.count(i)
    print(tm)

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

Expected output:
1
1
1
1
1
0
1


Actual output:
1
1
1
1
1
0


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
tm = [0] * n

for i in range(n-1):
    tm[a[i] - 1] += 1

for i in tm:
    print(i)

Diff:
 n = int(input())
 a = list(map(int, input().split()))
-tm = 0
+tm = [0] * n
 
-for i in range(1, n):
-    tm = a.count(i)
-    print(tm)
+for i in range(n-1):
+    tm[a[i] - 1] += 1
+
+for i in tm:
+    print(i)
Buggy program (verdict: Wrong Answer):
n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]
for i in a:b[i%2]+=1
if 0==b[1]:print(2**n)
else:print(2**(n-1))

Failing test case input:
1 1
50

Expected output:
0

Actual output:
2


Fixed program (verdict: Accepted):
n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]
for i in a:b[i%2]+=1
if 0==b[1]:print(2**n*((p+1)%2))
else:print(2**(n-1))

Diff:
 n,p=map(int,input().split());a=list(map(int,input().split()));b=[0,0]
 for i in a:b[i%2]+=1
-if 0==b[1]:print(2**n)
+if 0==b[1]:print(2**n*((p+1)%2))
 else:print(2**(n-1))
Buggy program (verdict: Wrong Answer):
k, n = map(int, input().split())
a = list(map(int, input().split()))

d = [None]*n

for i in range(n-1):
    d[i] = a[i+1] - a[i]

d[n-1] = k - a[n-1] + d[0]

print(k - max(d))

Failing test case input:
20 3
1 5 14

Expected output:
11


Actual output:
10


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

d = [None]*n

for i in range(n-1):
    d[i] = a[i+1] - a[i]

d[n-1] = k - a[n-1] + a[0]

print(k - max(d))

Diff:
 k, n = map(int, input().split())
 a = list(map(int, input().split()))
 
 d = [None]*n
 
 for i in range(n-1):
     d[i] = a[i+1] - a[i]
 
-d[n-1] = k - a[n-1] + d[0]
+d[n-1] = k - a[n-1] + a[0]
 
 print(k - max(d))
Buggy program (verdict: Wrong Answer):
name1 = input()
name2 = name1.replace(" ","")
name3 = name2[7:]
name4 = name3[:7]
print(name4)
lst1 = list(name4)
print("A" + lst1[0] + "C")

Failing test case input:
AsCoder nSukd Cnntdsu

Expected output:
AnC


Actual output:
nSukdCn
AnC


Fixed program (verdict: Accepted):
name1 = input()
name2 = name1.replace(" ","")
name3 = name2[7:]
name4 = name3[:7]
lst1 = list(name4)
print("A" + lst1[0] + "C")


Diff:
 name1 = input()
 name2 = name1.replace(" ","")
 name3 = name2[7:]
 name4 = name3[:7]
-print(name4)
 lst1 = list(name4)
 print("A" + lst1[0] + "C")
+
Buggy program (verdict: Wrong Answer):
N,A,B=map(int,input().split())
S=input()
t_count=0
b_count=0
flag=None

for i in S:
  if i=="c":
    print("No")
  else:
    if i=="a":
      t_count+=1
      if t_count<=A+B:
        print("Yes")
      else:
        print("No")
    else:
      b_count+=1
      if b_count<=B:
        t_count+=1
        print("Yes")
      else:
        print("No")

Failing test case input:
10 2 2
abccacaabb

Expected output:
Yes
Yes
No
No
Yes
No
Yes
No
No
No


Actual output:
Yes
Yes
No
No
Yes
No
Yes
No
Yes
No


Fixed program (verdict: Accepted):
N,A,B=map(int,input().split())
S=input()
t_count=0
b_count=0
flag=None

for i in S:
  if i=="c":
    print("No")
  else:
    if i=="a":
      t_count+=1
      if t_count<=A+B:
        print("Yes")
      else:
        print("No")
    else:
      b_count+=1
      if b_count<=B:
        t_count+=1
        if t_count<=A+B:
          print("Yes")
        else:
          print("No")
      else:
        print("No")

Diff:
 N,A,B=map(int,input().split())
 S=input()
 t_count=0
 b_count=0
 flag=None
 
 for i in S:
   if i=="c":
     print("No")
   else:
     if i=="a":
       t_count+=1
       if t_count<=A+B:
         print("Yes")
       else:
         print("No")
     else:
       b_count+=1
       if b_count<=B:
         t_count+=1
-        print("Yes")
+        if t_count<=A+B:
+          print("Yes")
+        else:
+          print("No")
       else:
         print("No")
Buggy program (verdict: Wrong Answer):
N,P = map(int,input().split())
i = int(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)

Failing test case input:
2 243501193440

Expected output:
12


Actual output:
12
6
4
3
2
1


Fixed program (verdict: Accepted):
N,P = map(int,input().split())
i = round(P**(1/N))
res = []
if N == 1:
  print(P)
elif P == 1:
  print(1)
else:
  for i in range(i,0,-1):
    if P%i**N==0:
      print(i)
      break

Diff:
 N,P = map(int,input().split())
-i = int(P**(1/N))
+i = round(P**(1/N))
 res = []
 if N == 1:
   print(P)
 elif P == 1:
   print(1)
 else:
   for i in range(i,0,-1):
     if P%i**N==0:
       print(i)
+      break
Buggy program (verdict: Wrong Answer):
import sys
numbers = []
for line in sys.stdin:
	numbers.append(int(line))

answer = numbers[2] - numbers[1]
tmp_min = numbers[1]
print("answer0 : "+ str(answer))


for target in range(2, len(numbers)):
	answer =  max(numbers[target] - tmp_min ,answer)
	tmp_min = min(numbers[target] , tmp_min)

print(answer)


Failing test case input:
6
-10
12
0
4
0
8

Expected output:
22


Actual output:
answer0 : 22
22


Fixed program (verdict: Accepted):
import sys
numbers = []
for line in sys.stdin:
	numbers.append(int(line))

answer = numbers[2] - numbers[1]
tmp_min = numbers[1]
for target in range(2, len(numbers)):
	answer =  max(numbers[target] - tmp_min ,answer)
	tmp_min = min(numbers[target] , tmp_min)

print(answer)



Diff:
 import sys
 numbers = []
 for line in sys.stdin:
 	numbers.append(int(line))
 
 answer = numbers[2] - numbers[1]
 tmp_min = numbers[1]
-print("answer0 : "+ str(answer))
-
-
 for target in range(2, len(numbers)):
 	answer =  max(numbers[target] - tmp_min ,answer)
 	tmp_min = min(numbers[target] , tmp_min)
 
 print(answer)
 
+
Buggy program (verdict: Wrong Answer):
s = input()
s = s.replace('hii', '')
if s.count('hi') > 0: print('Yes')
else: print('No')


Failing test case input:
hhhi

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
s = input()
s = s.replace('hi', '')
if s == '': print('Yes')
else: print('No')


Diff:
 s = input()
-s = s.replace('hii', '')
-if s.count('hi') > 0: print('Yes')
+s = s.replace('hi', '')
+if s == '': print('Yes')
 else: print('No')
Buggy program (verdict: Wrong Answer):
x=list(input())

y=sorted(x)

if y[0] == y[1]:
	print("No")
else:
	print("Yes")


Failing test case input:
b^b

Expected output:
No


Actual output:
Yes


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

y=sorted(x)

if y[0] == y[1] or y[1] == y[2]:
	print("No")
else:
	print("Yes")


Diff:
 x=list(input())
 
 y=sorted(x)
 
-if y[0] == y[1]:
+if y[0] == y[1] or y[1] == y[2]:
 	print("No")
 else:
 	print("Yes")
Buggy program (verdict: Wrong Answer):
num = []
for i in range(5):
    num.append(int(input()))
k = int(input())

count = 0
if (max(num) - min(num)) > k:
    print(':()')
else:
    print('Yay!')

Failing test case input:
15
0
1
0
22
5

Expected output:
:(


Actual output:
:()


Fixed program (verdict: Accepted):
num = []
for i in range(5):
    num.append(int(input()))
k = int(input())

if (max(num) - min(num)) > k:
    print(':(')
else:
    print('Yay!')

Diff:
 num = []
 for i in range(5):
     num.append(int(input()))
 k = int(input())
 
-count = 0
 if (max(num) - min(num)) > k:
-    print(':()')
+    print(':(')
 else:
     print('Yay!')
Buggy program (verdict: Wrong Answer):
s=input()
makeban=0
for i in s:
    if i=="o":
        makeban+=1
if makeban<=7:
    print("YES")
else:
    print("NO")

Failing test case input:
xxxxxxxx

Expected output:
NO

Actual output:
YES


Fixed program (verdict: Accepted):
s=input()
makeban=0
for i in s:
    if i=="x":
        makeban+=1
if makeban<=7:
    print("YES")
else:
    print("NO")

Diff:
 s=input()
 makeban=0
 for i in s:
-    if i=="o":
+    if i=="x":
         makeban+=1
 if makeban<=7:
     print("YES")
 else:
     print("NO")
Buggy program (verdict: Wrong Answer):
import itertools
n,m=map(int,input().split())
ab= [list(map(int,input().split())) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
k=len(set(ab))
for i in range(1,k+1):
    print(ab.count(i))

Failing test case input:
11 7
2 4
3 4
1 5
2 8
2 7
8 2
4 1
0 14

Expected output:
2
4
1
3
1
0
1
2
0
0
0


Actual output:
2
4
1
3
1
0
1


Fixed program (verdict: Accepted):
import itertools
n,m=map(int,input().split())
ab= [list(map(int,input().split())) for _ in range(m)]
ab=list(itertools.chain.from_iterable(ab))
for i in range(1,n+1):
    print(ab.count(i))

Diff:
 import itertools
 n,m=map(int,input().split())
 ab= [list(map(int,input().split())) for _ in range(m)]
 ab=list(itertools.chain.from_iterable(ab))
-k=len(set(ab))
-for i in range(1,k+1):
+for i in range(1,n+1):
     print(ab.count(i))
Buggy program (verdict: Wrong Answer):
_,*B=open(0);W=[1]*7**6;R=[0,1]+[0]*7**6
for b in B:x,y=map(int,b.split());W[x]-=1;W[y]+=1;R[y]=R[x]|R[y];R[x]=R[x]and W[x]
print(sum(R))

Failing test case input:
3 2
1 3
3 3

Expected output:
1


Actual output:
2


Fixed program (verdict: Accepted):
_,*B=open(0);W=[1]*7**6;R=[0,1]+[0]*7**6
for b in B:x,y=map(int,b.split());W[x]-=1;W[y]+=1;R[y]|=R[x];R[x]&=W[x]>0
print(sum(R))

Diff:
 _,*B=open(0);W=[1]*7**6;R=[0,1]+[0]*7**6
-for b in B:x,y=map(int,b.split());W[x]-=1;W[y]+=1;R[y]=R[x]|R[y];R[x]=R[x]and W[x]
+for b in B:x,y=map(int,b.split());W[x]-=1;W[y]+=1;R[y]|=R[x];R[x]&=W[x]>0
 print(sum(R))
Buggy program (verdict: Wrong Answer):
N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(set(A))
max_count = A.count(a[-1])
for i in range(N):
  if len(a) > 1:
    if A[i] != a[-1]:
      print(a[-1])
    else:
      if max_count < 1:
        print(a[-1])
      else:
        print(a[-2])
  else:
    print(a[-1])

Failing test case input:
3
3
-2
3

Expected output:
3
3
3


Actual output:
-2
3
-2


Fixed program (verdict: Accepted):
N = int(input())
A = [int(input()) for _ in range(N)]
a = sorted(set(A))
max_count = A.count(a[-1])

for i in range(N):
  if len(a) > 1:
    if A[i] != a[-1]:
      print(a[-1])
    else:
      if max_count > 1:
        print(a[-1])
      else:
        print(a[-2])
  else:
    print(a[-1])

Diff:
 N = int(input())
 A = [int(input()) for _ in range(N)]
 a = sorted(set(A))
 max_count = A.count(a[-1])
+
 for i in range(N):
   if len(a) > 1:
     if A[i] != a[-1]:
       print(a[-1])
     else:
-      if max_count < 1:
+      if max_count > 1:
         print(a[-1])
       else:
         print(a[-2])
   else:
     print(a[-1])
Buggy program (verdict: Wrong Answer):
n,m = map(int,input().split(" "))
card = {i+1 for i in range(n)}

x,y = map(int,input().split(" "))
for i in range(m-1):
    l,r = map(int,input().split(" "))
    x = max(x,l)
    r = min(y,r)
if y-x >= 0:
    print(y-x+1)
else:
    print(0)


    

Failing test case input:
4 2
1 3
2 0

Expected output:
0


Actual output:
2


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

x,y = map(int,input().split(" "))
for i in range(m-1):
    l,r = map(int,input().split(" "))
    x = max(x,l)
    y = min(y,r)

if y-x >= 0:
    print(y-x+1)
else:
    print(0)


    

Diff:
 n,m = map(int,input().split(" "))
-card = {i+1 for i in range(n)}
 
 x,y = map(int,input().split(" "))
 for i in range(m-1):
     l,r = map(int,input().split(" "))
     x = max(x,l)
-    r = min(y,r)
+    y = min(y,r)
+
 if y-x >= 0:
     print(y-x+1)
 else:
     print(0)
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
ans = 0

for i in range(1,n):
  if(a[i-1] > a[i]):
    while(a[i-1] == a[i]):
      a[i] += 1
      ans += 1
    
print(ans)

Failing test case input:
5
16 2 5 8 2

Expected output:
47


Actual output:
0


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
ans = 0
diff = 0

for i in range(1,n):
  if(a[i-1] > a[i]):
    diff = a[i-1] - a[i]
    a[i] += diff
    ans += diff
    
print(ans)

Diff:
 n = int(input())
 a = list(map(int,input().split()))
 ans = 0
+diff = 0
 
 for i in range(1,n):
   if(a[i-1] > a[i]):
-    while(a[i-1] == a[i]):
-      a[i] += 1
-      ans += 1
+    diff = a[i-1] - a[i]
+    a[i] += diff
+    ans += diff
     
 print(ans)

Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
ans = 0
maxh = 0
for i in range(len(a)-1):
    if a[i] > a[i+1]:
        if maxh < a[i]:
            maxh = a[i]
        ans += maxh - a[i+1]


print(ans)


Failing test case input:
5
22 10 1 -3 0

Expected output:
80


Actual output:
58


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


print(ans)


Diff:
 n = int(input())
 a = list(map(int, input().split()))
 ans = 0
 maxh = 0
 for i in range(len(a)-1):
-    if a[i] > a[i+1]:
-        if maxh < a[i]:
-            maxh = a[i]
+    if maxh < a[i]:
+        maxh = a[i]
+    if maxh > a[i+1]:
         ans += maxh - a[i+1]
 
 
 print(ans)
Buggy program (verdict: Wrong Answer):
from sys import stdin
N,M = stdin.readline().rstrip().split()
a_list = stdin.readline().rstrip().split()
N,M = int(N),int(M)
for a in a_list:
  N-=int(a)
if(N>0):
  print(N)
print(-1)


Failing test case input:
253 15
9 23 14 4 0 9 19 3 0 8 45 2 3 47 2

Expected output:
65


Actual output:
65
-1


Fixed program (verdict: Accepted):
from sys import stdin
N,M = stdin.readline().rstrip().split()
a_list = stdin.readline().rstrip().split()
N,M = int(N),int(M)
for a in a_list:
  N-=int(a)
if(N>=0):
  print(N)
else:
	print('-1')

Diff:
 from sys import stdin
 N,M = stdin.readline().rstrip().split()
 a_list = stdin.readline().rstrip().split()
 N,M = int(N),int(M)
 for a in a_list:
   N-=int(a)
-if(N>0):
+if(N>=0):
   print(N)
-print(-1)
-
+else:
+	print('-1')
Buggy program (verdict: Wrong Answer):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

ans_list = []
for s in S:
  ans = 0
  ans += S.count(s)
  ans -= T.count(s)
  ans_list.append(ans)

print(max(ans_list))

Failing test case input:
1
voldemort
10
vnledmort
voldemort
tromedlov
voldemort
uoldemort
voldemort
voldemort
voleelort
tromedlov
voldemort

Expected output:
0


Actual output:
-4


Fixed program (verdict: Accepted):
N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

ans = 0
for s in S:
  ans = max(ans, S.count(s)-T.count(s))

print(ans)


Diff:
 N = int(input())
 S = [input() for _ in range(N)]
 M = int(input())
 T = [input() for _ in range(M)]
 
-ans_list = []
+ans = 0
 for s in S:
-  ans = 0
-  ans += S.count(s)
-  ans -= T.count(s)
-  ans_list.append(ans)
+  ans = max(ans, S.count(s)-T.count(s))
+
+print(ans)
 
-print(max(ans_list))
Buggy program (verdict: Wrong Answer):
N = int(input())
ratio = [ list(map(int, input().split())) for i in range(N)]


t1 = 1
t2 = 1
for T1, T2 in ratio:
        tmp_a = int(t1 / T1 + 0.9)
        tmp_b = int(t2 / T2 + 0.9)
        n = max(tmp_a, tmp_b)
        t1 = n * T1 
        t2 = n * T2
print(t1 + t2)

Failing test case input:
5
3 1
48 17
31 199
231 23
3 2

Expected output:
6930


Actual output:
0


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


t1 = 1
t2 = 1
for T1, T2 in ratio:
        tmp_a = -( - t1 
        tmp_b = -( - t2 
        n = max(tmp_a, tmp_b)
        t1 = n * T1 
        t2 = n * T2
print(t1 + t2)

Diff:
 N = int(input())
 ratio = [ list(map(int, input().split())) for i in range(N)]
 
 
 t1 = 1
 t2 = 1
 for T1, T2 in ratio:
-        tmp_a = int(t1 / T1 + 0.9)
-        tmp_b = int(t2 / T2 + 0.9)
+        tmp_a = -( - t1 
+        tmp_b = -( - t2 
         n = max(tmp_a, tmp_b)
         t1 = n * T1 
         t2 = n * T2
 print(t1 + t2)
Buggy program (verdict: Wrong Answer):
X = int(input())

kyu = [600,800,1000,1200,1400,1600,2000]
N = 8

for i in range(len(kyu)):
    if X < kyu[i]:
        print(N - i)
        break

Failing test case input:
1933

Expected output:
1


Actual output:
2


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

kyu = [600,800,1000,1200,1400,1600,1800,2000]
N = 8

for i in range(len(kyu)):
    if X < kyu[i]:
        print(N - i)
        break

Diff:
 X = int(input())
 
-kyu = [600,800,1000,1200,1400,1600,2000]
+kyu = [600,800,1000,1200,1400,1600,1800,2000]
 N = 8
 
 for i in range(len(kyu)):
     if X < kyu[i]:
         print(N - i)
         break
Buggy program (verdict: Wrong Answer):
N,T=map(int, input().split())
R=[999999999]
for i in range(N):
  c,t=map(int, input().split())
  if T>t:
    R.append(c)
    
print('TLE' if len(R)==1 else min(R))

Failing test case input:
5 9
25 8
5 9
4 10
1000 1000
6 1

Expected output:
5

Actual output:
6


Fixed program (verdict: Accepted):
N,T=map(int, input().split())
R=[999999999]
for i in range(N):
  c,t=map(int, input().split())
  if T>=t:
    R.append(c)
    
print('TLE' if len(R)==1 else min(R))

Diff:
 N,T=map(int, input().split())
 R=[999999999]
 for i in range(N):
   c,t=map(int, input().split())
-  if T>t:
+  if T>=t:
     R.append(c)
     
 print('TLE' if len(R)==1 else min(R))
Buggy program (verdict: Wrong Answer):
N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
    if a==b and b==c:
        target_list.append(3)
    elif a==b or a==c:
        target_list.append(2)
    else:
        target_list.append(1)
print(N*3 - sum(target_list))

Failing test case input:
9
tnedergia
bifreefnt
difsmfeet

Expected output:
14


Actual output:
17


Fixed program (verdict: Accepted):
N = int(input())
A = input()
B = input()
C = input()
target_list = []
for a, b, c in zip(A, B, C):
    if a==b and b==c and c==a:
        target_list.append(3)
    elif a==b or b==c or c==a: 
        target_list.append(2)
    else:
        target_list.append(1)
print(N*3 - sum(target_list))

Diff:
 N = int(input())
 A = input()
 B = input()
 C = input()
 target_list = []
 for a, b, c in zip(A, B, C):
-    if a==b and b==c:
+    if a==b and b==c and c==a:
         target_list.append(3)
-    elif a==b or a==c:
+    elif a==b or b==c or c==a: 
         target_list.append(2)
     else:
         target_list.append(1)
 print(N*3 - sum(target_list))
Buggy program (verdict: Wrong Answer):
num = input().split()

if num[0] + num[1] < num[2]:
    print('No')
else:
    print('Yes')

Failing test case input:
0 1205 100

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
num = input().split()

if int(num[0]) + int(num[1]) < int(num[2]):
    print('No')
else:
    print('Yes')

Diff:
 num = input().split()
 
-if num[0] + num[1] < num[2]:
+if int(num[0]) + int(num[1]) < int(num[2]):
     print('No')
 else:
     print('Yes')
Buggy program (verdict: Wrong Answer):
x, n = map(int, input().split())
if n == 100:
    print("")
elif n > 0:
    ps = list(map(int, input().split()))
else:
    print(x)
exit()
nums = [n for n in range(1, 101) if n not in ps]

abs_plus = sorted([n-x for n in nums if n-x >= 0])
abs_minus = sorted([-(n-x) for n in nums if n-x < 0])
if abs_plus == []:
    print(x-abs_minus[0])
elif abs_minus == []:
    print(x+abs_plus[0])
elif abs_plus[0] >= abs_minus[0]:
    print(x-abs_minus[0])
else:
    print(x+abs_plus[0])

Failing test case input:
15 3
7 5 3 24 11

Expected output:
15


Actual output:

Fixed program (verdict: Accepted):
x, n = map(int, input().split())
if n > 0:
    ps = list(map(int, input().split()))
else:
    print(x)
    exit()
nums = [n for n in range(-1, 102) if n not in ps]

abs_plus = sorted([n-x for n in nums if n-x >= 0])
abs_minus = sorted([-(n-x) for n in nums if n-x < 0])
if abs_plus == []:
    print(x-abs_minus[0])
elif abs_minus == []:
    print(x+abs_plus[0])
elif abs_plus[0] >= abs_minus[0]:
    print(x-abs_minus[0])
else:
    print(x+abs_plus[0])

Diff:
 x, n = map(int, input().split())
-if n == 100:
-    print("")
-elif n > 0:
+if n > 0:
     ps = list(map(int, input().split()))
 else:
     print(x)
-exit()
-nums = [n for n in range(1, 101) if n not in ps]
+    exit()
+nums = [n for n in range(-1, 102) if n not in ps]
 
 abs_plus = sorted([n-x for n in nums if n-x >= 0])
 abs_minus = sorted([-(n-x) for n in nums if n-x < 0])
 if abs_plus == []:
     print(x-abs_minus[0])
 elif abs_minus == []:
     print(x+abs_plus[0])
 elif abs_plus[0] >= abs_minus[0]:
     print(x-abs_minus[0])
 else:
     print(x+abs_plus[0])
Buggy program (verdict: Wrong Answer):
n, m = map(int, input().split())
wa = [0] * (n+1)
ac = [0] * (n+1)

for _ in range(m):
    p, s = input().split()
    if (not ac[int(p)]) and s == 'WA':
        wa[int(p)] += 1
    elif s == 'AC':
        ac[int(p)] = 1
print(sum(ac), sum(wa))


Failing test case input:
4 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())
wa = [0] * (n+1)
ac = [0] * (n+1)

for _ in range(m):
    p, s = input().split()
    if (not ac[int(p)]) and s == 'WA':
        wa[int(p)] += 1
    elif s == 'AC':
        ac[int(p)] = 1
sw = 0
for i in range(n+1):
    sw += ac[i] * wa[i]
print(sum(ac), sw)


Diff:
 n, m = map(int, input().split())
 wa = [0] * (n+1)
 ac = [0] * (n+1)
 
 for _ in range(m):
     p, s = input().split()
     if (not ac[int(p)]) and s == 'WA':
         wa[int(p)] += 1
     elif s == 'AC':
         ac[int(p)] = 1
-print(sum(ac), sum(wa))
+sw = 0
+for i in range(n+1):
+    sw += ac[i] * wa[i]
+print(sum(ac), sw)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))

Clist = []
for count in range(len(A)+1):
    Clist.append(0)

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)):
    print(Clist[count])

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

Expected output:
1
2
0
2
1
0
0


Actual output:
1
2
0
2
1
0


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

Clist = []
for count in range(len(A)+1):
    Clist.append(0)

for count in range(len(A)):
    Clist[A[count]-1] = Clist[A[count]-1] + 1

for count in range(0,len(A)+1):
    print(Clist[count])

Diff:
 N = int(input())
 A = list(map(int,input().split()))
 
 Clist = []
 for count in range(len(A)+1):
     Clist.append(0)
 
 for count in range(len(A)):
     Clist[A[count]-1] = Clist[A[count]-1] + 1
 
-for count in range(0,len(A)):
+for count in range(0,len(A)+1):
     print(Clist[count])
Buggy program (verdict: Wrong Answer):


N = int(input())
h = list(map(int, input().split()))

dp = [0]
INF = max(h) + 1
for i in range(1, N):
    if i == 1:
        cost1 = abs(h[i] - h[i - 1])
        dp.append(cost1)
    if i == 2:
        cost1 = abs(h[i] - h[i - 1])
        cost2 = abs(h[i] - h[i - 2])
        dp.append(min(
            dp[i - 1] + cost1,
            dp[i - 2] + cost2,
        ))

answer = dp.pop()

print(answer)


Failing test case input:
4
2 77 54 37

Expected output:
69


Actual output:
52


Fixed program (verdict: Accepted):


N = int(input())
h = list(map(int, input().split()))

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


answer = dp.pop()

print(answer)


Diff:
 
 
 N = int(input())
 h = list(map(int, input().split()))
 
 dp = [0]
-INF = max(h) + 1
 for i in range(1, N):
     if i == 1:
         cost1 = abs(h[i] - h[i - 1])
         dp.append(cost1)
-    if i == 2:
+    if i >= 2:
         cost1 = abs(h[i] - h[i - 1])
         cost2 = abs(h[i] - h[i - 2])
         dp.append(min(
             dp[i - 1] + cost1,
             dp[i - 2] + cost2,
         ))
 
+
 answer = dp.pop()
 
 print(answer)
Buggy program (verdict: Wrong Answer):
L=list(map(int, input().split()))
A=L[0]
B=L[1]
C=L[2]

L[0]=B
L[1]=A
A=L[0]
B=L[1]

L[0]=C
L[2]=A
A=L[0]
C=L[2]

print(L)

Failing test case input:
41 18 46

Expected output:
46 41 18


Actual output:
[46, 41, 18]


Fixed program (verdict: Accepted):
L=list(map(int, input().split()))
A=L[0]
B=L[1]
C=L[2]

L[0]=B
L[1]=A
A=L[0]
B=L[1]

L[0]=C
L[2]=A
A=L[0]
C=L[2]

print(' '.join(map(str, L)))

Diff:
 L=list(map(int, input().split()))
 A=L[0]
 B=L[1]
 C=L[2]
 
 L[0]=B
 L[1]=A
 A=L[0]
 B=L[1]
 
 L[0]=C
 L[2]=A
 A=L[0]
 C=L[2]
 
-print(L)
+print(' '.join(map(str, L)))
Buggy program (verdict: Wrong Answer):
s = input()
if s[0] == "A" and s[2:-1].count("C")==1:
    c = s[2:-1].index('C')
    if (s[1]+s[2:c+2]+s[c+3:]).islower():
        print('AC')
else:
    print('WA')

Failing test case input:
AtBoCo

Expected output:
WA


Actual output:

Fixed program (verdict: Accepted):
s = input()
if s[0] == "A" and s[2:-1].count("C")==1:
    c = s[2:-1].index('C')
    if (s[1]+s[2:c+2]+s[c+3:]).islower():
        print('AC')
    else:
        print('WA')
else:
    print('WA')

Diff:
 s = input()
 if s[0] == "A" and s[2:-1].count("C")==1:
     c = s[2:-1].index('C')
     if (s[1]+s[2:c+2]+s[c+3:]).islower():
         print('AC')
+    else:
+        print('WA')
 else:
     print('WA')
Buggy program (verdict: Wrong Answer):
n = int(input())
s = list(input())

for i in range(len(s)):
    ascii = ord(s[i])
    if((ascii+n)>90):
        print(chr(65+(ascii+n-90)),end='')
    else:
        print(chr(ascii+n),end='')



Failing test case input:
13
ZYXWVUTSRQOGNMLKJBOGFEEDIA

Expected output:
MLKJIHGFEDBTAZYXWOBTSRRQVN


Actual output:
NMLKJIHGFECTBZYXWOCTSRRQVN

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

for i in range(len(s)):
    ascii = ord(s[i])
    if((ascii+n)>90):
        print(chr(64+(ascii+n-90)),end='')
    else:
        print(chr(ascii+n),end='')

Diff:
 n = int(input())
 s = list(input())
 
 for i in range(len(s)):
     ascii = ord(s[i])
     if((ascii+n)>90):
-        print(chr(65+(ascii+n-90)),end='')
+        print(chr(64+(ascii+n-90)),end='')
     else:
         print(chr(ascii+n),end='')
-
-
Buggy program (verdict: Wrong Answer):
K,N=map(int,input().split())
A=list(map(int,input().split()))
m=0
for i in range(N-1):
  if m<(A[i+1]-A[i]):
    m=(A[i+1]-A[i])
if m<(K-A[-1]+A[0]):
  print(K-A[-1]+A[0])
else:
  print(K-m)

Failing test case input:
37 3
-1 1 18

Expected output:
19


Actual output:
18


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

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


if y>x:x,y = y,x

while x % y !=0:
    y = x%y
    if y > x:x,y = y,x
print(y)

Failing test case input:
154 20

Expected output:
2


Actual output:
14


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


if y>x:x,y = y,x

while x % y !=0:
    x = x%y
    if y>x:x,y = y,x
print(y)

Diff:
 x,y = list(map(int,input().split()))
 
 
 if y>x:x,y = y,x
 
 while x % y !=0:
-    y = x%y
-    if y > x:x,y = y,x
+    x = x%y
+    if y>x:x,y = y,x
 print(y)
Buggy program (verdict: Wrong Answer):
a,b,c,k = list(map(int, input().split()))
if a + b > k:
  print(a)
else:
  print(2 * a + b - k)

Failing test case input:
4 2 1 2

Expected output:
2


Actual output:
4


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

Diff:
 a,b,c,k = list(map(int, input().split()))
-if a + b > k:
+if a > k:
+  print(k)
+elif a + b >= k:
   print(a)
 else:
   print(2 * a + b - k)
Buggy program (verdict: Wrong Answer):
N, M = map(int, input().split())
l, r = map(int, input().split())
for _ in range(M-1):
    new_l, new_r = map(int, input().split())
    if l < new_l:
        l = new_l
    if new_r < r:
        r = new_r

score = r-l+1
if score:
    print(score)
else:
    print(0)


Failing test case input:
15 3
3 2
4 7
3 11

Expected output:
0


Actual output:
-1


Fixed program (verdict: Accepted):
N, M = map(int, input().split())
l, r = map(int, input().split())
for _ in range(M-1):
    new_l, new_r = map(int, input().split())
    if l < new_l:
        l = new_l
    if new_r < r:
        r = new_r

score = r-l+1
if score > 0:
    print(score)
else:
    print(0)


Diff:
 N, M = map(int, input().split())
 l, r = map(int, input().split())
 for _ in range(M-1):
     new_l, new_r = map(int, input().split())
     if l < new_l:
         l = new_l
     if new_r < r:
         r = new_r
 
 score = r-l+1
-if score:
+if score > 0:
     print(score)
 else:
     print(0)
Buggy program (verdict: Wrong Answer):
anntena_list = []
 
for i in range(5):
    anntena_list.append(int(input()))
    
m = int(input())
    
flag = False
for i in range(4):
  for j in range(4-i):
    if anntena_list[4-i] - anntena_list[j]  > m:
      flag = True
      
if flag:
  print(':C')
else:
  print('Yay!')

Failing test case input:
15
18
26
30
21
2

Expected output:
:(


Actual output:
:C


Fixed program (verdict: Accepted):
anntena_list = []
 
for i in range(5):
    anntena_list.append(int(input()))
    
m = int(input())
    
flag = False
for i in range(4):
  for j in range(3-i):
    if anntena_list[4-i] - anntena_list[j]  > m:
      flag = True
      
if flag:
  print(':(')
else:
  print('Yay!')

Diff:
 anntena_list = []
  
 for i in range(5):
     anntena_list.append(int(input()))
     
 m = int(input())
     
 flag = False
 for i in range(4):
-  for j in range(4-i):
+  for j in range(3-i):
     if anntena_list[4-i] - anntena_list[j]  > m:
       flag = True
       
 if flag:
-  print(':C')
+  print(':(')
 else:
   print('Yay!')
Buggy program (verdict: Wrong Answer):
from collections import deque
S=input()
table=deque()
table.append(1)
ans=0
for s in S:
    if s=='S':
        table.append(1)
        
    else:
        if len(table)==1:
            table[0]==1
           
        else:
            table.pop()
            ans+=table[-1]
            
            
print(ans)

Failing test case input:
STSSTT

Expected output:
0


Actual output:
3


Fixed program (verdict: Accepted):
from collections import deque
S=input()
table=deque()
table.append(1)
ans=0
for s in S:
    if s=='S':
        table.append(1)
        
    else:
        if len(table)==1:
            table[0]==1
           
        else:
            table.pop()
            ans+=table[-1]
            
            
print(len(S)-2*ans)

Diff:
 from collections import deque
 S=input()
 table=deque()
 table.append(1)
 ans=0
 for s in S:
     if s=='S':
         table.append(1)
         
     else:
         if len(table)==1:
             table[0]==1
            
         else:
             table.pop()
             ans+=table[-1]
             
             
-print(ans)
+print(len(S)-2*ans)
Buggy program (verdict: Wrong Answer):
a = input().split()
a[0], a[2] = map(int, a[::2])
if a[0] == "+":
    print(a[0]+a[2])
else:
    print(a[0]-a[2])


Failing test case input:
0 + 2

Expected output:
2


Actual output:
-2


Fixed program (verdict: Accepted):
a = input().split()
a[0], a[2] = map(int, a[::2])
if a[1] == "+":
    print(a[0]+a[2])
else:
    print(a[0]-a[2])


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

Failing test case input:
aag

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
a = list(input())
if 'a' in a and 'b' in a and 'c' in a:
    print('Yes')
else:
    print('No')

Diff:
 a = list(input())
-if 'a' in a and 'a' in a and 'a' in a:
+if 'a' in a and 'b' in a and 'c' in a:
     print('Yes')
 else:
     print('No')
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
A = set()
for i in range(K):
    
    a = set(map(int, input().split()))
    A=A|a
    
print(N-len(A))

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

Expected output:
3


Actual output:
4


Fixed program (verdict: Accepted):
N, K = map(int, input().split())
A = set()
for i in range(K):
    d = int(input())
    a = set(map(int, input().split()))
    A=A|a
    
print(N-len(A))

Diff:
 N, K = map(int, input().split())
 A = set()
 for i in range(K):
-    
+    d = int(input())
     a = set(map(int, input().split()))
     A=A|a
     
 print(N-len(A))
Buggy program (verdict: Wrong Answer):
n = int(input())

if n ==1:
    print(0)
    exit()

mod = 10*9+7
print((10**n+8**n-9**n-9**n)%mod)

Failing test case input:
2221

Expected output:
792966352


Actual output:
51


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

if n ==1:
    print(0)
    exit()

mod = 10**9+7
print((10**n+8**n-9**n-9**n)%mod)

Diff:
 n = int(input())
 
 if n ==1:
     print(0)
     exit()
 
-mod = 10*9+7
+mod = 10**9+7
 print((10**n+8**n-9**n-9**n)%mod)
Buggy program (verdict: Wrong Answer):

newArray = []

x, y = input().split()

while x != "0" and y != "0":
    if x < y or x == y:
        pass
    else:
        w = x
        x = y
        y = w
    newArray.append([x, y])
    x, y = input().split()

for i in range(len(newArray)):
    print(newArray[i][0] + " " + newArray[i][1])

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

Expected output:
0 1
-1 3


Actual output:

Fixed program (verdict: Accepted):
newArray = []

x, y = input().split()

while x + y != "00":
    x = int(x)
    y = int(y)
    if x < y or x == y:
        newArray.append([str(x), str(y)])
    else:
        newArray.append([str(y), str(x)])
    x, y = input().split()

for i in range(len(newArray)):
    print(newArray[i][0] + " " + newArray[i][1])

Diff:
-
 newArray = []
 
 x, y = input().split()
 
-while x != "0" and y != "0":
+while x + y != "00":
+    x = int(x)
+    y = int(y)
     if x < y or x == y:
-        pass
+        newArray.append([str(x), str(y)])
     else:
-        w = x
-        x = y
-        y = w
-    newArray.append([x, y])
+        newArray.append([str(y), str(x)])
     x, y = input().split()
 
 for i in range(len(newArray)):
     print(newArray[i][0] + " " + newArray[i][1])
Buggy program (verdict: Wrong Answer):
A,B = map(int,input().split())

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

Failing test case input:
-6 69

Expected output:
137


Actual output:
-13


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

if A == B:
    print(2*A)
else:
    print(max(A,B)*2 - 1)

Diff:
 A,B = map(int,input().split())
 
 if A == B:
     print(2*A)
 else:
-    print(2*A-1)
+    print(max(A,B)*2 - 1)
Buggy program (verdict: Wrong Answer):
N = int(input())
res = 0
for i in range(N):
    if i <= 9 and i >= 1:
        res += 1
    elif i <= 999 and i >= 100:
        res += 1
    elif i <= 99999 and i >= 10000:
        res += 1
print(res)

Failing test case input:
289

Expected output:
199


Actual output:
198


Fixed program (verdict: Accepted):
N = int(input())
res = 0
for i in range(N):
    if i+1 <= 9 and i+1 >= 1:
        res += 1
    elif i+1 <= 999 and i+1 >= 100:
        res += 1
    elif i+1 <= 99999 and i+1 >= 10000:
        res += 1
print(res)

Diff:
 N = int(input())
 res = 0
 for i in range(N):
-    if i <= 9 and i >= 1:
+    if i+1 <= 9 and i+1 >= 1:
         res += 1
-    elif i <= 999 and i >= 100:
+    elif i+1 <= 999 and i+1 >= 100:
         res += 1
-    elif i <= 99999 and i >= 10000:
+    elif i+1 <= 99999 and i+1 >= 10000:
         res += 1
 print(res)
Buggy program (verdict: Wrong Answer):
n, a, b = (int(i) for i in input().split())  
train = n*a
taxi = n*b
if train >= taxi:
  print(taxi)
else:
  print(train)

Failing test case input:
87 -1 -2

Expected output:
-87


Actual output:
-174


Fixed program (verdict: Accepted):
n, a, b = (int(i) for i in input().split())  
train = n*a
taxi = b
if train >= taxi:
  print(taxi)
else:
  print(train)

Diff:
 n, a, b = (int(i) for i in input().split())  
 train = n*a
-taxi = n*b
+taxi = b
 if train >= taxi:
   print(taxi)
 else:
   print(train)
Buggy program (verdict: Wrong Answer):
N=int(input())
K=1
h=[int(i) for i in input().split()]
dp=[float("inf")]*N
dp[0]=0
for i in range(N):
  for k in range(1,K+1):
    if i+k>=N:
      break
    dp[i+k]=min(dp[i+k],dp[i]+abs(h[i]-h[i+k]))
print(dp[N-1])
    


Failing test case input:
4
10 30 40 20

Expected output:
30

Actual output:
50


Fixed program (verdict: Accepted):
N=int(input())
K=2
h=[int(i) for i in input().split()]
dp=[float("inf")]*N
dp[0]=0
for i in range(N):
  for k in range(1,K+1):
    if i+k>=N:
      break
    dp[i+k]=min(dp[i+k],dp[i]+abs(h[i]-h[i+k]))
print(dp[N-1])
    


Diff:
 N=int(input())
-K=1
+K=2
 h=[int(i) for i in input().split()]
 dp=[float("inf")]*N
 dp[0]=0
 for i in range(N):
   for k in range(1,K+1):
     if i+k>=N:
       break
     dp[i+k]=min(dp[i+k],dp[i]+abs(h[i]-h[i+k]))
 print(dp[N-1])
Buggy program (verdict: Wrong Answer):
n=input()
a=input().split()
sum=0
for i in range(len(a)):
  a[i]=(int)(a[i])
for i in a:
  sum+=i
ans=0
ans+=(sum**2)
for i in a:
  ans-=i*i
print((ans/2)%(10**9+7))

Failing test case input:
4
2519048 2817 176 11813

Expected output:
332876530


Actual output:
332876530.0


Fixed program (verdict: Accepted):
n=input()
a=input().split()
sum=0
for i in range(len(a)):
  a[i]=(int)(a[i])
for i in a:
  sum+=i
ans=0
ans+=(sum**2)
for i in a:
  ans-=i*i
print((ans

Diff:
 n=input()
 a=input().split()
 sum=0
 for i in range(len(a)):
   a[i]=(int)(a[i])
 for i in a:
   sum+=i
 ans=0
 ans+=(sum**2)
 for i in a:
   ans-=i*i
-print((ans/2)%(10**9+7))
+print((ans
Buggy program (verdict: Wrong Answer):
n = int(input())
t = [0] * n
a = [0] * n
for i in range(n):
    tt, aa = map(int, input().split())
    t[i], a[i] = tt, aa

if n == 1:
    print(t[0]+a[0])
else:
    for i in range(1, n):
        for j in range(1, 10**5+1):
            if t[i]*j >= t[i-1] and a[i]*j >= a[i-1]:
                t[i], a[i] = t[i] * j, a[i] * j
                break
print(t[n-1]+a[n-1])

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

Expected output:
4


Actual output:
1


Fixed program (verdict: Accepted):
n = int(input())
t = [0] * n
a = [0] * n
for i in range(n):
    tt, aa = map(int, input().split())
    t[i], a[i] = tt, aa

if n == 1:
    print(t[0]+a[0])
else:
    for i in range(1, n):
        for j in range(max(t[i-1]
            if t[i]*j >= t[i-1] and a[i]*j >= a[i-1]:
                t[i], a[i] = t[i] * j, a[i] * j
                break
    print(t[n-1]+a[n-1])

Diff:
 n = int(input())
 t = [0] * n
 a = [0] * n
 for i in range(n):
     tt, aa = map(int, input().split())
     t[i], a[i] = tt, aa
 
 if n == 1:
     print(t[0]+a[0])
 else:
     for i in range(1, n):
-        for j in range(1, 10**5+1):
+        for j in range(max(t[i-1]
             if t[i]*j >= t[i-1] and a[i]*j >= a[i-1]:
                 t[i], a[i] = t[i] * j, a[i] * j
                 break
-print(t[n-1]+a[n-1])
+    print(t[n-1]+a[n-1])
Buggy program (verdict: Wrong Answer):
x, a, b = map(int, input().split())
if x <= a:
    print('delicious')
elif x <= a + b:
    print('safe')
else:
    print('dangerous')

Failing test case input:
-2 -2 1

Expected output:
dangerous


Actual output:
delicious


Fixed program (verdict: Accepted):
b, a, x = map(int, input().split())
if x <= a:
    print('delicious')
elif x <= a + b:
    print('safe')
else:
    print('dangerous')

Diff:
-x, a, b = map(int, input().split())
+b, a, x = map(int, input().split())
 if x <= a:
     print('delicious')
 elif x <= a + b:
     print('safe')
 else:
     print('dangerous')
Buggy program (verdict: Wrong Answer):
n, a, b = map(int, input().split())

if n == 1:
  if a != b:
    print(0)
  else:
    print(1)
elif n == 2:
  print(1)
else:
  if a == b:
    print(1)
  else:
    print((b-a) * (n-2) + 1)

Failing test case input:
5 5 3

Expected output:
0


Actual output:
-5


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

if n == 1:
  if a != b:
    print(0)
  else:
    print(1)
elif n == 2:
  print(1)
else:
  if a == b:
    print(1)
  elif a > b:
    print(0)
  else:
    print((b-a) * (n-2) + 1)

Diff:
 n, a, b = map(int, input().split())
 
 if n == 1:
   if a != b:
     print(0)
   else:
     print(1)
 elif n == 2:
   print(1)
 else:
   if a == b:
     print(1)
+  elif a > b:
+    print(0)
   else:
     print((b-a) * (n-2) + 1)
Buggy program (verdict: Wrong Answer):
while True:
  m,r,f = map (int,input().split())
  if m ==-1 and f==-1 and r==-1:
      break
  if m== -1 or f ==-1:
      print("F")
  elif m+f>=80:
      print("A")
  elif m+f>=65:
      print("B")
  elif m+f>=50:
      print("C")
  elif m+f>=30:
    if r>=50:
       print("C")
    else:
       print("D")
  else:
      print("F")


Failing test case input:
40 53 -1
20 6 -2
0 2 -1
-1 -1 -1

Expected output:
A
F
F


Actual output:
F
F
F


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


Diff:
 while True:
-  m,r,f = map (int,input().split())
+  m,f,r = map (int,input().split())
   if m ==-1 and f==-1 and r==-1:
       break
   if m== -1 or f ==-1:
       print("F")
   elif m+f>=80:
       print("A")
   elif m+f>=65:
       print("B")
   elif m+f>=50:
       print("C")
   elif m+f>=30:
     if r>=50:
        print("C")
     else:
        print("D")
   else:
       print("F")
Buggy program (verdict: Wrong Answer):
n,m=map(int,input().split())
ac = 0
wa = 0
ac_list = [0]*n

for _ in range(m):
    p,s=input().split()
    p = int(p) - 1
    if ac_list[p] == 'AC': continue
    ac_list[p] = s
    if s == '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):
n,m=map(int,input().split())
ac = 0
wa = 0
ac_list = [0]*n
wa_list = [0]*n

for _ in range(m):
    p,s=input().split()
    p = int(p) - 1
    if ac_list[p] == 'AC': continue
    ac_list[p] = s
    if s == 'AC':
        ac += 1
        wa += wa_list[p]
    else:
        wa_list[p] += 1
print(ac,wa)

Diff:
 n,m=map(int,input().split())
 ac = 0
 wa = 0
 ac_list = [0]*n
+wa_list = [0]*n
 
 for _ in range(m):
     p,s=input().split()
     p = int(p) - 1
     if ac_list[p] == 'AC': continue
     ac_list[p] = s
     if s == 'AC':
         ac += 1
+        wa += wa_list[p]
     else:
-        wa += 1
+        wa_list[p] += 1
 print(ac,wa)
Buggy program (verdict: Wrong Answer):
def main(t):
    if "2" in t:
        print("Yes")
    else:
        print("No")

t = input()
main(t)

Failing test case input:
-9 -2

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
def main(t):
    if "2" in t:
        print("No")
    else:
        print("Yes")

t = input()
main(t)


Diff:
 def main(t):
     if "2" in t:
-        print("Yes")
-    else:
         print("No")
+    else:
+        print("Yes")
 
 t = input()
 main(t)
+
Buggy program (verdict: Wrong Answer):
a,b,k = map(int,input().split())


if k > a:
    b = b - (k-a)
a = max((a-k,0))
print(a,b)


Failing test case input:
24844196728 933260677 1010010100001

Expected output:
0 0


Actual output:
0 -984232642596


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

if k > a:
    b = b - (k-a)
a = max((a-k,0))
b = max((b,0))
print(a,b)




Diff:
 a,b,k = map(int,input().split())
 
-
 if k > a:
     b = b - (k-a)
 a = max((a-k,0))
+b = max((b,0))
 print(a,b)
 
+
+
Buggy program (verdict: Wrong Answer):
n = int(input())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0

for i in range(n):
    p = i
    for j in range(p):
        sums = sums + a111[j]    
    for k in range(p,n):
        sums = sums + a222[k]
    al.append(sums)
    sums = 0
    
print(max(al))

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

Expected output:
129


Actual output:
131


Fixed program (verdict: Accepted):
n = int(input())
a111 = list(map(int,input().split()))
a222 = list(map(int,input().split()))
al = []
sums = 0

for i in range(n):
    p = i
    for j in range(p+1):
        sums = sums + a111[j]    
    for k in range(p,n):
        sums = sums + a222[k]
    al.append(sums)
    sums = 0
    
print(max(al))

Diff:
 n = int(input())
 a111 = list(map(int,input().split()))
 a222 = list(map(int,input().split()))
 al = []
 sums = 0
 
 for i in range(n):
     p = i
-    for j in range(p):
+    for j in range(p+1):
         sums = sums + a111[j]    
     for k in range(p,n):
         sums = sums + a222[k]
     al.append(sums)
     sums = 0
     
 print(max(al))
Buggy program (verdict: Wrong Answer):
N,d = map(int,input().split())
 
if N%(2*d+1)==0:
  print(N/(2*d+1))
else:
  print(int((N/(2*d+1))+1))

Failing test case input:
57 0

Expected output:
57


Actual output:
57.0


Fixed program (verdict: Accepted):
N,d = map(int,input().split())
 
if N%(2*d+1)==0:
  print(int(N/(2*d+1)))
else:
  print(int((N/(2*d+1))+1))

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

Failing test case input:
11101 00111 11100

Expected output:
11211


Actual output:
22201


Fixed program (verdict: Accepted):
a = list(sorted(list(map(int,input().split()))))
print(a[0] + a[-2])


Diff:
 a = list(sorted(list(map(int,input().split()))))
-print(a[-1] + a[-2])
+print(a[0] + a[-2])
+
Buggy program (verdict: Wrong Answer):
n=int(input())

if 100<=n<=111:
            print(111)
a=0
for a in range(1,9):
            if 1+111*a<=n<=111*(a+1):
                        print(n)
                        print(111*(a+1))


Failing test case input:
543

Expected output:
555


Actual output:
543
555


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

if 100<=n<=111:
            print(111)
a=0
for a in range(1,9):
            if 1+111*a<=n<=111*(a+1):
                        
                        print(111*(a+1))


Diff:
 n=int(input())
 
 if 100<=n<=111:
             print(111)
 a=0
 for a in range(1,9):
             if 1+111*a<=n<=111*(a+1):
-                        print(n)
+                        
                         print(111*(a+1))
Buggy program (verdict: Wrong Answer):
h,a=map(int,input().split())
count=0
while h>=0:
  h-=a
  count+=1
print(count) 

Failing test case input:
10010 1

Expected output:
10010


Actual output:
10011


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

Diff:
 h,a=map(int,input().split())
 count=0
-while h>=0:
+while h>0:
   h-=a
   count+=1
 print(count)
Buggy program (verdict: Wrong Answer):
n,m = list(map(int, input().split()))
wa_cnt = 0
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa_cnt += 1
print(len(ac), wa_cnt)

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

Expected output:
2 1


Actual output:
2 2


Fixed program (verdict: Accepted):
from collections import defaultdict
n,m = list(map(int, input().split()))
wa = defaultdict(int)
ac = set()
for _ in range(m):
  p, s = input().split()
  if(s == "AC"):
    ac.add(p)
  if (p not in ac and s=="WA"): 
    wa[p] += 1
print(len(ac), sum([wa[i] for i in ac]))

Diff:
+from collections import defaultdict
 n,m = list(map(int, input().split()))
-wa_cnt = 0
+wa = defaultdict(int)
 ac = set()
 for _ in range(m):
   p, s = input().split()
   if(s == "AC"):
     ac.add(p)
   if (p not in ac and s=="WA"): 
-    wa_cnt += 1
-print(len(ac), wa_cnt)
+    wa[p] += 1
+print(len(ac), sum([wa[i] for i in ac]))