ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
a, b, c = map(int, input().split())
if a == b and b == c:
    print(1)
elif (a != b and b == c) or (a == b and b != c):
    print(2)
else:
    print(3)

Failing test case input:
4 12 4

Expected output:
2


Actual output:
3


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

Diff:
 a, b, c = map(int, input().split())
 if a == b and b == c:
     print(1)
-elif (a != b and b == c) or (a == b and b != c):
+elif (a != b and b == c) or (a == b and b != c) or (a == c and a != b):
     print(2)
 else:
     print(3)

Buggy program (verdict: Wrong Answer):
A=list(map(int,input().split()))
for i in range(99):
  if A.count(i+1)==2:
    print(2)
  elif A.count(i+1)==3:
    print(1)
print(3)

Failing test case input:
4 16 4

Expected output:
2


Actual output:
2
3


Fixed program (verdict: Accepted):
A=list(map(int,input().split()))
res=0
for i in range(100):
  if A.count(i+1)==2:
    print(2)
    res+=1
  elif A.count(i+1)==3:
    print(1)
    res+=1
if res==0:
  print(3)


Diff:
 A=list(map(int,input().split()))
-for i in range(99):
+res=0
+for i in range(100):
   if A.count(i+1)==2:
     print(2)
+    res+=1
   elif A.count(i+1)==3:
     print(1)
-print(3)
+    res+=1
+if res==0:
+  print(3)
+
Buggy program (verdict: Wrong Answer):
S = str(input())

flag = False
if len(S) % 2 == 1:
    flag = False
else:
    for count in range(int(len(S)/2)):
        if S[count] != "h" and S[count + 1] != "i":
            flag = False
            break
        else:
            flag = True

if flag == True:
    print("Yes")
else:
    print("No")

     

Failing test case input:
ha

Expected output:
No

Actual output:
Yes


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

flag = False
if len(S) % 2 == 1:
    flag = False
else:
    for count in range(int(len(S)/2)):
        if S[count*2] != "h" or S[count*2 + 1] != "i":
            flag = False
            break
        else:
            flag = True

if flag == True:
    print("Yes")
else:
    print("No")

     

Diff:
 S = str(input())
 
 flag = False
 if len(S) % 2 == 1:
     flag = False
 else:
     for count in range(int(len(S)/2)):
-        if S[count] != "h" and S[count + 1] != "i":
+        if S[count*2] != "h" or S[count*2 + 1] != "i":
             flag = False
             break
         else:
             flag = True
 
 if flag == True:
     print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
A,X = (int(a) for a in input().split())
if A > X:
  print("0")
else:
  print("10")

Failing test case input:
-5 7

Expected output:
0


Actual output:
10


Fixed program (verdict: Accepted):
X,A = (int(a) for a in input().split())
if A>X:
  print("0")
else:
  print("10")

Diff:
-A,X = (int(a) for a in input().split())
-if A > X:
+X,A = (int(a) for a in input().split())
+if A>X:
   print("0")
 else:
   print("10")
Buggy program (verdict: Wrong Answer):
M, D =  map(int, input().split())
count = 0
for d in range(D - 1):
    d += 2
    d1 = int(d/10)
    d2 = d - d1 * 10
    if d1 * d2 <= M and d1 > 1 and d2 > 1:
        print(d1, d2)
        count += 1
print(count)

Failing test case input:
12 32

Expected output:
6


Actual output:
2 2
2 3
2 4
2 5
2 6
3 2
6


Fixed program (verdict: Accepted):
M, D =  map(int, input().split())
count = 0
for d in range(D - 1):
    d += 2
    d1 = int(d/10)
    d2 = d - d1 * 10
    if d1 * d2 <= M and d1 > 1 and d2 > 1:
        count += 1
print(count)

Diff:
 M, D =  map(int, input().split())
 count = 0
 for d in range(D - 1):
     d += 2
     d1 = int(d/10)
     d2 = d - d1 * 10
     if d1 * d2 <= M and d1 > 1 and d2 > 1:
-        print(d1, d2)
         count += 1
 print(count)
Buggy program (verdict: Wrong Answer):
ST = input("").split()
S, T = ST[0], ST[1]
print("{}".format(S + T))

Failing test case input:
kfst fmuu

Expected output:
fmuukfst


Actual output:
kfstfmuu


Fixed program (verdict: Accepted):
ST = input("").split()
S, T = ST[0], ST[1]
print("{}".format(T + S))

Diff:
 ST = input("").split()
 S, T = ST[0], ST[1]
-print("{}".format(S + T))
+print("{}".format(T + S))
Buggy program (verdict: Wrong Answer):
import sys

(x, n) = list(map(int, input().split()))
arr = list(map(int, input().split()))

if(len(arr) == 0):
    print(x)
    sys.exit()

i = 1
while True:
    if(not (x - i in arr)):
        print(x - i)
        sys.exit()
    
    if(not (x + i in arr)):
        print(x + i)
        sys.exit()
    i += 1


Failing test case input:
62 1
1 1 2 16 18

Expected output:
62


Actual output:
61


Fixed program (verdict: Accepted):
import sys

(x, n) = list(map(int, input().split()))
arr = list(map(int, input().split()))

if(len(arr) == 0):
    print(x)
    sys.exit()

if(not(x in arr)):
    print(x)
    sys.exit()

i = 1
while True:
    if(not (x - i in arr)):
        print(x - i)
        sys.exit()
    
    if(not (x + i in arr)):
        print(x + i)
        sys.exit()
    i += 1


Diff:
 import sys
 
 (x, n) = list(map(int, input().split()))
 arr = list(map(int, input().split()))
 
 if(len(arr) == 0):
     print(x)
     sys.exit()
 
+if(not(x in arr)):
+    print(x)
+    sys.exit()
+
 i = 1
 while True:
     if(not (x - i in arr)):
         print(x - i)
         sys.exit()
     
     if(not (x + i in arr)):
         print(x + i)
         sys.exit()
     i += 1
Buggy program (verdict: Wrong Answer):
n, m = map(int, input().split())
start = 1
end = n
for i in range(m):
    l, r = map(int, input().split())
    if start < l:
        start = l
    if r < end:
        end = r
print(end - start + 1)

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

Expected output:
0


Actual output:
-3


Fixed program (verdict: Accepted):
n, m = map(int, input().split())
start = 1
end = n
for i in range(m):
    l, r = map(int, input().split())
    if start < l:
        start = l
    if r < end:
        end = r
print(max(end - start + 1, 0))

Diff:
 n, m = map(int, input().split())
 start = 1
 end = n
 for i in range(m):
     l, r = map(int, input().split())
     if start < l:
         start = l
     if r < end:
         end = r
