ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
n,q = map(int,input().split())
A = [list(map(str,input().split())) for i in range(n)]
time = 0
flag = 1
while len(A) > 0:
    if int(A[0][1]) <= q: 
        time += int(A[0][1])
        print(A[0][1],time)
        del A[0]
    else: 
        time += q
        A[0][1] = str(int(A[0][1])-q)
        A.append(A[0])
        del A[0]


Failing test case input:
5 100
p1 150
2p 80
3p 200
p4 350
p5 25

Expected output:
2p 180
p5 405
p1 455
3p 555
p4 805


Actual output:
80 180
25 405
50 455
100 555
50 805


Fixed program (verdict: Accepted):
n,q = map(int,input().split())
A = [list(map(str,input().split())) for i in range(n)]
time = 0
flag = 1
while len(A) > 0:
    if int(A[0][1]) <= q: 
        time += int(A[0][1])
        print(A[0][0],time)
        del A[0]
    else: 
        time += q
        A[0][1] = str(int(A[0][1])-q)
        A.append(A[0])
        del A[0]


Diff:
 n,q = map(int,input().split())
 A = [list(map(str,input().split())) for i in range(n)]
 time = 0
 flag = 1
 while len(A) > 0:
     if int(A[0][1]) <= q: 
         time += int(A[0][1])
-        print(A[0][1],time)
+        print(A[0][0],time)
         del A[0]
     else: 
         time += q
         A[0][1] = str(int(A[0][1])-q)
         A.append(A[0])
         del A[0]
Buggy program (verdict: Wrong Answer):
a,b = map(int,input().split())

A = [a]*b
B = [b]*a

AA = int("".join(map(str, A)))
BB = int("".join(map(str, B)))

if AA >= BB:
    print(BB)
else:
    print(AA)

Failing test case input:
32 18

Expected output:
1818181818181818181818181818181818181818181818181818181818181818


Actual output:
323232323232323232323232323232323232


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

A = [a]*b
B = [b]*a

AA = int("".join(map(str, A)))
BB = int("".join(map(str, B)))

if A >= B:
    print(BB)
else:
    print(AA)

Diff:
 a,b = map(int,input().split())
 
 A = [a]*b
 B = [b]*a
 
 AA = int("".join(map(str, A)))
 BB = int("".join(map(str, B)))
 
-if AA >= BB:
+if A >= B:
     print(BB)
 else:
     print(AA)
Buggy program (verdict: Wrong Answer):
a, b = map(int, input().split())
if a % 2 == 0 and b % 2 == 0:
    print('Yes')
else:
    print('No')

Failing test case input:
-7 1

Expected output:
Yes


Actual output:
No


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

Diff:
 a, b = map(int, input().split())
-if a % 2 == 0 and b % 2 == 0:
+if a % 2 != 0 and b % 2 != 0:
     print('Yes')
 else:
     print('No')
Buggy program (verdict: Wrong Answer):
N = int(input())

arr = [ int(input()) for i in range(N)]

arr.sort()
cnt = 0
num = 1

a = arr[0]

for i in range(1,N):
  if arr[i] == a:
    num += 1
  else:
    if num % 2 == 1:
      cnt += 1
    num = 1
    a = arr[i]
print(int(cnt))


Failing test case input:
4
-2
0
5
1

Expected output:
4


Actual output:
3


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

arr = [ int(input()) for i in range(N)]

arr.sort()
cnt = 0
num = 1

a = arr[0]

for i in range(1,N):
  if arr[i] == a:
    num += 1
  else:
    if num % 2 == 1:
      cnt += 1
    num = 1
    a = arr[i]
if num % 2 == 1:
  cnt += 1

print(int(cnt))


Diff:
 N = int(input())
 
 arr = [ int(input()) for i in range(N)]
 
 arr.sort()
 cnt = 0
 num = 1
 
 a = arr[0]
 
 for i in range(1,N):
   if arr[i] == a:
     num += 1
   else:
     if num % 2 == 1:
       cnt += 1
     num = 1
     a = arr[i]
+if num % 2 == 1:
+  cnt += 1
+
 print(int(cnt))
Buggy program (verdict: Wrong Answer):
import sys

while 1:
    x = sys.stdin.readline().strip()
    x_list = x.split(" ")
    
    if x_list[0] == "0" and x_list[1] == "0" :
        break
    
    x_list.sort()
    print(x_list[0],x_list[1])

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

Expected output:
0 1
1 2
3 11


Actual output:
0 1
1 2
11 3


Fixed program (verdict: Accepted):
import sys

while 1:
    x = sys.stdin.readline().strip()
    x_list = list(map(int,x.split(" ")))
    
    if x_list[0] == 0 and x_list[1] == 0 :
        break
    
    x_list.sort()
    print(x_list[0],x_list[1])

Diff:
 import sys
 
 while 1:
     x = sys.stdin.readline().strip()
-    x_list = x.split(" ")
+    x_list = list(map(int,x.split(" ")))
     
-    if x_list[0] == "0" and x_list[1] == "0" :
+    if x_list[0] == 0 and x_list[1] == 0 :
         break
     
     x_list.sort()
     print(x_list[0],x_list[1])
Buggy program (verdict: Wrong Answer):

w = input()

for i in range(len(w)):
    if w.count(w[i]) % 2 != 0:
        print('No')
        break

print('Yes')


Failing test case input:
hthth

Expected output:
No

Actual output:
No
Yes


Fixed program (verdict: Accepted):

w = input()

for i in range(len(w)):
    if w.count(w[i]) % 2 != 0:
        print('No')
        exit()

print('Yes')


Diff:
 
 w = input()
 
 for i in range(len(w)):
     if w.count(w[i]) % 2 != 0:
         print('No')
-        break
+        exit()
 
 print('Yes')
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
if(a<=2 and b<=2 or(a>=2 and b>=2)):
    print('No')
else:
    print('Yes')

Failing test case input:
-7 1

Expected output:
Yes


Actual output:
No


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

Diff:
 a,b=map(int,input().split())
-if(a<=2 and b<=2 or(a>=2 and b>=2)):
+if((a*b)%2==0):
     print('No')
 else:
     print('Yes')
Buggy program (verdict: Wrong Answer):
a,b,c = map(int,input().split())
d =[]
if a != b != c:
    print(3)
elif a == b == c:
    print(1)
else:
    print(2)

Failing test case input:
4 12 4

Expected output:
2


Actual output:
3


Fixed program (verdict: Accepted):
a,b,c = map(int,input().split())
d =[]
if a != b and b != c and c != a:
    print(3)
elif a == b == c:
    print(1)
else:
    print(2)

Diff:
 a,b,c = map(int,input().split())
 d =[]
-if a != b != c:
+if a != b and b != c and c != a:
     print(3)
 elif a == b == c:
     print(1)
 else:
     print(2)
Buggy program (verdict: Wrong Answer):
a = "keyence"

b = input()