-print(end - start + 1)
+print(max(end - start + 1, 0))
Buggy program (verdict: Wrong Answer):
n, k = list(map(int, input().split()))
snukes = []
for x in range(k):
    input()
    y = ((list(map(int, input().split()))))
    for i in y:
        snukes.append(i)

print(len(snukes) - len(set(snukes)))


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

Expected output:
3


Actual output:
0


Fixed program (verdict: Accepted):
n, k = list(map(int, input().split()))
snukes = [0] * n
for x in range(k):
    input()
    y = ((list(map(int, input().split()))))
    for i in y:
        snukes[i - 1] = 1

print(snukes.count(0))


Diff:
 n, k = list(map(int, input().split()))
-snukes = []
+snukes = [0] * n
 for x in range(k):
     input()
     y = ((list(map(int, input().split()))))
     for i in y:
-        snukes.append(i)
+        snukes[i - 1] = 1
 
-print(len(snukes) - len(set(snukes)))
+print(snukes.count(0))
Buggy program (verdict: Wrong Answer):
N = int(input())
l1 = [int(i) for i in input().split()]
l2 = [int(i) for i in input().split()]

A = [l1, l2]

print (A)

max_candy = 0
for i in range(N):
    temp = 0
    temp += sum(A[0][0:i+1])
    temp += sum(A[1][i:])
    if temp > max_candy:
        max_candy = temp

print(max_candy)


Failing test case input:
7
0 14 -1 0 2 6 4
50 2 1 5 1 -1 2

Expected output:
60


Actual output:
[[0, 14, -1, 0, 2, 6, 4], [50, 2, 1, 5, 1, -1, 2]]
60


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

A = [l1, l2]
max_candy = 0
for i in range(N):
    temp = 0
    temp += sum(A[0][0:i+1])
    temp += sum(A[1][i:])
    if temp > max_candy:
        max_candy = temp

print(max_candy)


Diff:
 N = int(input())
 l1 = [int(i) for i in input().split()]
 l2 = [int(i) for i in input().split()]
 
 A = [l1, l2]
-
-print (A)
-
 max_candy = 0
 for i in range(N):
     temp = 0
     temp += sum(A[0][0:i+1])
     temp += sum(A[1][i:])
     if temp > max_candy:
         max_candy = temp
 
 print(max_candy)
Buggy program (verdict: Wrong Answer):
x = int(input())
ans = 1
for i in range(1,36):
    if i**2<=x: ans = i**2
print(ans)

Failing test case input:
1746

Expected output:
1728


Actual output:
1225


Fixed program (verdict: Accepted):
x = int(input())
ans = 1
for i in range(1,36):
    for j in range(2,1001):
        if i**j<=x: ans = max(ans,i**j)
print(ans)

Diff:
 x = int(input())
 ans = 1
 for i in range(1,36):
-    if i**2<=x: ans = i**2
+    for j in range(2,1001):
+        if i**j<=x: ans = max(ans,i**j)
 print(ans)
Buggy program (verdict: Wrong Answer):
import sys
input = sys.stdin.readline
A, B, C, D = map(int, input().split())
t = 0
while A > 0 and (C > 0):
  if t % 2: A -= D
  else: C -= B
  t += 1
if A: print("Yes")
else: print("No")

Failing test case input:
34 4 40 5

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
import sys
input = sys.stdin.readline
A, B, C, D = map(int, input().split())
t = 0
while A > 0 and (C > 0):
  if t % 2: A -= D
  else: C -= B
  t += 1
if A > 0: print("Yes")
else: print("No")

Diff:
 import sys
 input = sys.stdin.readline
 A, B, C, D = map(int, input().split())
 t = 0
 while A > 0 and (C > 0):
   if t % 2: A -= D
   else: C -= B
   t += 1
-if A: print("Yes")
+if A > 0: print("Yes")
 else: print("No")
Buggy program (verdict: Wrong Answer):
N = int(input())
l = [0] * 6
l[0] = N
m = [int(input()) for i in range(5)]

ans = N

print(ans)

Failing test case input:
10000000007
2
3
1
6
11

Expected output:
10000000011


Actual output:
10000000007


Fixed program (verdict: Accepted):
from math import ceil
N = int(input())
l = [0] * 6
l[0] = N
m = [int(input()) for i in range(5)]
ans = ceil(N/min(m)) + 4
print(ans)

Diff:
+from math import ceil
 N = int(input())
 l = [0] * 6
 l[0] = N
 m = [int(input()) for i in range(5)]
-
-ans = N
-
+ans = ceil(N/min(m)) + 4
 print(ans)
Buggy program (verdict: Wrong Answer):
def INT():
    return int(input())

def MI():
    return map(int, input().split())

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

S = input()
ans = int(S[0] == "R")

for i in range(1, 3):
    if S[i] == "R" and S[i - 1] == "R":
        ans += 1
        
print(ans)

Failing test case input:
NSR

Expected output:
1


Actual output:
0


Fixed program (verdict: Accepted):
def INT():
    return int(input())

def MI():
    return map(int, input().split())

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

S = input()
ans = int(S[0] == "R" and S[1] == "R") + int(S[2] == "R" and S[1] == "R") + 1
print(ans if "R" in S else 0)

Diff:
 def INT():
     return int(input())
 
 def MI():
     return map(int, input().split())
 
 def LI():
     return list(map(int, input().split()))
 
 S = input()
-ans = int(S[0] == "R")
-
-for i in range(1, 3):
-    if S[i] == "R" and S[i - 1] == "R":
-        ans += 1
-        
-print(ans)
+ans = int(S[0] == "R" and S[1] == "R") + int(S[2] == "R" and S[1] == "R") + 1
+print(ans if "R" in S else 0)
Buggy program (verdict: Wrong Answer):
import bisect
n = int(input())
A = []
for i in range(n):
    num  = int(input())
    if A == []:
        A.append(num)
    elif num > A[-1]:
        A.append(num)
    else:
        j = bisect.bisect_left(A, num)
        A[j] = num
print(len(A) - 1)

Failing test case input:
5
0
2
1
0
11

Expected output:
3


Actual output:
2


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

Diff:
 import bisect
 n = int(input())
 A = []
 for i in range(n):
     num  = int(input())
     if A == []:
         A.append(num)
     elif num > A[-1]:
         A.append(num)
     else:
         j = bisect.bisect_left(A, num)
         A[j] = num
-print(len(A) - 1)
+print(len(A))
Buggy program (verdict: Wrong Answer):
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
b =[]
ans = []
for i in range(m):
    t = tuple(map(int,input().split()))
    b.append(t)