k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if b[i] == a[j] and (jj == 0 or jj == 1 or jj == 2):
			j += 1
			if jj == 1:
				jj += 1
		elif jj == 0:
			jj = 1
		elif jj >= 2:
			print("NO")
			break
		if j == 7:
			if i != k-1:
				print("NO")
				break
			else:
				print("YES")
				break
else:
	print("NO")


Failing test case input:
slps}n|fxb

Expected output:
NO


Actual output:

Fixed program (verdict: Accepted):
a = "keyence"

b = input()
o = 0
k = len(b)
j = 0
jj = 0
kk = [0 for i in range(8)]
al = 0
if k == 7:
	if a == b:
		print("YES")
	else:
		print("NO")
elif k >= 8:
	for i in range(k):
		if j == 7:
			al = 1
			print("YES")
			break
		if b[i] == a[j] and jj == 0:
			j += 1
		else:
			jj = 1
			o = j
		if jj == 1 and o == 0:
			if b[-7:] == a:
				print("YES")
				break
			else:
				print("NO")
				break
		elif jj == 1:
			if b[-(7-o):] == a[o:]:
				print("YES")
				break
			else:
				print("NO")
				break
else:
	print("NO")



Diff:
 a = "keyence"
 
 b = input()
-
+o = 0
 k = len(b)
 j = 0
 jj = 0
 kk = [0 for i in range(8)]
+al = 0
 if k == 7:
 	if a == b:
 		print("YES")
 	else:
 		print("NO")
 elif k >= 8:
 	for i in range(k):
-		if b[i] == a[j] and (jj == 0 or jj == 1 or jj == 2):
+		if j == 7:
+			al = 1
+			print("YES")
+			break
+		if b[i] == a[j] and jj == 0:
 			j += 1
-			if jj == 1:
-				jj += 1
-		elif jj == 0:
+		else:
 			jj = 1
-		elif jj >= 2:
-			print("NO")
-			break
-		if j == 7:
-			if i != k-1:
-				print("NO")
+			o = j
+		if jj == 1 and o == 0:
+			if b[-7:] == a:
+				print("YES")
 				break
 			else:
+				print("NO")
+				break
+		elif jj == 1:
+			if b[-(7-o):] == a[o:]:
 				print("YES")
 				break
+			else:
+				print("NO")
+				break
 else:
 	print("NO")
 
+
Buggy program (verdict: Wrong Answer):
A,B,C = map(int,input().split())
if(C>A):
  if(B>C):
    print("Yes")
else:
  print("No")

Failing test case input:
-2 -1 2

Expected output:
No


Actual output:

Fixed program (verdict: Accepted):
A,B,C = map(int,input().split())
if((C>A)and(B>C))or((A>C)and(C>B)):
  print("Yes")
else:
  print("No")


Diff:
 A,B,C = map(int,input().split())
-if(C>A):
-  if(B>C):
-    print("Yes")
+if((C>A)and(B>C))or((A>C)and(C>B)):
+  print("Yes")
 else:
   print("No")
+
Buggy program (verdict: Wrong Answer):



N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if int(P[i-1])>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Failing test case input:
6
1 0 3 6 29 16

Expected output:
2


Actual output:
3


Fixed program (verdict: Accepted):



N=int(input())
P=input().split()

c=1
m=int(P[0])
for i in range(1,N):
    if m>int(P[i]):
        c+=1
        m=int(P[i])


print(c)

Diff:
 
 
 
 N=int(input())
 P=input().split()
 
 c=1
 m=int(P[0])
 for i in range(1,N):
-    if int(P[i-1])>int(P[i]):
+    if m>int(P[i]):
         c+=1
         m=int(P[i])
 
 
 print(c)
Buggy program (verdict: Wrong Answer):
import sys
from io import StringIO
import unittest

def resolve():
    lines = sys.stdin.readlines()
    lines = list(map(lambda x: int(x.rstrip()), lines))
    n = lines[0]
    i = 1
    for c in range(1, n+1):
        i = lines[i]
        if i == 2:
            print(c)
            return
    print(-1)

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

Expected output:
3


Actual output:

Fixed program (verdict: Accepted):
import sys
from io import StringIO
import unittest

def resolve():
    lines = sys.stdin.readlines()
    lines = list(map(lambda x: int(x.rstrip()), lines))
    n = lines[0]
    i = 1
    for c in range(1, n+1):
        i = lines[i]
        if i == 2:
            print(c)
            return
    print(-1)
    
resolve()

Diff:
 import sys
 from io import StringIO
 import unittest
 
 def resolve():
     lines = sys.stdin.readlines()
     lines = list(map(lambda x: int(x.rstrip()), lines))
     n = lines[0]
     i = 1
     for c in range(1, n+1):
         i = lines[i]
         if i == 2:
             print(c)
             return
     print(-1)
+    
+resolve()
Buggy program (verdict: Wrong Answer):
n = int(input())
R = list()

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

ans = R[1] - R[0]
min_R = R[0]

for r in R:
    min_R = min(min_R, r)
    ans   = max(ans, r - min_R)
print(ans)

Failing test case input:
3
4
3
2

Expected output:
-1

Actual output:
0


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

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

ans = R[1] - R[0]
min_R = R[0]

for i in range(1, n):
    ans   = max(ans, R[i] - min_R)
    min_R = min(min_R, R[i])
print(ans)

Diff:
 n = int(input())
 R = list()
 
 for _ in range(n):
     R.append(int(input()))
 
 ans = R[1] - R[0]
 min_R = R[0]
 
-for r in R:
-    min_R = min(min_R, r)
-    ans   = max(ans, r - min_R)
+for i in range(1, n):
+    ans   = max(ans, R[i] - min_R)
+    min_R = min(min_R, R[i])
 print(ans)
Buggy program (verdict: Wrong Answer):
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
for i in range(N-1):
  sum += min(T,t[i+1]-t[i])
print(sum)

Failing test case input:
2 4
0 3

Expected output:
7

Actual output:
3


Fixed program (verdict: Accepted):
N,T = map(int,input().split())
t = list(map(int,input().split()))
sum = 0
for i in range(N-1):
  sum += min(T,(t[i+1]-t[i]))
print(sum+T)

Diff:
 N,T = map(int,input().split())
 t = list(map(int,input().split()))
 sum = 0
 for i in range(N-1):
-  sum += min(T,t[i+1]-t[i])
-print(sum)
+  sum += min(T,(t[i+1]-t[i]))
+print(sum+T)
Buggy program (verdict: Wrong Answer):
import string
N = int(input()) - 1
a = list(string.ascii_lowercase)
ans = ''
tmp = 0
while True:
    m, v = divmod(N, 26)
    if m == 0:
        N = m
    else:
        N = m - 1
    ans += a[v]
    if N <= 25:
        break
if N != 0:
    ans += a[N]
print(ans[::-1])

Failing test case input:
642630

Expected output:
ajnpn


Actual output:
jnpn


Fixed program (verdict: Accepted):
import string
N = int(input()) - 1
a = list(string.ascii_lowercase)
ans = ''
tmp = 0
m = 0
while True:
    m, v = divmod(N, 26)
    if m == 0:
        N = m
    else:
        N = m - 1
    ans += a[v]
    if N <= 25:
        break