b = sorted(b,key = lambda x:x[1],reverse=True)
for i in b:
    for j in range(i[0]):
        if a:
            x =a.pop()
            if x > i[1]:
                print(sum(a)+x+sum(ans))
                exit()
            else:
                ans.append(i[1])
        else:
            print(ans)
            exit()
print(sum(ans)+sum(a))


Failing test case input:
11 3
1 1 1 1 0 2 1 1 1 1 1
6 1000001000
4 1000000000
3 1100000000

Expected output:
11300006000


Actual output:
[1100000000, 1100000000, 1100000000, 1000001000, 1000001000, 1000001000, 1000001000, 1000001000, 1000001000, 1000000000, 1000000000]


Fixed program (verdict: Accepted):
n,m = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
b =[]
ans = []
for i in range(m):
    t = tuple(map(int,input().split()))
    b.append(t)
b = sorted(b,key = lambda x:x[1],reverse=True)
for i in b:
    for j in range(i[0]):
        if a:
            x =a.pop()
            if x > i[1]:
                print(sum(a) + x + sum(ans))
                exit()
            else:
                ans.append(i[1])
        else:
            print(sum(ans))
            exit()
print(sum(ans)+sum(a))


Diff:
 n,m = map(int,input().split())
 a = list(map(int,input().split()))
 a.sort(reverse=True)
 b =[]
 ans = []
 for i in range(m):
     t = tuple(map(int,input().split()))
     b.append(t)
 b = sorted(b,key = lambda x:x[1],reverse=True)
 for i in b:
     for j in range(i[0]):
         if a:
             x =a.pop()
             if x > i[1]:
-                print(sum(a)+x+sum(ans))
+                print(sum(a) + x + sum(ans))
                 exit()
             else:
                 ans.append(i[1])
         else:
-            print(ans)
+            print(sum(ans))
             exit()
 print(sum(ans)+sum(a))
Buggy program (verdict: Wrong Answer):
s = list(input())
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
  print("Good")
else:
  print("Bad")


Failing test case input:
0024

Expected output:
Bad

Actual output:
Good


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

Diff:
 s = list(input())
 if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
-  print("Good")
-else:
   print("Bad")
-
+else:
+  print("Good")
Buggy program (verdict: Wrong Answer):
n = int(input())
a = n / 1000
if int(a) == a:
	print('0')
else:
	a = int(a) + 1
	a = a * 1000


Failing test case input:
721

Expected output:
279


Actual output:

Fixed program (verdict: Accepted):
n = int(input())
a = n / 1000
if int(a) == a:
	print('0')
else:
	a = int(a) + 1
	a = a * 1000
	print(a-n)

Diff:
 n = int(input())
 a = n / 1000
 if int(a) == a:
 	print('0')
 else:
 	a = int(a) + 1
 	a = a * 1000
-
+	print(a-n)
Buggy program (verdict: Wrong Answer):
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  p.append(a)
list.sort(p)
flag=1
for j in range (N-1):
  if p[j]==p[j+1]:
    flag*=-1
  else:
    if flag>0:
      count+=1
    else:
      count-=1
    flag=1
if flag>0:
  count-=1
else:
  count+=1
print(count)

Failing test case input:
4
0
1
14
3

Expected output:
4


Actual output:
2


Fixed program (verdict: Accepted):
N=int(input())
p=[]
count=0
for i in range (N):
  a=int(input())
  p.append(a)
list.sort(p)
flag=1
for j in range (N-1):
  if p[j]==p[j+1]:
    flag*=-1
  else:
    if flag>0:
      count+=1
    flag=1
if flag>0:
  count+=1
print(count)

Diff:
 N=int(input())
 p=[]
 count=0
 for i in range (N):
   a=int(input())
   p.append(a)
 list.sort(p)
 flag=1
 for j in range (N-1):
   if p[j]==p[j+1]:
     flag*=-1
   else:
     if flag>0:
       count+=1
-    else:
-      count-=1
     flag=1
 if flag>0:
-  count-=1
-else:
   count+=1
 print(count)
Buggy program (verdict: Wrong Answer):
A,B,C=map(int,input().split())

diff = A-B
if diff-C >= 0:
  print(diff-C)
else:
  print(C-diff)

Failing test case input:
12 0 7

Expected output:
0


Actual output:
5


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

diff = A-B
if diff-C > 0:
  print(0)
else:
  print(C-diff)

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

q, mod = divmod(n, (a+b))

ans = q * b
if(mod > a):
  ans = q * b + (q - a)

print(ans)

Failing test case input:
13 16 1

Expected output:
13


Actual output:
0


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

q, mod = divmod(n, (a+b))

ans = q * a + min(mod, a)
print(ans)

Diff:
 n, a, b = map(int, input().split())
 
 q, mod = divmod(n, (a+b))
 
-ans = q * b
-if(mod > a):
-  ans = q * b + (q - a)
-
+ans = q * a + min(mod, a)
 print(ans)
Buggy program (verdict: Wrong Answer):
N,K= map(int, input().split())
A = 0
cnt = -1
if N == 0:
    print(1)
else:
    while N >= A:
        cnt += 1
        A = K**(cnt+1)-1
        print(A)
    print(cnt+1)

Failing test case input:
1110111 2

Expected output:
21


Actual output:
1
3
7
15
31
63
127
255
511
1023
2047
4095
8191
16383
32767
65535
131071
262143
524287
1048575
2097151
21


Fixed program (verdict: Accepted):
N,K= map(int, input().split())
A = 0
cnt = -1
if N <= K-1:
    print(1)
else:
    while N > A:
        cnt += 1
        A = K**(cnt+1)-1
    print(cnt+1)

Diff:
 N,K= map(int, input().split())
 A = 0
 cnt = -1
-if N == 0:
+if N <= K-1:
     print(1)
 else:
-    while N >= A:
+    while N > A:
         cnt += 1
         A = K**(cnt+1)-1
-        print(A)
     print(cnt+1)
Buggy program (verdict: Wrong Answer):
N = int(input())						


ans = 0


if 1<=N<=9:
	ans += N


if 10<=N<=99:
	ans += 9


if 100<=N<=999:
	ans += N-99


if 1000<=N<=9999:
	ans += 900


if 10000<=N<=99999:
	ans += N-9999



if 100000<=N<=999999:
	ans += 9999


print(ans)


Failing test case input:
289

Expected output:
199


Actual output:
190


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


ans = 0


if 1<=N<=9:
	ans += N


if 10<=N:
	ans += 9


if 100<=N<=999:
	ans += N-99


if 1000<=N:
	ans += 900


if 10000<=N<=99999:
	ans += N-9999



if 100000<=N:
	ans += 90000


print(ans)


Diff:
 N = int(input())						
 
 
 ans = 0
 
 
 if 1<=N<=9:
 	ans += N
 
 
-if 10<=N<=99:
+if 10<=N:
 	ans += 9
 
 
 if 100<=N<=999:
 	ans += N-99
 
 
-if 1000<=N<=9999:
+if 1000<=N:
 	ans += 900
 
 
 if 10000<=N<=99999:
 	ans += N-9999
 
 
 
-if 100000<=N<=999999:
-	ans += 9999
+if 100000<=N:
+	ans += 90000
 
 
 print(ans)
Buggy program (verdict: Wrong Answer):
a = input()
b = input()

max_len = 105

if len(a) < max_len:
    a = '0' * (max_len - len(a)) + a

if len(b) < max_len:
    b = '0' * (max_len - len(b)) + b

if a > b:
    ans = "GRATER"
elif a == b:
    ans = "EQUAL"
else:
    ans = "LESS"

print(ans)


Failing test case input:
123456789012345678901234567890
1279613655159584312437078207

Expected output:
GREATER


Actual output:
GRATER


Fixed program (verdict: Accepted):
a = input()
b = input()

max_len = 105

if len(a) < max_len:
    a = '0' * (max_len - len(a)) + a

if len(b) < max_len:
    b = '0' * (max_len - len(b)) + b

if a > b:
    ans = "GREATER"
elif a == b:
    ans = "EQUAL"
else:
    ans = "LESS"

print(ans)


Diff:
 a = input()
 b = input()
 
 max_len = 105
 
 if len(a) < max_len:
     a = '0' * (max_len - len(a)) + a
 
 if len(b) < max_len:
     b = '0' * (max_len - len(b)) + b
 
 if a > b:
-    ans = "GRATER"
+    ans = "GREATER"
 elif a == b:
     ans = "EQUAL"
 else:
     ans = "LESS"
 
 print(ans)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(input().split())
An = [int(num) for num in A]
print(An)

sum = 0

for i in range(1,N):
  if An[i-1]<=An[i]:
    continue
  else:
    sum += (An[i-1]-An[i])
    An[i] = An[i-1]
    
print(sum)

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

Expected output:
35


Actual output:
[0, -1, 0, 36, 2]
35


Fixed program (verdict: Accepted):
N = int(input())
A = list(input().split())
An = [int(num) for num in A]

sum = 0

for i in range(1,N):
  if An[i-1]<=An[i]:
    continue
  else:
    sum += (An[i-1]-An[i])
    An[i] = An[i-1]
    
print(sum)

Diff:
 N = int(input())
 A = list(input().split())
 An = [int(num) for num in A]
-print(An)
 
 sum = 0
 
 for i in range(1,N):
   if An[i-1]<=An[i]:
     continue
   else:
     sum += (An[i-1]-An[i])
     An[i] = An[i-1]
     
 print(sum)
Buggy program (verdict: Wrong Answer):
s1, s2, s3= map(str,input().split())

print(s1.upper()[0])
print(s2.upper()[0])
print(s3.upper()[0])

Failing test case input:
l oearest robghien

Expected output:
LOR


Actual output:
L
O
R


Fixed program (verdict: Accepted):
s1, s2, s3= map(str,input().split())

print(s1.upper()[0] + s2.upper()[0] + s3.upper()[0])

Diff:
 s1, s2, s3= map(str,input().split())
 
-print(s1.upper()[0])
-print(s2.upper()[0])
-print(s3.upper()[0])
+print(s1.upper()[0] + s2.upper()[0] + s3.upper()[0])
Buggy program (verdict: Wrong Answer):



n = int(input())

scores = [0,0]

for i in range(n):
    card = input().split()
    first_card = card[0]
    card.sort()
    print(card)
    print(first_card)
    if (card[0] == card[1]):
        scores[0] += 1
        scores[1] += 1
    elif(first_card == card[0]):
        scores[1] += 3
    else:
        scores[0] += 3

print(scores[0], scores[1])

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

Expected output:
6 3