if m != 0:
    ans += a[N]
print(ans[::-1])

Diff:
 import string
 N = int(input()) - 1
 a = list(string.ascii_lowercase)
 ans = ''
 tmp = 0
+m = 0
 while True:
     m, v = divmod(N, 26)
     if m == 0:
         N = m
     else:
         N = m - 1
     ans += a[v]
     if N <= 25:
         break
-if N != 0:
+if m != 0:
     ans += a[N]
 print(ans[::-1])
Buggy program (verdict: Wrong Answer):
def read_input():
    n = int(input())

    sheets = []
    for i in range(n):
        l, r = map(int, input().split())
        sheets.append((l, r))

    return n, sheets

def submit():
    n, sheets = read_input()

    watcher = 0
    for sheet in sheets:
        watcher += sheet[1] - sheet[0] + 1

    print(watcher)


if __name__ == '__main__':
    submit

Failing test case input:
2
72 0
2 -1

Expected output:
-73


Actual output:

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

    sheets = []
    for i in range(n):
        l, r = map(int, input().split())
        sheets.append((l, r))

    return n, sheets

def submit():
    n, sheets = read_input()

    watcher = 0
    for sheet in sheets:
        watcher += sheet[1] - sheet[0] + 1

    print(watcher)


if __name__ == '__main__':
    submit()

Diff:
 def read_input():
     n = int(input())
 
     sheets = []
     for i in range(n):
         l, r = map(int, input().split())
         sheets.append((l, r))
 
     return n, sheets
 
 def submit():
     n, sheets = read_input()
 
     watcher = 0
     for sheet in sheets:
         watcher += sheet[1] - sheet[0] + 1
 
     print(watcher)
 
 
 if __name__ == '__main__':
-    submit
+    submit()
Buggy program (verdict: Wrong Answer):
N,K = map(int,input().split())
A = list(map(int,input().split()))
print(max(2*max(A)-K-1,0))

Failing test case input:
28 1
4 2 4

Expected output:
0


Actual output:
6


Fixed program (verdict: Accepted):
K,T = map(int,input().split())
A = list(map(int,input().split()))
print(max(2*max(A)-K-1,0))

Diff:
-N,K = map(int,input().split())
+K,T = map(int,input().split())
 A = list(map(int,input().split()))
 print(max(2*max(A)-K-1,0))
Buggy program (verdict: Wrong Answer):
W, H =  map(int, input().split())
w, h =  map(int, input().split())

print(W*H - w*h)

Failing test case input:
0 1
1 11

Expected output:
10


Actual output:
-11


Fixed program (verdict: Accepted):
W, H =  map(int, input().split())
w, h =  map(int, input().split())

print(W*H - w*H - h*W + w*h)

Diff:
 W, H =  map(int, input().split())
 w, h =  map(int, input().split())
 
-print(W*H - w*h)
+print(W*H - w*H - h*W + w*h)
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
cnt = [0]*(10**5)
for i in range(0,10*5):
    cnt[i] = a.count(i+1)
s = sum(a)
q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    s += (c-b)*cnt[b-1]
    cnt[c-1]+=cnt[b-1]
    cnt[b-1]=0
    print(s)

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

Expected output:
8
8
10


Actual output:
8
8
8


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

cnt = [0]*(10**5)
for i in a:
    cnt[i-1] += 1

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    s += (c-b)*cnt[b-1]
    cnt[c-1]+=cnt[b-1]
    cnt[b-1]=0
    print(s)

Diff:
 n = int(input())
 a = list(map(int, input().split()))
-cnt = [0]*(10**5)
-for i in range(0,10*5):
-    cnt[i] = a.count(i+1)
 s = sum(a)
+
+cnt = [0]*(10**5)
+for i in a:
+    cnt[i-1] += 1
+
 q = int(input())
 for _ in range(q):
     b, c = map(int, input().split())
     s += (c-b)*cnt[b-1]
     cnt[c-1]+=cnt[b-1]
     cnt[b-1]=0
     print(s)
Buggy program (verdict: Wrong Answer):
x,y,z=map(int,input().split())
if x<y:
    if y>z:
        if z>x:
            print("Yes")
    else:
        print("No")
elif x>y:
    if y<z:
        if x>z:
            print("Yes")
    else:
        print("No")


Failing test case input:
-1 -2 3

Expected output:
No


Actual output:

Fixed program (verdict: Accepted):
x,y,z=map(int,input().split())
if x<y:
    if y>z:
        if z>x:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
elif x>y:
    if y<z:
        if x>z:
            print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    print("No")


Diff:
 x,y,z=map(int,input().split())
 if x<y:
     if y>z:
         if z>x:
             print("Yes")
+        else:
+            print("No")
     else:
         print("No")
 elif x>y:
     if y<z:
         if x>z:
             print("Yes")
+        else:
+            print("No")
     else:
         print("No")
+else:
+    print("No")
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
ps = []
for i in range(N):
	ps.append(int(input()))
ps = sorted(ps)
ans = ps[K-1]-ps[0]
for i in range(N - K):
	ans = min(ans, ps[i+K-1], ps[i])
print(ans)


Failing test case input:
5 3
10
25
19
0
6

Expected output:
10


Actual output:
0


Fixed program (verdict: Accepted):
N, K = map(int, input().split())
ps = []
for i in range(N):
	ps.append(int(input()))
ps = sorted(ps)
ans = ps[K-1]-ps[0]
for i in range(N-K+1):
	ans = min(ans, ps[i+K-1]-ps[i])
print(ans)


Diff:
 N, K = map(int, input().split())
 ps = []
 for i in range(N):
 	ps.append(int(input()))
 ps = sorted(ps)
 ans = ps[K-1]-ps[0]
-for i in range(N - K):
-	ans = min(ans, ps[i+K-1], ps[i])
+for i in range(N-K+1):
+	ans = min(ans, ps[i+K-1]-ps[i])
 print(ans)
Buggy program (verdict: Wrong Answer):
a,b,c = map(int,input().split())

if a != b == c:
	print(2)

if a == b != c:
	print(2)
	
if a == c != b:
	print(2)

if a == b == c:
	print(1)
	
if a != b != c:
	print(3)

Failing test case input:
4 16 4

Expected output:
2


Actual output:
2
3


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

if a != b == c:
	print(2)

if a == b != c:
	print(2)
	
if a == c != b:
	print(2)

if a == b == c:
	print(1)
	
if a != b != c and a != c:
	print(3)

Diff:
 a,b,c = map(int,input().split())
 
 if a != b == c:
 	print(2)
 
 if a == b != c:
 	print(2)
 	
 if a == c != b:
 	print(2)
 
 if a == b == c:
 	print(1)
 	
-if a != b != c:
+if a != b != c and a != c:
 	print(3)
Buggy program (verdict: Wrong Answer):
import math

n = list(map(str, input().split()))
n=n[0]

yes=0
no=0


if(no>=8):
  print("NO")
else:
  print("YES")

Failing test case input:
xxxxxxxx

Expected output:
NO

Actual output:
YES


Fixed program (verdict: Accepted):
import math

n = list(map(str, input().split()))
n=n[0]

yes=0
no=0

for i in range(len(n)):
  if(n[i]=='x'):
    no+=1
    
if(no>=8):
  print("NO")
else:
  print("YES")

Diff:
 import math
 
 n = list(map(str, input().split()))
 n=n[0]
 
 yes=0
 no=0
 
-
+for i in range(len(n)):
+  if(n[i]=='x'):
+    no+=1
+    
 if(no>=8):
   print("NO")
 else:
   print("YES")
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
r=a+b
if r<=24:
    print(r)
else:
    print(r-24)

Failing test case input:
349 8

Expected output:
21


Actual output:
333


Fixed program (verdict: Accepted):
a,b=map(int,input().split())
r=a+b
if r<24:
    print(r)
else:
    print(r%24)

Diff:
 a,b=map(int,input().split())
 r=a+b
-if r<=24:
+if r<24:
     print(r)
 else:
-    print(r-24)
+    print(r%24)
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(2 * K)]

treated = (list(range(1, N+1)))

for i in range(int((K+1)/2)):
  tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
  treated = list(set(treated) & set(tt))

print(len(treated))

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

Expected output:
1


Actual output:
2


Fixed program (verdict: Accepted):
N, K = map(int, input().split())
l = [list(map(int, input().split())) for _ in range(2 * K)]

treated = (list(range(1, N+1)))

for i in range(K):
  tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
  treated = list(set(treated) & set(tt))

print(len(treated))

Diff:
 N, K = map(int, input().split())
 l = [list(map(int, input().split())) for _ in range(2 * K)]
 
 treated = (list(range(1, N+1)))
 
-for i in range(int((K+1)/2)):
+for i in range(K):
   tt = list(set(list(range(1, N+1))) - set(l[2*i+1]))
   treated = list(set(treated) & set(tt))
 
 print(len(treated))
Buggy program (verdict: Wrong Answer):
from copy import *
n,m=map(int,input().split())
t=deepcopy(n)
while True:
    if m%t==0:
        if t*n<=m:
            print(t)
            exit()
        else:
            t-=1
    else:
        t-=1

Failing test case input:
000001 1010011101

Expected output:
1010011101


Actual output:
1


Fixed program (verdict: Accepted):
n,m=map(int,input().split())
t=int(m/n)
while True:
    if m%t==0:
        if t*n<=m:
            print(t)
            exit()
        else:
            t-=1
    else:
        t-=1

Diff:
-from copy import *
 n,m=map(int,input().split())
-t=deepcopy(n)
+t=int(m/n)
 while True:
     if m%t==0:
         if t*n<=m:
             print(t)
             exit()
         else:
             t-=1
     else:
         t-=1
Buggy program (verdict: Wrong Answer):
S='AtCoder'
if S[0]=='A' and S[2:-1].count('C')==1:
    s=list(S)
    s.remove('C')
    S=''.join(s)
    if S.istitle()==True:
        print('AC')
        exit()
print('WA')

Failing test case input:
retpccA

Expected output:
WA


Actual output:
AC


Fixed program (verdict: Accepted):
S=input()
if S[0]=='A' and S[2:-1].count('C')==1:
    s=list(S)
    s.remove('C')
    S=''.join(s)
    if S.istitle()==True:
        print('AC')
        exit()
print('WA')

Diff:
-S='AtCoder'
+S=input()
 if S[0]=='A' and S[2:-1].count('C')==1:
     s=list(S)
     s.remove('C')
     S=''.join(s)
     if S.istitle()==True:
         print('AC')
         exit()
 print('WA')
Buggy program (verdict: Wrong Answer):
s = input()
s = list(s)

ans = []

for i in range(len(s)):
  tmp = s[0:len(s)-(i+1)]
  
  if tmp == tmp[::-1]:
    ans.append(len(tmp))
    
print(max(ans))