Actual output:
['gpg', 'v`f']
v`f
['igug', 'jrhd']
jrhd
['jonk', 'rheug']
jonk
6 3


Fixed program (verdict: Accepted):



n = int(input())

scores = [0,0]

for i in range(n):
    card = input().split()
    first_card = card[0]
    card.sort()
    if (card[0] == card[1]):
        scores[0] += 1
        scores[1] += 1
    elif(first_card == card[0]):
        scores[1] += 3
    else:
        scores[0] += 3

print(scores[0], scores[1])

Diff:
 
 
 
 n = int(input())
 
 scores = [0,0]
 
 for i in range(n):
     card = input().split()
     first_card = card[0]
     card.sort()
-    print(card)
-    print(first_card)
     if (card[0] == card[1]):
         scores[0] += 1
         scores[1] += 1
     elif(first_card == card[0]):
         scores[1] += 3
     else:
         scores[0] += 3
 
 print(scores[0], scores[1])
Buggy program (verdict: Wrong Answer):
S = input()
for i in range(7):
    if S[:i] + S[-7+i] == 'keyence':
        print('YES')
        exit()
print('NO')

Failing test case input:
keyofscience

Expected output:
YES

Actual output:
NO


Fixed program (verdict: Accepted):
S = input()
for i in range(7):
    if S[:i] + S[-7+i:] == 'keyence':
        print('YES')
        exit()
print('NO')

Diff:
 S = input()
 for i in range(7):
-    if S[:i] + S[-7+i] == 'keyence':
+    if S[:i] + S[-7+i:] == 'keyence':
         print('YES')
         exit()
 print('NO')
Buggy program (verdict: Wrong Answer):
day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
month = [0,31,60,91,121,152,182,213,244,274,305,335]
m,d=map(int,input().split())
print(day[(month[m-1]+d)%7]+'day')


Failing test case input:
4 3
3 14
0 0

Expected output:
Saturday
Sunday


Actual output:
Saturday


Fixed program (verdict: Accepted):
while 1:
	day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
	month = [0,31,60,91,121,152,182,213,244,274,305,335]
	m,d=map(int,input().split())
	if m == 0:
		break
	print(day[(month[m-1]+d)%7]+'day')


Diff:
-day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
-month = [0,31,60,91,121,152,182,213,244,274,305,335]
-m,d=map(int,input().split())
-print(day[(month[m-1]+d)%7]+'day')
+while 1:
+	day = ['Wednes','Thurs','Fri','Satur','Sun','Mon','Tues']
+	month = [0,31,60,91,121,152,182,213,244,274,305,335]
+	m,d=map(int,input().split())
+	if m == 0:
+		break
+	print(day[(month[m-1]+d)%7]+'day')
Buggy program (verdict: Wrong Answer):
n=list(map(int,input().split()))
s=[1,9,4,7]
if n==s:
  print("YES")
else:
  print("NO")

Failing test case input:
1 7 9 4

Expected output:
YES

Actual output:
NO


Fixed program (verdict: Accepted):
n=list(map(int,input().split()))
s=[1,9,4,7]
if set(n)==set(s):
  print("YES")
else:
  print("NO")

Diff:
 n=list(map(int,input().split()))
 s=[1,9,4,7]
-if n==s:
+if set(n)==set(s):
   print("YES")
 else:
   print("NO")
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
arr = [sorted([i, j]) for i, j in enumerate(a,1)]
counter = 0
for i in range(n):
    if i == n-1:
        if arr[-1][0] == arr[0][0] and arr[-1][1] == arr[0][1]:
            counter +=1
    elif arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
        counter +=1
print(counter)

Failing test case input:
5
5 4 5 2 1

Expected output:
2


Actual output:
1


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
arr = [sorted([i, j]) for i, j in enumerate(a,1)]
arr = sorted(arr)
counter = 0
for i in range(n-1):
    if arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
        counter +=1
print(counter)

Diff:
 n = int(input())
 a = list(map(int, input().split()))
 arr = [sorted([i, j]) for i, j in enumerate(a,1)]
+arr = sorted(arr)
 counter = 0
-for i in range(n):
-    if i == n-1:
-        if arr[-1][0] == arr[0][0] and arr[-1][1] == arr[0][1]:
-            counter +=1
-    elif arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
+for i in range(n-1):
+    if arr[i][0] == arr[i+1][0] and arr[i][1] == arr[i+1][1] :
         counter +=1
 print(counter)
Buggy program (verdict: Wrong Answer):
s = input()  
num = int(len(s) / 2)
print(num)
j = len(s) - 1
ans = 0
for i in range(num):
    if s[i] != s[i + j]:
         ans += 1
    j -= 2

print(ans)

Failing test case input:
yvwwsw

Expected output:
2


Actual output:
3
2


Fixed program (verdict: Accepted):
s = input()  
num = int(len(s) / 2)
j = len(s) - 1
ans = 0
for i in range(num):
    if s[i] != s[i + j]:
         ans += 1
    j -= 2

print(ans)

Diff:
 s = input()  
 num = int(len(s) / 2)
-print(num)
 j = len(s) - 1
 ans = 0
 for i in range(num):
     if s[i] != s[i + j]:
          ans += 1
     j -= 2
 
 print(ans)
Buggy program (verdict: Wrong Answer):
import sys
s = sys.stdin.read()
c = 97
while chr(c-1)!='z':
    print('{0} : {1}'.format(chr(c),s.count(chr(c))))
    c += 1



Failing test case input:
dXhl iw S o*er

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


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


Fixed program (verdict: Accepted):
import sys
s = sys.stdin.read()
s = s.lower()
c = 97
while chr(c-1)!='z':
    print('{0} : {1}'.format(chr(c),s.count(chr(c))))
    c += 1



Diff:
 import sys
 s = sys.stdin.read()
+s = s.lower()
 c = 97
 while chr(c-1)!='z':
     print('{0} : {1}'.format(chr(c),s.count(chr(c))))
     c += 1
Buggy program (verdict: Wrong Answer):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
Alice = 0
for i in range(0, n, 2):
    print(i)
    Alice += l[i]
Bob = sum(l) - Alice
print(abs(Bob - Alice))


Failing test case input:
2
-2 54

Expected output:
56


Actual output:
0
56


Fixed program (verdict: Accepted):
n = int(input())
l = list(map(int, input().split()))
l.sort(reverse=True)
Alice = 0
for i in range(0, n, 2):
    Alice += l[i]
Bob = sum(l) - Alice
print(abs(Bob - Alice))


Diff:
 n = int(input())
 l = list(map(int, input().split()))
 l.sort(reverse=True)
 Alice = 0
 for i in range(0, n, 2):
-    print(i)
     Alice += l[i]
 Bob = sum(l) - Alice
 print(abs(Bob - Alice))
Buggy program (verdict: Wrong Answer):
n=int(input())
a=[int(input()) for i in range(0,n)]
j=0
ans=-1
for i in range(0,n):
    if a[j] == 2:
        ans = j
        break
    j = a[j]-1

print(ans)

Failing test case input:
4
4
2
1
2

Expected output:
2


Actual output:
3


Fixed program (verdict: Accepted):
n=int(input())
a=[int(input()) for i in range(0,n)]
j=0
ans=-1
for i in range(1,n+1):
    if a[j] == 2:
        ans = i
        break
    j = a[j]-1

print(ans)

Diff:
 n=int(input())
 a=[int(input()) for i in range(0,n)]
 j=0
 ans=-1
-for i in range(0,n):
+for i in range(1,n+1):
     if a[j] == 2:
-        ans = j
+        ans = i
         break
     j = a[j]-1
 
 print(ans)
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
s=input()
t=True
if s[a]=="-":
    x,y=s[:a],s[a+1:]
    if len(x) != a or len(y) != b:
        t=False
else:
    t=False
print("Yes" if t else "No")

Failing test case input:
1 1
---

Expected output:
No

Actual output:
Yes


Fixed program (verdict: Accepted):
a,b=map(int,input().split())
s=input()
t=True
if s[a]=="-":
    x,y=s[:a],s[a+1:]
    if len(x) != a or len(y) != b or "-" in x or "-" in y:
        t=False
else:
    t=False
print("Yes" if t else "No")

Diff:
 a,b=map(int,input().split())
 s=input()
 t=True
 if s[a]=="-":
     x,y=s[:a],s[a+1:]
-    if len(x) != a or len(y) != b:
+    if len(x) != a or len(y) != b or "-" in x or "-" in y:
         t=False
 else:
     t=False
 print("Yes" if t else "No")
Buggy program (verdict: Wrong Answer):
n = int(input())
la = [int(w) for w in input().split()]

ans = 0
i = 1
for a in la:
    if a != i:
        ans += 1
    else:
        i += 1
print(ans)


Failing test case input:
3
2 -1 -2

Expected output:
-1


Actual output:
3


Fixed program (verdict: Accepted):
n = int(input())
la = [int(w) for w in input().split()]

ans = 0
i = 1
for a in la:
    if a != i:
        ans += 1
    else:
        i += 1
if ans == n and i == 1:
    ans = -1

print(ans)


Diff:
 n = int(input())
 la = [int(w) for w in input().split()]
 
 ans = 0
 i = 1
 for a in la:
     if a != i:
         ans += 1
     else:
         i += 1
+if ans == n and i == 1:
+    ans = -1
+
 print(ans)
Buggy program (verdict: Wrong Answer):
S = input()
num = S[0]
flag = 0
for i in range(1,len(S)):
  if num==S[i]:
    print("Bad")
    flag=1
    break
if flag==0:
  print("Good")

Failing test case input:
2155

Expected output:
Bad


Actual output:
Good


Fixed program (verdict: Accepted):
S = input()
num = S[0]
flag = 0
for i in range(1,len(S)):
  if num==S[i]:
      print("Bad")
      flag=1
      break
  else:
      num=S[i]
if flag==0:
  print("Good")

Diff:
 S = input()
 num = S[0]
 flag = 0
 for i in range(1,len(S)):
   if num==S[i]:
-    print("Bad")
-    flag=1
-    break
+      print("Bad")
+      flag=1
+      break
+  else:
+      num=S[i]
 if flag==0:
   print("Good")
Buggy program (verdict: Wrong Answer):

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

s = [0]*(N+1)
for i in range(N-1):
    s[i+1] = s[i] + A[i]
print(s)

ans = 10**10
for i in range(1,N):
    diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
    ans = min(ans,diff)
print(ans)

Failing test case input:
2
-50 2

Expected output:
52


Actual output:
[0, -50, 0]
52


Fixed program (verdict: Accepted):

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

s = [0]*(N+1)
for i in range(N-1):
    s[i+1] = s[i] + A[i]

ans = 10**10
for i in range(1,N):
    diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
    ans = min(ans,diff)
print(ans)

Diff:
 
 N = int(input())
 A = list(map(int,input().split()))
 
 s = [0]*(N+1)
 for i in range(N-1):
     s[i+1] = s[i] + A[i]
-print(s)
 
 ans = 10**10
 for i in range(1,N):
     diff = abs((s[N-1] + A[-1] - s[i]) - s[i])
     ans = min(ans,diff)
 print(ans)
Buggy program (verdict: Wrong Answer):
li = list(map(int, input().split()))
A = li[0]
B = li[1]
C = li[2]

if A < B < C or A > B > C:
  print("Yes")
  
else:
  print("No")

Failing test case input:
4 8 7

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
li = list(map(int, input().split()))
A = li[0]
B = li[1]
C = li[2]
 
if A < C < B or A > C > B:
  print("Yes")
  
else:
  print("No")

Diff:
 li = list(map(int, input().split()))
 A = li[0]
 B = li[1]
 C = li[2]
-
-if A < B < C or A > B > C:
+ 
+if A < C < B or A > C > B:
   print("Yes")
   
 else:
   print("No")
Buggy program (verdict: Wrong Answer):
Key_str = 7

S = str(input())
count =0

if len(S)<Key_str:
    print("No")

else:
    del_str = len(S)-Key_str
    
    for i in range(len(S)-del_str):
        try_str = S[:i] + S[i+del_str:]
        if try_str == 'keyence':
            print("Yes")
            count+=1
            break
    if count==0:
        print("No")
        

            
            
            
    

Failing test case input:
ecleyen

Expected output:
NO


Actual output:
No


Fixed program (verdict: Accepted):
Key_str = 7

S = str(input())
count =0

if len(S)<Key_str:
    print("No")

else:
    del_str = len(S)-Key_str
    
    for i in range(len(S)-del_str):
        try_str = S[:i] + S[i+del_str:]
        if try_str == 'keyence':
            print("YES")
            count+=1
            break
    if count==0:
        print("NO")
        

            
            
            
    

Diff:
 Key_str = 7
 
 S = str(input())
 count =0
 
 if len(S)<Key_str:
     print("No")
 
 else:
     del_str = len(S)-Key_str
     
     for i in range(len(S)-del_str):
         try_str = S[:i] + S[i+del_str:]
         if try_str == 'keyence':
-            print("Yes")
+            print("YES")
             count+=1
             break
     if count==0:
-        print("No")
+        print("NO")
Buggy program (verdict: Wrong Answer):
from collections import Counter

n = int(input())
s = [Counter(input()) for _ in range(n)]

cnt = s[0]
for scnt in s:
    for str in (scnt | cnt):
        print(str)
        cnt[str] = min(cnt[str], scnt[str])

a = ord('a')
ans = [chr(a + i) * cnt[chr(a + i)] for i in range(25)]
print(*ans, sep='')


Failing test case input:
3
acaa
bdb`c
acacac

Expected output:
c


Actual output:
a
c
b
d
`
c
a
a
c
c


Fixed program (verdict: Accepted):
from collections import Counter

n = int(input())
s = [Counter(input()) for _ in range(n)]

cnt = s[0]
for scnt in s:
    for str in (scnt | cnt):
        cnt[str] = min(cnt[str], scnt[str])

a = ord('a')
ans = [chr(a + i) * cnt[chr(a + i)] for i in range(26)]
print(*ans, sep='')


Diff:
 from collections import Counter
 
 n = int(input())
 s = [Counter(input()) for _ in range(n)]
 
 cnt = s[0]
 for scnt in s:
     for str in (scnt | cnt):
-        print(str)
         cnt[str] = min(cnt[str], scnt[str])
 
 a = ord('a')
-ans = [chr(a + i) * cnt[chr(a + i)] for i in range(25)]
+ans = [chr(a + i) * cnt[chr(a + i)] for i in range(26)]
 print(*ans, sep='')
Buggy program (verdict: Wrong Answer):
def main():
    m1, d1 = map(int, input().split())
    m2, d2 = map(int, input().split())

    if m1 == m2:
        print('1')
    else:
        print('0')

if __name__ == '__main__':
    main()


Failing test case input:
11 11
11 31

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
def main():
    m1, d1 = map(int, input().split())
    m2, d2 = map(int, input().split())

    if m1 != m2:
        print('1')
    else:
        print('0')

if __name__ == '__main__':
    main()


Diff:
 def main():
     m1, d1 = map(int, input().split())
     m2, d2 = map(int, input().split())
 
-    if m1 == m2:
+    if m1 != m2:
         print('1')
     else:
         print('0')
 
 if __name__ == '__main__':
     main()
Buggy program (verdict: Wrong Answer):
def solve():
    H, W = map(int, input().split())
    c = []
    for _ in range(H):
        c.append(list(map(int, input().split())))

    dp = [[0] * W for _ in range(H)]

    for x in range(H):
        dp[x][0] = 1 if c[x][0] == 0 else 0
    for y in range(W):
        dp[0][y] = 1 if c[0][y] == 0 else 0

    for x in range(H-1):
        for y in range(W-1):
            if c[x+1][y+1] == 1:
                dp[x+1][y+1] = 0
            elif c[x][y+1] == 0 and c[x+1][y] == 0:
                dp[x+1][y+1] = dp[x][y] + 1
            else:
                dp[x+1][y+1] = 1

    print(max([max(item) for item in dp])**2)


if __name__ == '__main__':
    solve()

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

Expected output:
4


Actual output:
9


Fixed program (verdict: Accepted):
def solve():
    H, W = map(int, input().split())
    c = []
    for _ in range(H):
        c.append(list(map(int, input().split())))

    dp = [[0] * W for _ in range(H)]

    for x in range(H):
        dp[x][0] = 1 if c[x][0] == 0 else 0
    for y in range(W):
        dp[0][y] = 1 if c[0][y] == 0 else 0

    for x in range(H-1):
        for y in range(W-1):
            if c[x+1][y+1] == 0:
                dp[x+1][y+1] = min([dp[x][y], dp[x][y+1], dp[x+1][y]]) + 1

    print(max([max(item) for item in dp])**2)


if __name__ == '__main__':
    solve()

Diff:
 def solve():
     H, W = map(int, input().split())
     c = []
     for _ in range(H):
         c.append(list(map(int, input().split())))
 
     dp = [[0] * W for _ in range(H)]
 
     for x in range(H):
         dp[x][0] = 1 if c[x][0] == 0 else 0
     for y in range(W):
         dp[0][y] = 1 if c[0][y] == 0 else 0
 
     for x in range(H-1):
         for y in range(W-1):
-            if c[x+1][y+1] == 1:
-                dp[x+1][y+1] = 0
-            elif c[x][y+1] == 0 and c[x+1][y] == 0:
-                dp[x+1][y+1] = dp[x][y] + 1
-            else:
-                dp[x+1][y+1] = 1
+            if c[x+1][y+1] == 0:
+                dp[x+1][y+1] = min([dp[x][y], dp[x][y+1], dp[x+1][y]]) + 1
 
     print(max([max(item) for item in dp])**2)
 
 
 if __name__ == '__main__':
     solve()
Buggy program (verdict: Wrong Answer):
n, x0 = [int(_) for _ in input().split(' ')]
x = [int(_) - x0 for _ in input().split(' ')]

def gcm(p, q):
    if p % q == 0:
        return abs(q)
    else:
        return gcm(q, p % q)

if n == 1:
    print(x[0])
else:
    answer = x[0]
    for i in range(n - 1):
        answer = gcm(answer, x[i + 1])
    print(answer)


Failing test case input:
1 3
1 5 11

Expected output:
2


Actual output:
-2


Fixed program (verdict: Accepted):
n, x0 = [int(_) for _ in input().split(' ')]
x = [abs(int(_) - x0) for _ in input().split(' ')]

def gcm(p, q):
    if p % q == 0:
        return abs(q)
    else:
        return gcm(q, p % q)

if n == 1:
    print(x[0])
else:
    answer = x[0]
    for i in range(n - 1):
        answer = gcm(answer, x[i + 1])
    print(answer)


Diff:
 n, x0 = [int(_) for _ in input().split(' ')]
-x = [int(_) - x0 for _ in input().split(' ')]
+x = [abs(int(_) - x0) for _ in input().split(' ')]
 
 def gcm(p, q):
     if p % q == 0:
         return abs(q)
     else:
         return gcm(q, p % q)
 
 if n == 1:
     print(x[0])
 else:
     answer = x[0]
     for i in range(n - 1):
         answer = gcm(answer, x[i + 1])
     print(answer)
Buggy program (verdict: Wrong Answer):
n = int(input())
data = []

for i in range(n):
	command = input().split()
	if len(command) == 2:
		command,x = command
	else:
		command = command[0]
	if command == 'insert':
		data.insert(0,x)
	elif command == 'delete':
		if x in data:
			data.remove(x)
	elif command == 'deleteFirst':
		print('First')
		data.pop(0)
	elif command == 'deleteLast':
		print('Last')
		data.pop()

print(*data)

Failing test case input:
9
insert 10
insert 2
insert 3
insert 0
delete 3
insert 6
delete 5
deleteFirst
deleteLast

Expected output:
0 2


Actual output:
First
Last
0 2


Fixed program (verdict: Accepted):
from collections import deque

n = int(input())
data = deque()

for i in range(n):
	command = input().split()
	if len(command) == 2:
		command,x = command
	else:
		command = command[0]
	if command == 'insert':
		data.appendleft(x)
	elif command == 'delete':
		if x in data:
			data.remove(x)
	elif command == 'deleteFirst':
		data.popleft()
	elif command == 'deleteLast':
		data.pop()

print(*data)

Diff:
+from collections import deque
+
 n = int(input())
-data = []
+data = deque()
 
 for i in range(n):
 	command = input().split()
 	if len(command) == 2:
 		command,x = command
 	else:
 		command = command[0]
 	if command == 'insert':
-		data.insert(0,x)
+		data.appendleft(x)
 	elif command == 'delete':
 		if x in data:
 			data.remove(x)
 	elif command == 'deleteFirst':
-		print('First')
-		data.pop(0)
+		data.popleft()
 	elif command == 'deleteLast':
-		print('Last')
 		data.pop()
 
 print(*data)
Buggy program (verdict: Wrong Answer):
import bisect

N = int(input())
lst =list(map(int, input().split()))
lst.sort()
ret = 0
for i in range(N):
    for j in range(i + 1, N):
        n = lst[i] + lst[j]
        ret += max(0, bisect.bisect_right(lst, lst[i] + lst[j] + 1) - bisect.bisect_right(lst, lst[j] + 1))
print(ret)

Failing test case input:
7
116 1632 609 7 129 232 12

Expected output:
1


Actual output:
2


Fixed program (verdict: Accepted):
import bisect

N = int(input())
lst =list(map(int, input().split()))
lst.sort()
ret = 0
for i in range(N):
    for j in range(i + 1, N):
        n = lst[i] + lst[j]
        idx = bisect.bisect_left(lst, n)
        ret += max(0, idx - j - 1)
print(ret)

Diff:
 import bisect
 
 N = int(input())
 lst =list(map(int, input().split()))
 lst.sort()
 ret = 0
 for i in range(N):
     for j in range(i + 1, N):
         n = lst[i] + lst[j]
-        ret += max(0, bisect.bisect_right(lst, lst[i] + lst[j] + 1) - bisect.bisect_right(lst, lst[j] + 1))
+        idx = bisect.bisect_left(lst, n)
+        ret += max(0, idx - j - 1)
 print(ret)
Buggy program (verdict: Wrong Answer):
N=int(input())
ans=ju=0
for i in range(0,999,111):
  if(i>N):
    print(i)
    break
  elif(i==N):
    print(i)
    break
    
  

Failing test case input:
985

Expected output:
999


Actual output:

Fixed program (verdict: Accepted):
N=int(input())
ans=ju=0
for i in range(0,1000,111):
  if(i>N):
    print(i)
    break
  elif(i==N):
    print(i)
    break
    
  

Diff:
 N=int(input())
 ans=ju=0
-for i in range(0,999,111):
+for i in range(0,1000,111):
   if(i>N):
     print(i)
     break
   elif(i==N):
     print(i)
     break
Buggy program (verdict: Wrong Answer):
K,N=map(int,input().split())
Alist=list(map(int,input().split()))
kyori=[]
ans=0
for i in range(N-1):
    kyori.append(Alist[i+1]-Alist[i])
kyori.append(K-Alist[N-1])
kyori.remove(max(kyori))
for i in range(len(kyori)):
    ans+=kyori[i]
print(ans)

Failing test case input:
1 3
-1 5 17

Expected output:
-11


Actual output:
-10


Fixed program (verdict: Accepted):
K,N=map(int,input().split())
Alist=list(map(int,input().split()))
kyori=[]
ans=0
for i in range(N-1):
    kyori.append(Alist[i+1]-Alist[i])
kyori.append(K-Alist[N-1]+Alist[0])
kyori.remove(max(kyori))
for i in range(len(kyori)):
    ans+=kyori[i]
print(ans)

Diff:
 K,N=map(int,input().split())
 Alist=list(map(int,input().split()))
 kyori=[]
 ans=0
 for i in range(N-1):
     kyori.append(Alist[i+1]-Alist[i])
-kyori.append(K-Alist[N-1])
+kyori.append(K-Alist[N-1]+Alist[0])
 kyori.remove(max(kyori))
 for i in range(len(kyori)):
     ans+=kyori[i]
 print(ans)
Buggy program (verdict: Wrong Answer):
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        break


Failing test case input:
1803846

Expected output:
-1


Actual output:

Fixed program (verdict: Accepted):
k = int(input())
n = 0
for i in range(1, k+1):
    n = (n * 10 + 7) % k
    if n == 0:
        print(i)
        exit()
print('-1')

Diff:
 k = int(input())
 n = 0
 for i in range(1, k+1):
     n = (n * 10 + 7) % k
     if n == 0:
         print(i)
-        break
-
+        exit()
+print('-1')
Buggy program (verdict: Wrong Answer):
N, M = map(int, input().split())
sc = [list(map(int, input().split())) for i in range(M)]

sc = sorted(sc, key= lambda x: x[0])
ans = [0] * N

check = [-1] * N
for i in sc:
    if N == 3 and i[0] == 1 and i[1] == 0:
        print(-1)
        exit()
    if N == 2 and i[0] == 1 and i[1] == 0:
        print(-1)
        exit()

    if check[i[0]-1] == -1:
        check[i[0]-1] = i[1]
    elif check[i[0]-1] != i[1]:
        print(-1)
        exit()


for i in sc:
    ans[i[0] - 1] = i[1]
for i in ans:
    print(i, end="")

Failing test case input:
3 1
2 1
1 3

Expected output:
110


Actual output:
010

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

sc = sorted(sc, key= lambda x: x[0])
ans = [0] * N

check = [-1] * N
for i in sc:
    if N == 3 and i[0] == 1 and i[1] == 0:
        print(-1)
        exit()
    if N == 2 and i[0] == 1 and i[1] == 0:
        print(-1)
        exit()
    if check[i[0]-1] == -1:
        check[i[0]-1] = i[1]
    elif check[i[0]-1] != i[1]:
        print(-1)
        exit()


for i in sc:
    ans[i[0] - 1] = i[1]

if len(ans) == 3 and ans[0] == 0:
    ans[0] = 1
if len(ans) == 2 and ans[0] == 0:
    ans[0] = 1
for i in ans:
    print(i, end="")

Diff:
 N, M = map(int, input().split())
 sc = [list(map(int, input().split())) for i in range(M)]
 
 sc = sorted(sc, key= lambda x: x[0])
 ans = [0] * N
 
 check = [-1] * N
 for i in sc:
     if N == 3 and i[0] == 1 and i[1] == 0:
         print(-1)
         exit()
     if N == 2 and i[0] == 1 and i[1] == 0:
         print(-1)
         exit()
-
     if check[i[0]-1] == -1:
         check[i[0]-1] = i[1]
     elif check[i[0]-1] != i[1]:
         print(-1)
         exit()
 
 
 for i in sc:
     ans[i[0] - 1] = i[1]
+
+if len(ans) == 3 and ans[0] == 0:
+    ans[0] = 1
+if len(ans) == 2 and ans[0] == 0:
+    ans[0] = 1
 for i in ans:
     print(i, end="")
Buggy program (verdict: Wrong Answer):
N = int(input())
input_list = [int(i) for i in input().split()]

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

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

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

Failing test case input:
6
0 3 3 7 1 24

Expected output:
10


Actual output:
12


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

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

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

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

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

Failing test case input:
1110001

Expected output:
328561110001


Actual output:
328560000000


Fixed program (verdict: Accepted):
i = int(input())
fizz=[]
for x in range(1, i+1):
  if x % 3 ==0 and x%5==0:
    continue
  elif x % 3==0:
    continue
  elif x%5==0:
    continue 
  else:
    fizz.append(x)
print(sum(fizz))

Diff:
 i = int(input())
 fizz=[]
-for x in range(i):
+for x in range(1, i+1):
   if x % 3 ==0 and x%5==0:
     continue
   elif x % 3==0:
     continue
   elif x%5==0:
     continue 
   else:
     fizz.append(x)
 print(sum(fizz))
Buggy program (verdict: Wrong Answer):
a=sorted([int(i) for i in input().split()],reverse=True)
print(",".join(map(str,a)))

Failing test case input:
3 6 9 7 5

Expected output:
9 7 6 5 3

Actual output:
9,7,6,5,3


Fixed program (verdict: Accepted):
a=sorted([int(i) for i in input().split()],reverse=True)
print(" ".join(map(str,a)))

Diff:
 a=sorted([int(i) for i in input().split()],reverse=True)
-print(",".join(map(str,a)))
+print(" ".join(map(str,a)))