Failing test case input:
akakskaakakas`saaaakas

Expected output:
4


Actual output:
3


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

ans = []

for i in range(len(s)):
  tmp = s[0:len(s)-(i+1)]
  
  if tmp[0:int(len(tmp)/2)] == tmp[int(len(tmp)/2):len(tmp)] and len(tmp)%2 == 0:
    ans.append(len(tmp))
    
print(max(ans))

Diff:
 s = input()
 s = list(s)
 
 ans = []
 
 for i in range(len(s)):
   tmp = s[0:len(s)-(i+1)]
   
-  if tmp == tmp[::-1]:
+  if tmp[0:int(len(tmp)/2)] == tmp[int(len(tmp)/2):len(tmp)] and len(tmp)%2 == 0:
     ans.append(len(tmp))
     
 print(max(ans))
Buggy program (verdict: Wrong Answer):




if __name__ == '__main__':
    n = int(input())
    a = sorted(list(map(int, input().split())), reverse=True)
    print(sum(a[n:2 * n]))


Failing test case input:
10
1100000000 0000100100 1100110011 0100001000 1000101011 1000001000 1010100000 1010001100 1000000000 1010100000 0100000010 1011000001 1100110000 1001011000 1011100000 1101000001 0100110000 0111110101 1000000000 1101000111 1010000101 1000110001 0010000110 0100000001 1001011100 1000011000 1110001000 1000001000 1000000000 1000000100

Expected output:
10333323335


Actual output:
10022247413


Fixed program (verdict: Accepted):




if __name__ == '__main__':
    n = int(input())
    a = sorted(list(map(int, input().split())), reverse=True)
    print(sum(a[1:2 * n:2]))


Diff:
 
 
 
 
 if __name__ == '__main__':
     n = int(input())
     a = sorted(list(map(int, input().split())), reverse=True)
-    print(sum(a[n:2 * n]))
+    print(sum(a[1:2 * n:2]))
Buggy program (verdict: Wrong Answer):
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[i + 1])

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

Expected output:
2
4
1
3
2
0
1
1


Actual output:
0
0
0
0
0
0
0
0


Fixed program (verdict: Accepted):
from collections import defaultdict
n, m = map(int, input().split())
d = defaultdict(int)
for _ in range(m):
  a, b = input().split()
  d[a] += 1
  d[b] += 1
for i in range(n):
  print(d[str(i + 1)])


Diff:
 from collections import defaultdict
 n, m = map(int, input().split())
 d = defaultdict(int)
 for _ in range(m):
   a, b = input().split()
   d[a] += 1
   d[b] += 1
 for i in range(n):
-  print(d[i + 1])
+  print(d[str(i + 1)])
+
Buggy program (verdict: Wrong Answer):
n=int(input())
d=n/1000
x=round(d,0)
c=int((x*1000)-n)
print(c)
    


Failing test case input:
1021

Expected output:
979


Actual output:
-21


Fixed program (verdict: Accepted):
import math
n=int(input())
d=n/1000
x=math.ceil(d)
c=int((x*1000)-n)
print(c)
    


Diff:
+import math
 n=int(input())
 d=n/1000
-x=round(d,0)
+x=math.ceil(d)
 c=int((x*1000)-n)
 print(c)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
if N==2: print(max(A));exit()
from math import gcd
L = {}
R = {}
L[0] = A[0]
R[N-1] = A[-1]
ans = 0
for i in range(1,N):
    L[i] = gcd(L[i-1],A[i])
    R[N-i-1] = gcd(R[N-i],A[N-i-1])
for i in range(2,N):
    ans = max(ans,gcd(L[i-2],R[i]))
ans = max(ans,R[1])
ans = max(ans,L[N-1])
print(ans)

Failing test case input:
3
36 36 10

Expected output:
36


Actual output:
2


Fixed program (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
if N==2: print(max(A));exit()
from math import gcd
L = {}
R = {}
L[0] = A[0]
R[N-1] = A[-1]
ans = 0
for i in range(1,N):
    L[i] = gcd(L[i-1],A[i])
    R[N-i-1] = gcd(R[N-i],A[N-i-1])
for i in range(2,N):
    ans = max(ans,gcd(L[i-2],R[i]))
ans = max(ans,R[1])
ans = max(ans,L[N-2])
ans = max(ans,R[0])
print(ans)

Diff:
 N = int(input())
 A = list(map(int,input().split()))
 if N==2: print(max(A));exit()
 from math import gcd
 L = {}
 R = {}
 L[0] = A[0]
 R[N-1] = A[-1]
 ans = 0
 for i in range(1,N):
     L[i] = gcd(L[i-1],A[i])
     R[N-i-1] = gcd(R[N-i],A[N-i-1])
 for i in range(2,N):
     ans = max(ans,gcd(L[i-2],R[i]))
 ans = max(ans,R[1])
-ans = max(ans,L[N-1])
+ans = max(ans,L[N-2])
+ans = max(ans,R[0])
 print(ans)
Buggy program (verdict: Wrong Answer):

n, m = map(int, input().split())
ac = 0
pe = 0
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in d and s == "AC":
        ac += 1
        d.add(p)
    if p not in d and s == "WA":
        pe += 1
print(ac, pe)


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
tmp = {}
d = set()
for _ in range(m):
    p, s = map(str, input().split())
    if p not in tmp:
        tmp[p] = 0
    if p not in d and s == "AC":
        d.add(p)
        ac += 1
        if p in tmp:
            wa += tmp[p]
    if p not in d and s == "WA":
        tmp[p] += 1
print(ac, wa)


Diff:
 
 n, m = map(int, input().split())
 ac = 0
-pe = 0
+wa = 0
+tmp = {}
 d = set()
 for _ in range(m):
     p, s = map(str, input().split())
+    if p not in tmp:
+        tmp[p] = 0
     if p not in d and s == "AC":
-        ac += 1
         d.add(p)
+        ac += 1
+        if p in tmp:
+            wa += tmp[p]
     if p not in d and s == "WA":
-        pe += 1
-print(ac, pe)
+        tmp[p] += 1
+print(ac, wa)
Buggy program (verdict: Wrong Answer):
N = int(input())
K = int(input())
now = 1
for i in range(N):
  if now <= K:
    now += 2
  else:
    now += K
print(now)


Failing test case input:
10
-33

Expected output:
-16640


Actual output:
-49


Fixed program (verdict: Accepted):
N = int(input())
K = int(input())
now = 1
for i in range(N):
  if now <= K:
    now *= 2
  else:
    now += K
print(now)


Diff:
 N = int(input())
 K = int(input())
 now = 1
 for i in range(N):
   if now <= K:
-    now += 2
+    now *= 2
   else:
     now += K
 print(now)
Buggy program (verdict: Wrong Answer):
n = int(input())
data = list(map(int, input().split()))

def gcd(a, b):
    while b:
        a, b = b, a % b
        
    return a

left_ = [0] * (n + 1)
right_ = [0] * (n + 1)
ans = []

for i in range(n):
    left_[i] = gcd( left_[i-1], data[i] )

for i in range(n-1, 0, -1):
    right_[i] = gcd( right_[i+1], data[i] )

print( left_ )
print( right_ )

for i in range(n):
    ans += [ gcd( left_[i-1], right_[i+1] ) ]

print( max(ans) )


Failing test case input:
2
0001111001 1011000101

Expected output:
1011000101


Actual output:
[1111001, 1, 0]
[0, 1011000101, 0]
1011000101


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

def gcd(a, b):
    while b:
        a, b = b, a % b
        
    return a

left_ = [0] * (n + 1)
right_ = [0] * (n + 1)
ans = []

for i in range(n):
    left_[i] = gcd( left_[i-1], data[i] )

for i in range(n-1, 0, -1):
    right_[i] = gcd( right_[i+1], data[i] )

for i in range(n):
    ans += [ gcd( left_[i-1], right_[i+1] ) ]

print( max(ans) )


Diff:
 n = int(input())
 data = list(map(int, input().split()))
 
 def gcd(a, b):
     while b:
         a, b = b, a % b
         
     return a
 
 left_ = [0] * (n + 1)
 right_ = [0] * (n + 1)
 ans = []
 
 for i in range(n):
     left_[i] = gcd( left_[i-1], data[i] )
 
 for i in range(n-1, 0, -1):
     right_[i] = gcd( right_[i+1], data[i] )
 
-print( left_ )
-print( right_ )
-
 for i in range(n):
     ans += [ gcd( left_[i-1], right_[i+1] ) ]
 
 print( max(ans) )
Buggy program (verdict: Wrong Answer):
n=int(input())
a=n
b=n
d=n%10
c=n%100-d
if a==b and b==c:
    print("Yes")
elif b==c and c==d:
    print("Yes")
else:
    print("No")


Failing test case input:
7777

Expected output:
Yes

Actual output:
No


Fixed program (verdict: Accepted):
n=int(input())
a=n
b=(n
d=n%10
c=((n%100)-d)
if a==b and b==c:
    print("Yes")
elif b==c and c==d:
    print("Yes")
else:
    print("No")


Diff:
 n=int(input())
 a=n
-b=n
+b=(n
 d=n%10
-c=n%100-d
+c=((n%100)-d)
 if a==b and b==c:
     print("Yes")
 elif b==c and c==d:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
s = input()
res = 0

for i in range(2):
    if s[i] == 'R':
        res = 1
if s[0] == 'R' and s[1] == 'R':
    res += 1
if s[1] == 'R' and s[2] == 'R':
    res += 1

print(res)

Failing test case input:
TSR

Expected output:
1


Actual output:
0


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

for i in range(3):
    if s[i] == 'R':
        res = 1
if s[0] == 'R' and s[1] == 'R':
    res += 1
if s[1] == 'R' and s[2] == 'R':
    res += 1

print(res)

Diff:
 s = input()
 res = 0
 
-for i in range(2):
+for i in range(3):
     if s[i] == 'R':
         res = 1
 if s[0] == 'R' and s[1] == 'R':
     res += 1
 if s[1] == 'R' and s[2] == 'R':
     res += 1
 
 print(res)
Buggy program (verdict: Wrong Answer):
N=int(input())
A_r=list(input().split())
A=[int(x) for x in A_r]
B=[0 for i in range(N)]
print(B)
for i in range(len(A)):
    B[A[i]-1]+=1
[print(i) for i in B]

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

Expected output:
1
1
1
1
0
1
1


Actual output:
[0, 0, 0, 0, 0, 0, 0]
1
1
1
1
0
1
1


Fixed program (verdict: Accepted):
N=int(input())
A_r=list(input().split())
A=[int(x) for x in A_r]
B=[0 for i in range(N)]

for i in range(len(A)):
    B[A[i]-1]+=1
for i in range(len(B)):
    print(B[i])

Diff:
 N=int(input())
 A_r=list(input().split())
 A=[int(x) for x in A_r]
 B=[0 for i in range(N)]
-print(B)
+
 for i in range(len(A)):
     B[A[i]-1]+=1
-[print(i) for i in B]
+for i in range(len(B)):
+    print(B[i])
Buggy program (verdict: Wrong Answer):
import sys
s = input()
s = [c for c in s]
flg = False
if s[0] == 'A':
    if s[2:-1].count('C') == 1:
        if s.count('C') == 1:
            s.remove('A')
            s.remove('C')
            print(s)
            for c in s:
                if not c.islower():
                    flg = False
                    break
                flg = True
print('AC' if flg else 'WA')

Failing test case input:
AtCodds

Expected output:
AC


Actual output:
['t', 'o', 'd', 'd', 's']
AC


Fixed program (verdict: Accepted):
import sys
s = input()
s = [c for c in s]
flg = False
if s[0] == 'A':
    if s[2:-1].count('C') == 1:
        if s.count('C') == 1:
            s.remove('A')
            s.remove('C')
            for c in s:
                if not c.islower():
                    flg = False
                    break
                flg = True
print('AC' if flg else 'WA')

Diff:
 import sys
 s = input()
 s = [c for c in s]
 flg = False
 if s[0] == 'A':
     if s[2:-1].count('C') == 1:
         if s.count('C') == 1:
             s.remove('A')
             s.remove('C')
-            print(s)
             for c in s:
                 if not c.islower():
                     flg = False
                     break
                 flg = True
 print('AC' if flg else 'WA')
Buggy program (verdict: Wrong Answer):
input()
L = list(map(int,input().split()))
if max(L) > sum(L)-max(L):
  print("Yes")
else:
  print("No")

Failing test case input:
4
2 0 2 -1

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
input()
L = list(map(int,input().split()))
if max(L) < sum(L)-max(L):
  print("Yes")
else:
  print("No")


Diff:
 input()
 L = list(map(int,input().split()))
-if max(L) > sum(L)-max(L):
+if max(L) < sum(L)-max(L):
   print("Yes")
 else:
   print("No")
+
Buggy program (verdict: Wrong Answer):
x, y = input().split()
s = 0
if x == 1:
    s += 300000
elif x == 2:
    s += 200000
elif x == 3:
    s += 100000
else:
    s += 0
if y == 1:
    s += 300000
elif y == 2:
    s += 200000
elif y == 3:
    s += 100000
else:
    s += 0
if x == 1 and y == 1:
    s += 400000
print(s)

Failing test case input:
3 21

Expected output:
100000


Actual output:
0


Fixed program (verdict: Accepted):
x, y = input().split()
s = 0
if int(x) == 1:
    s += 300000
elif int(x) == 2:
    s += 200000
elif int(x) == 3:
    s += 100000
else:
    s += 0
if int(y) == 1:
    s += 300000
elif int(y) == 2:
    s += 200000
elif int(y) == 3:
    s += 100000
else:
    s += 0
if int(x) == 1 and int(y) == 1:
    s += 400000
print(s)

Diff:
 x, y = input().split()
 s = 0
-if x == 1:
+if int(x) == 1:
     s += 300000
-elif x == 2:
+elif int(x) == 2:
     s += 200000
-elif x == 3:
+elif int(x) == 3:
     s += 100000
 else:
     s += 0
-if y == 1:
+if int(y) == 1:
     s += 300000
-elif y == 2:
+elif int(y) == 2:
     s += 200000
-elif y == 3:
+elif int(y) == 3:
     s += 100000
 else:
     s += 0
-if x == 1 and y == 1:
+if int(x) == 1 and int(y) == 1:
     s += 400000
 print(s)
Buggy program (verdict: Wrong Answer):


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

if A-B > 0:
    print("delicious")
elif X+A-B >= 0:
    print("Safe")
elif X+1+A-B <= 0:
    print("dangerous")

Failing test case input:
6 2 6

Expected output:
safe


Actual output:
Safe


Fixed program (verdict: Accepted):


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

if A-B >= 0:
    print("delicious")
elif X+A-B >= 0:
    print("safe")
elif X+1+A-B <= 0:
    print("dangerous")

Diff:
 
 
 X, A, B = map(int, input().rstrip().split())
 
-if A-B > 0:
+if A-B >= 0:
     print("delicious")
 elif X+A-B >= 0:
-    print("Safe")
+    print("safe")
 elif X+1+A-B <= 0:
     print("dangerous")
Buggy program (verdict: Wrong Answer):
from bisect import bisect_left
N, M, X = map(int,input().split())
A = list(map(int,input().split()))
index = bisect_left(A, X)
ans = min(index, M - index)

Failing test case input:
5 3 3
1 2 4

Expected output:
1

Actual output:

Fixed program (verdict: Accepted):
from bisect import bisect_left
N, M, X = map(int,input().split())
A = list(map(int,input().split()))
index = bisect_left(A, X)
ans = min(index, M - index)
print(ans)

Diff:
 from bisect import bisect_left
 N, M, X = map(int,input().split())
 A = list(map(int,input().split()))
 index = bisect_left(A, X)
 ans = min(index, M - index)
+print(ans)
Buggy program (verdict: Wrong Answer):
n = int(input())
d,x = map(int,input().split())
res = 0
for i in range(1,n+1):
  a = int(input())
  for j in range(1,d+1,a):
    res += 1
res = res + 1
print(res)

Failing test case input:
5
30 44
26
1
81
27
6

Expected output:
84


Actual output:
41


Fixed program (verdict: Accepted):
n = int(input())
d,x = map(int,input().split())
res = 0
for i in range(n):
  a = int(input())
  for j in range(1,d+1,a):
    res += 1
print(res+x)

Diff:
 n = int(input())
 d,x = map(int,input().split())
 res = 0
-for i in range(1,n+1):
+for i in range(n):
   a = int(input())
   for j in range(1,d+1,a):
     res += 1
-res = res + 1
-print(res)
+print(res+x)
Buggy program (verdict: Wrong Answer):
n, k = map(int, input().split())
must = k
rest = n - must
if n == 1:
    print(0)
else:
    print(rest)


Failing test case input:
1 351

Expected output:
-350


Actual output:
0


Fixed program (verdict: Accepted):
n, k = map(int, input().split())
must = k
rest = n - must
if k == 1:
    print(0)
else:
    print(rest)


Diff:
 n, k = map(int, input().split())
 must = k
 rest = n - must
-if n == 1:
+if k == 1:
     print(0)
 else:
     print(rest)
Buggy program (verdict: Wrong Answer):
n = 5
a = [list(map(int, input().split())) for _ in range(2)]
count = 0

for i in range(n):
    x = sum(a[0][:n-i]) + sum(a[1][n-i-1:])
    
    if count < x:
        count = x

print(count)


Failing test case input:
4
1 1 0 1
1 1 1 1

Expected output:
5


Actual output:
7


Fixed program (verdict: Accepted):
n = int(input())
a = [list(map(int, input().split())) for _ in range(2)]
count = 0

for i in range(n):
    x = sum(a[0][:n-i]) + sum(a[1][n-i-1:])
    
    if count < x:
        count = x

print(count)

Diff:
-n = 5
+n = int(input())
 a = [list(map(int, input().split())) for _ in range(2)]
 count = 0
 
 for i in range(n):
     x = sum(a[0][:n-i]) + sum(a[1][n-i-1:])
     
     if count < x:
         count = x
 
 print(count)
-
Buggy program (verdict: Wrong Answer):
import math
k,n= map(int,input().split())
a = list(map(int,input().split()))
ans = 0
for i in range(1,len(a)):
  s = a[i]-a[i-1]
  ans =max(ans,s)
print(k-ans)


Failing test case input:
37 3
-1 1 18

Expected output:
19


Actual output:
20


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


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

for i in range(1, n):
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j + 1] = v
    print(' '.join(list(map(str, a))))

Failing test case input:
3
0 3 -14

Expected output:
0 3 -14
0 3 -14
-14 0 3


Actual output:
0 3 -14
-14 0 3


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

for i in range(1, n):
    print(' '.join(list(map(str, a))))
    v = a[i]
    j = i - 1
    while j >= 0 and a[j] > v:
        a[j + 1] = a[j]
        j -= 1
    a[j + 1] = v

print(' '.join(list(map(str, a))))

Diff:
 n = int(input())
 a = list(map(int, input().split()))
 
 for i in range(1, n):
+    print(' '.join(list(map(str, a))))
     v = a[i]
     j = i - 1
     while j >= 0 and a[j] > v:
         a[j + 1] = a[j]
         j -= 1
     a[j + 1] = v
-    print(' '.join(list(map(str, a))))
+
+print(' '.join(list(map(str, a))))
Buggy program (verdict: Wrong Answer):
N = int(input())
Mylog = []
cnt = 0
x = list(input())
Mylog.append(x)
for i in range(1,N):
  x = list(input())
  Mylog.append(x)
  if (x in Mylog) or (Mylog[i-1][-1] != Mylog[i][0]):
    cnt += 1
print("Yes" if cnt==0 else "No")

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
N = int(input())
Mylog = []
cnt = 0
x = list(input())
Mylog.append(x)
for i in range(1,N):
  x = list(input())
  Mylog.append(x)
  if (x in Mylog[:-1]) or (Mylog[i-1][-1] != Mylog[i][0]):
    cnt += 1

print("Yes" if cnt==0 else "No")

Diff:
 N = int(input())
 Mylog = []
 cnt = 0
 x = list(input())
 Mylog.append(x)
 for i in range(1,N):
   x = list(input())
   Mylog.append(x)
-  if (x in Mylog) or (Mylog[i-1][-1] != Mylog[i][0]):
+  if (x in Mylog[:-1]) or (Mylog[i-1][-1] != Mylog[i][0]):
     cnt += 1
+
 print("Yes" if cnt==0 else "No")
Buggy program (verdict: Wrong Answer):
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K-1):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
sunuke=set(sunuke)
print(N-len(sunuke))

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

Expected output:
3


Actual output:
5


Fixed program (verdict: Accepted):
N,K=map(int,input().split())
a=[list(map(int,input().split()))for i in range(2*K)]
sunuke=[]
for i in range(2*K):
    if i%2==1:
        d=sum(a[i-1])
        for n in range(d):
            sunuke.append(a[i][n])
sunuke=set(sunuke)
print(N-len(sunuke))

Diff:
 N,K=map(int,input().split())
 a=[list(map(int,input().split()))for i in range(2*K)]
 sunuke=[]
-for i in range(2*K-1):
+for i in range(2*K):
     if i%2==1:
         d=sum(a[i-1])
         for n in range(d):
             sunuke.append(a[i][n])
 sunuke=set(sunuke)
 print(N-len(sunuke))
Buggy program (verdict: Wrong Answer):
N=int(input())
S=int(input())

l_S=list(str(S))

count=0
for i in range(0,1000):
    i_1=int(i/100)
    i_2=int(i/10)-i_1*10
    i_3=i%10
    if str(i_1) in l_S[:-2]:
        idx_1=l_S[:-2].index(str(i_1))
        if str(i_2) in l_S[idx_1+1:-1]:
            idx_2=l_S[idx_1+1:-1].index(str(i_2))+idx_1+1
            if str(i_3) in l_S[idx_2+1:]:
                count+=1
print(count)

Failing test case input:
4
0224

Expected output:
3

Actual output:
1


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

l_S=list(S)

count=0
for i in range(0,1000):
    i_1=int(i/100)
    i_2=int(i/10)-i_1*10
    i_3=i%10
    if str(i_1) in l_S[:-2]:
        idx_1=l_S[:-2].index(str(i_1))
        if str(i_2) in l_S[idx_1+1:-1]:
            idx_2=l_S[idx_1+1:-1].index(str(i_2))+idx_1+1
            if str(i_3) in l_S[idx_2+1:]:
                count+=1
print(count)

Diff:
 N=int(input())
-S=int(input())
+S=str(input())
 
-l_S=list(str(S))
+l_S=list(S)
 
 count=0
 for i in range(0,1000):
     i_1=int(i/100)
     i_2=int(i/10)-i_1*10
     i_3=i%10
     if str(i_1) in l_S[:-2]:
         idx_1=l_S[:-2].index(str(i_1))
         if str(i_2) in l_S[idx_1+1:-1]:
             idx_2=l_S[idx_1+1:-1].index(str(i_2))+idx_1+1
             if str(i_3) in l_S[idx_2+1:]:
                 count+=1
 print(count)
Buggy program (verdict: Wrong Answer):
y=input().split()
for i in range(len(y)):
    y[i]=int(y[i])
a=[]
a.append(y[0]+y[1])
a.append(y[2]+y[1])
a.append(y[0]+y[2])
a.sort()
print(a[1])

Failing test case input:
-60 0 2

Expected output:
-60


Actual output:
-58


Fixed program (verdict: Accepted):
y=input().split()
for i in range(len(y)):
    y[i]=int(y[i])
a=[]
a.append(y[0]+y[1])
a.append(y[2]+y[1])
a.append(y[0]+y[2])
a.sort()
print(a[0])

Diff:
 y=input().split()
 for i in range(len(y)):
     y[i]=int(y[i])
 a=[]
 a.append(y[0]+y[1])
 a.append(y[2]+y[1])
 a.append(y[0]+y[2])
 a.sort()
-print(a[1])
+print(a[0])
Buggy program (verdict: Wrong Answer):
s=input()

if s[0] == s[1] and s[0] == s[2] and s[0] == s[3]:
  print("No")

elif s[0] == s[1] or s[0] == s[2] or s[0] == s[3]:
  if s[0] == s[1]:
    if s[2] == s[3]:
      print("Yes")
  elif  s[0] != s[1]:
    if s[1] == s[2]:
      print("Yes")
    elif  s[1] == s[3]:
      print("Yes")

else:
  print("No")

Failing test case input:
RC?R

Expected output:
No


Actual output:

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

if s[0] == s[1] and s[0] == s[2] and s[0] == s[3]:
  print("No")

elif s[0] == s[1] or s[0] == s[2] or s[0] == s[3]:
  if s[0] == s[1]:
    if s[2] == s[3]:
      print("Yes")
    else:
     print("No")
  elif  s[0] != s[1]:
    if s[1] == s[2]:
      print("Yes")
    elif  s[1] == s[3]:
      print("Yes")
    else:
     print("No")
  else:
     print("No")

else:
  print("No")

Diff:
 s=input()
 
 if s[0] == s[1] and s[0] == s[2] and s[0] == s[3]:
   print("No")
 
 elif s[0] == s[1] or s[0] == s[2] or s[0] == s[3]:
   if s[0] == s[1]:
     if s[2] == s[3]:
       print("Yes")
+    else:
+     print("No")
   elif  s[0] != s[1]:
     if s[1] == s[2]:
       print("Yes")
     elif  s[1] == s[3]:
       print("Yes")
+    else:
+     print("No")
+  else:
+     print("No")
 
 else:
   print("No")
Buggy program (verdict: Wrong Answer):


N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)

if mod > A:
    blue += (mod-B)
else:
    blue += mod

print(blue)

Failing test case input:
8 1 5

Expected output:
2


Actual output:
-2


Fixed program (verdict: Accepted):


N, A, B = map(int, input().split())
q, mod = divmod(N,(A+B))
blue = (q*A)
blue += min(mod, A)

print(blue)

Diff:
 
 
 N, A, B = map(int, input().split())
 q, mod = divmod(N,(A+B))
 blue = (q*A)
-
-if mod > A:
-    blue += (mod-B)
-else:
-    blue += mod
+blue += min(mod, A)
 
 print(blue)
Buggy program (verdict: Wrong Answer):
a,b,c,d = map(int,input().split())

while a > 0 or c > 0:
    c -= b
    a -= d
    if a <= 0:
        print('No')
        exit()
    elif c <= 0:
        print('Yes')
        exit()

Failing test case input:
7 7 1 12

Expected output:
Yes


Actual output:
No


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

while a > 0 or c > 0:
    c -= b
    if c <= 0:
        print('Yes')
        exit()
    a -= d
    if a <= 0:
        print('No')
        exit()

Diff:
 a,b,c,d = map(int,input().split())
 
 while a > 0 or c > 0:
     c -= b
+    if c <= 0:
+        print('Yes')
+        exit()
     a -= d
     if a <= 0:
         print('No')
         exit()
-    elif c <= 0:
-        print('Yes')
-        exit()
Buggy program (verdict: Wrong Answer):
K, N = map(int, input().split())
A = list(map(int, input().split()))

diff = [None] * N

for i in range(1, N-1):
    diff[i] = A[i+1] - A[i]

diff[0] = A[0]
diff[N-1] = K - A[N-1]

max_diff = max(diff)
answer = sum(diff) - max(diff)
print(answer)

Failing test case input:
7 3
0 2 28

Expected output:
-19


Actual output:
-21


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

diff = [None] * N

for i in range(N-1):
    diff[i] = A[i+1] - A[i]

diff[N-1] = K - A[N-1] + A[0]

max_diff = max(diff)
answer = sum(diff) - max(diff)
print(answer)

Diff:
 K, N = map(int, input().split())
 A = list(map(int, input().split()))
 
 diff = [None] * N
 
-for i in range(1, N-1):
+for i in range(N-1):
     diff[i] = A[i+1] - A[i]
 
-diff[0] = A[0]
-diff[N-1] = K - A[N-1]
+diff[N-1] = K - A[N-1] + A[0]
 
 max_diff = max(diff)
 answer = sum(diff) - max(diff)
 print(answer)
Buggy program (verdict: Wrong Answer):
a,b = input().split()
print(a*int(b) if a>b else b*int(a))

Failing test case input:
10 22

Expected output:
10101010101010101010101010101010101010101010


Actual output:
22222222222222222222


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

Diff:
-a,b = input().split()
-print(a*int(b) if a>b else b*int(a))
+a, b = input().split()
+print(a*int(b) if a < b else b*int(a))
Buggy program (verdict: Wrong Answer):
n=int(input())
s=input()
lst1=[0]*n
lst2=[0]*n
if s[0]=='W':
  lst1[0]=1
if s[0]=='E':
  lst2[0]=1
for i in range(1,n):
  if s[i]=='W':
    lst1[i]=lst1[i-1]+1
  if s[i]=='E':
    lst2[i]=lst2[i-1]+1
l=[]
l.append(lst2[n-1]-lst2[0])
for j in range(1,n-1):
  l.append(lst1[j-1]+lst2[n-1]-lst2[j])
l.append(lst1[n-2])

print(min(l))
  
  


Failing test case input:
5
WEEWW

Expected output:
1

Actual output:
-2


Fixed program (verdict: Accepted):
n=int(input())
s=input()
lst1=[0]*n
lst2=[0]*n
if s[0]=='W':
  lst1[0]=1
if s[0]=='E':
  lst2[0]=1
for i in range(1,n):
  if s[i]=='W':
    lst1[i]=lst1[i-1]+1
    lst2[i]=lst2[i-1]
  if s[i]=='E':
    lst2[i]=lst2[i-1]+1
    lst1[i]=lst1[i-1]
l=[]
l.append(lst2[n-1]-lst2[0])
for j in range(1,n-1):
  l.append(lst1[j-1]+lst2[n-1]-lst2[j])
l.append(lst1[n-2])

print(min(l))
  
  


Diff:
 n=int(input())
 s=input()
 lst1=[0]*n
 lst2=[0]*n
 if s[0]=='W':
   lst1[0]=1
 if s[0]=='E':
   lst2[0]=1
 for i in range(1,n):
   if s[i]=='W':
     lst1[i]=lst1[i-1]+1
+    lst2[i]=lst2[i-1]
   if s[i]=='E':
     lst2[i]=lst2[i-1]+1
+    lst1[i]=lst1[i-1]
 l=[]
 l.append(lst2[n-1]-lst2[0])
 for j in range(1,n-1):
   l.append(lst1[j-1]+lst2[n-1]-lst2[j])
 l.append(lst1[n-2])
 
 print(min(l))