ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
a,b =(int(i) for i in input().split())
if a==b:
  print(a*a)
elif a>b:
  print(2*a-1)
else:
  print(b*2-1)



Failing test case input:
-7 -7

Expected output:
-14


Actual output:
49


Fixed program (verdict: Accepted):
a,b =(int(i) for i in input().split())
if a==b:
  print(a*2)
elif a>b:
  print(2*a-1)
else:
  print(b*2-1)



Diff:
 a,b =(int(i) for i in input().split())
 if a==b:
-  print(a*a)
+  print(a*2)
 elif a>b:
   print(2*a-1)
 else:
   print(b*2-1)
Buggy program (verdict: Wrong Answer):
N, M = map(int,input().split())
AC_Set = set()
WA_Count = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        break
    else:
        if result == "AC":
            AC_Set.add(num)
        else:
            WA_Count += 1

print("{} {}".format(len(AC_Set),WA_Count))

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_Set = set()
WA_Dict = {}
WA_SUM = 0
for i in range(M):
    num,result = list(input().split())
    if num in AC_Set:
        continue
    else:
        if result == "AC":
            AC_Set.add(num)
            WA_SUM += WA_Dict.get(num,0)
        else:
            WA_Dict[num] = WA_Dict.get(num,0) + 1

print("{} {}".format(len(AC_Set),WA_SUM))


Diff:
 N, M = map(int,input().split())
 AC_Set = set()
-WA_Count = 0
+WA_Dict = {}
+WA_SUM = 0
 for i in range(M):
     num,result = list(input().split())
     if num in AC_Set:
-        break
+        continue
     else:
         if result == "AC":
             AC_Set.add(num)
+            WA_SUM += WA_Dict.get(num,0)
         else:
-            WA_Count += 1
+            WA_Dict[num] = WA_Dict.get(num,0) + 1
+
+print("{} {}".format(len(AC_Set),WA_SUM))
 
-print("{} {}".format(len(AC_Set),WA_Count))
Buggy program (verdict: Wrong Answer):

N, M, X, Y = map(int, input().split())

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.sort()
y.sort()

def is_war(x, y, N, M):
    if x[N-1] > y[0]:
        return False
    elif x[N-1] >= Y:
        return False
    elif y[0] <= X:
        return False
    else:
        return True

if is_war(x, y, N, M):
    print("No War")
else:
    print("War")

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

Expected output:
War


Actual output:
No War


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

x = list(map(int, input().split()))
y = list(map(int, input().split()))

x.sort()
y.sort()

def is_war(x, y, N, M):
    if x[N-1] >= y[0]:
        return False
    elif x[N-1] >= Y:
        return False
    elif y[0] <= X:
        return False
    else:
        return True

if is_war(x, y, N, M):
    print("No War")
else:
    print("War")

Diff:
-
 N, M, X, Y = map(int, input().split())
 
 x = list(map(int, input().split()))
 y = list(map(int, input().split()))
 
 x.sort()
 y.sort()
 
 def is_war(x, y, N, M):
-    if x[N-1] > y[0]:
+    if x[N-1] >= y[0]:
         return False
     elif x[N-1] >= Y:
         return False
     elif y[0] <= X:
         return False
     else:
         return True
 
 if is_war(x, y, N, M):
     print("No War")
 else:
     print("War")
Buggy program (verdict: Wrong Answer):
n,k = map(int, input().split())
l = list(map(int, input().split()))
l1 = sorted(l, reverse= False)
sum = sum(l1[0:3])
print(sum)

Failing test case input:
1 4
158 000 4 -1 126

Expected output:
129


Actual output:
3


Fixed program (verdict: Accepted):
n,k = map(int, input().split())
l = list(map(int, input().split()))
l1 = sorted(l, reverse= False)
sum = sum(l1[0:k])
print(sum)

Diff:
 n,k = map(int, input().split())
 l = list(map(int, input().split()))
 l1 = sorted(l, reverse= False)
-sum = sum(l1[0:3])
+sum = sum(l1[0:k])
 print(sum)
Buggy program (verdict: Wrong Answer):
import sys

while 1:
  str = sys.stdin.readline().strip()
  if str=="0 0":
    break

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

Expected output:
1 3
0 1


Actual output:

Fixed program (verdict: Accepted):
import sys

while 1:
  str = sys.stdin.readline().strip()
  if str=="0 0":
    break
  print(" ".join(sorted(str.split(" "), key=int)))

Diff:
 import sys
 
 while 1:
   str = sys.stdin.readline().strip()
   if str=="0 0":
     break
+  print(" ".join(sorted(str.split(" "), key=int)))
Buggy program (verdict: Wrong Answer):
N = int(input())
S = [''] * N
for i in range(N):
  S[i] = input()
cnt = 0
for a in range(N):
  for i in range(1 - a, N - a):
    _i = i % N
    for j in range(_i):
      if S[_i][j] != S[j][_i]:
        break
    else:
      continue
    break
  else:
    cnt += N
print(cnt)

Failing test case input:
2
cb
ab

Expected output:
0


Actual output:
2


Fixed program (verdict: Accepted):
N = int(input())
S = [''] * N
for i in range(N):
  S[i] = input()
cnt = 0
for a in range(N):
  for i in range(N):
    _i = (i - a) % N
    for j in range(i):
      if S[_i][j] != S[(j - a) % N][i]:
        break
    else:
      continue
    break
  else:
    cnt += N
print(cnt)

Diff:
 N = int(input())
 S = [''] * N
 for i in range(N):
   S[i] = input()
 cnt = 0
 for a in range(N):
-  for i in range(1 - a, N - a):
-    _i = i % N
-    for j in range(_i):
-      if S[_i][j] != S[j][_i]:
+  for i in range(N):
+    _i = (i - a) % N
+    for j in range(i):
+      if S[_i][j] != S[(j - a) % N][i]:
         break
     else:
       continue
     break
   else:
     cnt += N
 print(cnt)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

avg = sum(A) 
ans = 0
for i, a in enumerate(A):
    ans += (a - avg) ** 2

print(ans)


Failing test case input:
3
1 -1 48

Expected output:
1538


Actual output:
4610


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

avg = round(sum(A) / N)
ans = 0
for i, a in enumerate(A):
    ans += (a - avg) ** 2

print(ans)


Diff:
 N = int(input())
 A = list(map(int, input().split()))
 
-avg = sum(A) 
+avg = round(sum(A) / N)
 ans = 0
 for i, a in enumerate(A):
     ans += (a - avg) ** 2
 
 print(ans)
Buggy program (verdict: Wrong Answer):
S = str(input())
count = 0
for i in range(0,len(S)) :
  if list(S)[i] != list(reversed(S))[i] :
    count+=1
print(count / 2)

Failing test case input:
ecbc`b`

Expected output:
3


Actual output:
3.0


Fixed program (verdict: Accepted):
S = str(input())
count = 0
for i in range(0,len(S)) :
  if list(S)[i] != list(reversed(S))[i] :
    count+=1
print(int(count / 2))

Diff:
 S = str(input())
 count = 0
 for i in range(0,len(S)) :
   if list(S)[i] != list(reversed(S))[i] :
     count+=1
-print(count / 2)
+print(int(count / 2))
Buggy program (verdict: Wrong Answer):

import sys
s = sys.stdin.readline().rstrip()
n = len(s)
L = [0 for _ in range(n+1)]

for i in range(n):
    if s[i] == '<':
        L[i+1] = L[i] +1



for i in range(n-1,0,-1):
    if s[i] == '>':
        L[i] = max(L[i], L[i+1]+1)



print(sum(L))

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

Expected output:
25


Actual output:
24


Fixed program (verdict: Accepted):

import sys
s = sys.stdin.readline().rstrip()
n = len(s)
L = [0 for _ in range(n+1)]

for i in range(n):
    if s[i] == '<':
        L[i+1] = L[i] +1



for i in range(n-1,-1,-1):
    if s[i] == '>':
        L[i] = max(L[i], L[i+1]+1)



print(sum(L))

Diff:
 
 import sys
 s = sys.stdin.readline().rstrip()
 n = len(s)
 L = [0 for _ in range(n+1)]
 
 for i in range(n):
     if s[i] == '<':
         L[i+1] = L[i] +1
 
 
 
-for i in range(n-1,0,-1):
+for i in range(n-1,-1,-1):
     if s[i] == '>':
         L[i] = max(L[i], L[i+1]+1)
 
 
 
 print(sum(L))
Buggy program (verdict: Wrong Answer):
n,ans,l=int(input()),"Yes",list(map(int,input().split()))
for i in l:
  if sum(l)<i*2:ans="No"
print(ans)

Failing test case input:
4
1 1 2 0

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
n,ans,l=int(input()),"Yes",list(map(int,input().split()))
for i in l:
  if sum(l)<=i*2:ans="No"
print(ans)

Diff:
 n,ans,l=int(input()),"Yes",list(map(int,input().split()))
 for i in l:
-  if sum(l)<i*2:ans="No"
+  if sum(l)<=i*2:ans="No"
 print(ans)
Buggy program (verdict: Wrong Answer):
a = str(input())
b =sorted(list(set(a)))
c = 0
for i in b:
  if b.count(i)%2 == 0:
    c += 0
  else:
    c += 1

if c == 0:
  print("Yes")
else:
  print("No")

Failing test case input:
ab`cc`ba

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
a = str(input())
b =sorted(list(set(a)))
c = 0
for i in b:
  if a.count(i) % 2 == 0:
    c += 0
  else:
    c += 1

if c == 0:
  print("Yes")
else:
  print("No")

Diff:
 a = str(input())
 b =sorted(list(set(a)))
 c = 0
 for i in b:
-  if b.count(i)%2 == 0:
+  if a.count(i) % 2 == 0:
     c += 0
   else:
     c += 1
 
 if c == 0:
   print("Yes")
 else:
   print("No")
Buggy program (verdict: Wrong Answer):
x=input().split()
y=input().split()
if(x[0]!=y[0]):
    print("0")
else:
    print("1")

Failing test case input:
11 2
11 99

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
x=input().split()
y=input().split()
if(x[0]!=y[0]):
    print("1")
else:
    print("0")

Diff:
 x=input().split()
 y=input().split()
 if(x[0]!=y[0]):
-    print("0")
-else:
     print("1")
+else:
+    print("0")
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n)]

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

for j in range(n-1):
  print(b[j])
  

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

Expected output:
6
2
0
1
0
0
0
0
0
0


Actual output:
6
2
0
1
0
0
0
0
0


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

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

for j in range(n):
  print(b[j])
  

Diff:
 n = int(input())
 a = list(map(int, input().split()))
 b = [0 for i in range(n)]
 
 for i in range(n-1):
   b[a[i]-1] += 1
 
-for j in range(n-1):
+for j in range(n):
   print(b[j])
Buggy program (verdict: Wrong Answer):
N, K = map(int, input().split())
A = list(map(int, input().split()))
listsort=sorted(A, reverse=True)
print(listsort)
del listsort[0:K]
print(sum(listsort))

Failing test case input:
3 0
1100000011 1000000000 1110000000

Expected output:
3210000011


Actual output:
[1110000000, 1100000011, 1000000000]
3210000011


Fixed program (verdict: Accepted):
N, K = map(int, input().split())
A = list(map(int, input().split()))
listsort=sorted(A, reverse=True)
del listsort[0:K]
print(sum(listsort))

Diff:
 N, K = map(int, input().split())
 A = list(map(int, input().split()))
 listsort=sorted(A, reverse=True)
-print(listsort)
 del listsort[0:K]
 print(sum(listsort))
Buggy program (verdict: Wrong Answer):
N = int(input())
*H, = map(int, input().split())


count_max = 0
count_temp = 0
flg = 0

for i in range(0, len(H)-1, 1):

    if H[i] < H[i+1]:
        if count_max < count_temp:
            count_max = count_temp
        count_temp = 0
        flg = 1

    count_temp = count_temp + 1

    if H[i+1]==H[len(H)-1]:
        if count_max < count_temp:
            count_max = count_temp
        flg = 1

if flg == 1:
    print(count_max-1)
else:
    print(0)

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

Expected output:
3


Actual output:
2


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


count_max = 0
count_temp = 0
flg = 0

for i in range(0, len(H)-1, 1):

    if H[i] < H[i+1]:
        if count_max < count_temp:
            count_max = count_temp
        count_temp = 0
        flg = 1
        continue

    count_temp = count_temp + 1

    if H[i+1]==H[len(H)-1]:
        if count_max < count_temp:
            count_max = count_temp
        flg = 1

if flg == 1:
    print(count_max)
else:
    print(0)

Diff:
 N = int(input())
 *H, = map(int, input().split())
 
 
 count_max = 0
 count_temp = 0
 flg = 0
 
 for i in range(0, len(H)-1, 1):
 
     if H[i] < H[i+1]:
         if count_max < count_temp:
             count_max = count_temp
         count_temp = 0
         flg = 1
+        continue
 
     count_temp = count_temp + 1
 
     if H[i+1]==H[len(H)-1]:
         if count_max < count_temp:
             count_max = count_temp
         flg = 1
 
 if flg == 1:
-    print(count_max-1)
+    print(count_max)
 else:
     print(0)
Buggy program (verdict: Wrong Answer):
s=input()
if s[1]==s[2]:
  if s[0]==s[1]:
    print('Yes')
  elif s[2]==s[3]:
    print('Yes')
else:
  print('No')

Failing test case input:
3550

Expected output:
No


Actual output:

Fixed program (verdict: Accepted):
s=input()
if s[1]==s[2]:
  if s[0]==s[1]:
    print('Yes')
  elif s[2]==s[3]:
    print('Yes')
  else:
    print('No')
else:
  print('No')

Diff:
 s=input()
 if s[1]==s[2]:
   if s[0]==s[1]:
     print('Yes')
   elif s[2]==s[3]:
     print('Yes')
+  else:
+    print('No')
 else:
   print('No')
Buggy program (verdict: Wrong Answer):
N=input()
A=list(map(int,input().split()))
count = 0
while sum(A)%2==0:
  A=[i/2 for i in A]
  count+=1
print(count)

Failing test case input:
3
4 11 31

Expected output:
0


Actual output:
1


Fixed program (verdict: Accepted):
N=input()
A=list(map(int,input().split()))
count = 0
while all([False if i%2!=0 else True for i in A ]):
  A=[i/2 for i in A]
  count+=1
print(count)

Diff:
 N=input()
 A=list(map(int,input().split()))
 count = 0
-while sum(A)%2==0:
+while all([False if i%2!=0 else True for i in A ]):
   A=[i/2 for i in A]
   count+=1
 print(count)
Buggy program (verdict: Wrong Answer):
import math
import sys 

n = int(input())

n = math.ceil(math.sqrt(n))

ans = 100000000000000000000000000000000000000000000000000

for a in range(1,n):
    amari = n%a
    if amari == 0:
        b = n / a
        f = max(len(str(a)),len(str(b)))
        ans = min(f,ans)

print(ans)

    
    

    


Failing test case input:
2771679283

Expected output:
9


Actual output:
4


Fixed program (verdict: Accepted):
import math

n = int(input())

N = math.ceil(math.sqrt(n))

ans = 10**10

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

for a in range(1,N+1):
    amari = n%a
    if amari == 0:
        b = int(n / a)
        f = max(len(str(a)),len(str(b)))
        ans = min(f,ans)

print(ans)

Diff:
 import math
-import sys 
 
 n = int(input())
 
-n = math.ceil(math.sqrt(n))
+N = math.ceil(math.sqrt(n))
 
-ans = 100000000000000000000000000000000000000000000000000
+ans = 10**10
 
-for a in range(1,n):
+if n == 1:
+    print(1)
+    exit()
+
+for a in range(1,N+1):
     amari = n%a
     if amari == 0:
-        b = n / a
+        b = int(n / a)
         f = max(len(str(a)),len(str(b)))
         ans = min(f,ans)
 
 print(ans)
-
-    
-    
-
-    
-
Buggy program (verdict: Wrong Answer):
n = int(input())
abcs = [None for _ in range(n)]

dp = [[0, 0, 0] for ___ in range(n)]

for i in range(n):
    abcs[i] = list(map(int, input().split()))
for i in range(n):
    for k in range(3):  
        for j in range(3):  
            if k != j:
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + abcs[i][k])
print(max(dp[i]))













Failing test case input:
1
001 6 0

Expected output:
6


Actual output:
7


Fixed program (verdict: Accepted):
n = int(input())
abcs = [None for _ in range(n)]


for i in range(n):
    abcs[i] = list(map(int, input().split()))

dp = [abcs[0]] + [[0, 0, 0] for _ in range(n - 1)]
for i in range(1, n):
    for k in range(3):  
        for j in range(3):  
            if k != j:
                dp[i][k] = max(dp[i][k], dp[i - 1][j] + abcs[i][k])
print(max(dp[i]))













Diff:
 n = int(input())
 abcs = [None for _ in range(n)]
 
-dp = [[0, 0, 0] for ___ in range(n)]
 
 for i in range(n):
     abcs[i] = list(map(int, input().split()))
-for i in range(n):
+
+dp = [abcs[0]] + [[0, 0, 0] for _ in range(n - 1)]
+for i in range(1, n):
     for k in range(3):  
         for j in range(3):  
             if k != j:
                 dp[i][k] = max(dp[i][k], dp[i - 1][j] + abcs[i][k])
 print(max(dp[i]))
Buggy program (verdict: Wrong Answer):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    q, mod = divmod(N, C)
    result = q * A + mod
else:
    result = N

print(result)

Failing test case input:
2 1 9

Expected output:
1


Actual output:
2


Fixed program (verdict: Accepted):
N, A, B = list(map(int, input().split()))
C = A + B
result = 0
if A < N:
    q, mod = divmod(N, C)
    result = q * A + min(mod, A)
else:
    result = N

print(result)

Diff:
 N, A, B = list(map(int, input().split()))
 C = A + B
 result = 0
 if A < N:
     q, mod = divmod(N, C)
-    result = q * A + mod
+    result = q * A + min(mod, A)
 else:
     result = N
 
 print(result)
Buggy program (verdict: Wrong Answer):
import collections
n = int(input())
s = [list(input()) for i in range(n)]
l = [''.join(sorted(i)) for i in s]
c = list(collections.Counter(l).values())
x = sum([i for i in c if i != 1])
print(x - 1) if 0 < x else print(x)


Failing test case input:
5
abaaaaaaaa
oweplustmo
aaaaaaaaba
unoselpowt
aaaaaaaaba

Expected output:
3


Actual output:
2


Fixed program (verdict: Accepted):
import collections
n = int(input())
s = [list(input()) for i in range(n)]
l = [''.join(sorted(i)) for i in s]
c = list(collections.Counter(l).values())
x = sum([sum([i for i in range(i)]) for i in c if i != 1])
print(x) if 0 < x else print(x)

Diff:
 import collections
 n = int(input())
 s = [list(input()) for i in range(n)]
 l = [''.join(sorted(i)) for i in s]
 c = list(collections.Counter(l).values())
-x = sum([i for i in c if i != 1])
-print(x - 1) if 0 < x else print(x)
-
+x = sum([sum([i for i in range(i)]) for i in c if i != 1])
+print(x) if 0 < x else print(x)
Buggy program (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
j=0
c=0
import sys

for i in range(1,n+1):
    while 1:
        if j==n-1:
            
            break
        if i!=a[j]:
            break
        else:
            c+=1
            j+=1
    print(c)
    c=0
    




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

Expected output:
1
2
1
1
0
1
0


Actual output:
1
0
1
0
0
0
0


Fixed program (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
j=0
c=0
import sys
a.sort()

for i in range(1,n+1):
    while 1:
        if j==n-1:
            
            break
        if i!=a[j]:
            break
        else:
            c+=1
            j+=1
    print(c)
    c=0
    




Diff:
 n=int(input())
 a=list(map(int,input().split()))
 j=0
 c=0
 import sys
+a.sort()
 
 for i in range(1,n+1):
     while 1:
         if j==n-1:
             
             break
         if i!=a[j]:
             break
         else:
             c+=1
             j+=1
     print(c)
     c=0
Buggy program (verdict: Wrong Answer):
import sys
input = sys.stdin.readline


def main():
    X, Y = list(map(int, input().split()))
    
    ans = 0

    if X == 3:
        ans += 100000
    elif X == 2:
        ans += 100000
    elif X == 1:
        ans += 300000

    if Y == 3:
        ans += 100000
    elif Y == 2:
        ans += 100000
    elif Y == 1:
        ans += 300000

    if X == 1 and Y == 1:
        ans += 400000

    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
2 122

Expected output:
200000


Actual output:
100000


Fixed program (verdict: Accepted):
import sys
input = sys.stdin.readline


def main():
    X, Y = list(map(int, input().split()))
    
    ans = 0

    if X == 3:
        ans += 100000
    elif X == 2:
        ans += 200000
    elif X == 1:
        ans += 300000

    if Y == 3:
        ans += 100000
    elif Y == 2:
        ans += 200000
    elif Y == 1:
        ans += 300000

    if X == 1 and Y == 1:
        ans += 400000

    print(ans)


if __name__ == '__main__':
    main()


Diff:
 import sys
 input = sys.stdin.readline
 
 
 def main():
     X, Y = list(map(int, input().split()))
     
     ans = 0
 
     if X == 3:
         ans += 100000
     elif X == 2:
-        ans += 100000
+        ans += 200000
     elif X == 1:
         ans += 300000
 
     if Y == 3:
         ans += 100000
     elif Y == 2:
-        ans += 100000
+        ans += 200000
     elif Y == 1:
         ans += 300000
 
     if X == 1 and Y == 1:
         ans += 400000
 
     print(ans)
 
 
 if __name__ == '__main__':
     main()
Buggy program (verdict: Wrong Answer):
import sys
import math
n, m = (int(i) for i in input().split())
l=abs(n-m)
div=int(10e9+7)

if l>1:
    print(0)
    sys.exit()

if l==1:
    ans=(math.factorial(n)*math.factorial(m))%div
    print(ans)
else:
    ans=(math.factorial(n)*math.factorial(m)*2)%div
    print(ans)


Failing test case input:
001111 001110

Expected output:
292820538


Actual output:
4794866281


Fixed program (verdict: Accepted):
import sys
import math
n, m = (int(i) for i in input().split())
l=abs(n-m)
div=int(10**9+7)

if l>1:
    print(0)
    sys.exit()

if l==1:
    ans=(math.factorial(n)*math.factorial(m))%div
    print(ans)
else:
    ans=(math.factorial(n)*math.factorial(m)*2)%div
    print(ans)


Diff:
 import sys
 import math
 n, m = (int(i) for i in input().split())
 l=abs(n-m)
-div=int(10e9+7)
+div=int(10**9+7)
 
 if l>1:
     print(0)
     sys.exit()
 
 if l==1:
     ans=(math.factorial(n)*math.factorial(m))%div
     print(ans)
 else:
     ans=(math.factorial(n)*math.factorial(m)*2)%div
     print(ans)
Buggy program (verdict: Wrong Answer):
gross = int(input())
numbers = input().split()
numbers = sorted(numbers)
count = 0

for n in range(gross-2):
    for m in range(gross-1):
        for l in range(gross):
            if (n < m) and (m < l):
                if (int(numbers[n]) != (int(numbers[m]))) and (int(numbers[n]) != (int(numbers[l]))) and (int(numbers[m]) != (int(numbers[l]))):
                    if (int(numbers[n]) + int(numbers[m])) > int(numbers[l]):
                        count += 1
print(count)

Failing test case input:
10
16 4 3 1 2 6 7 7 7 8

Expected output:
25


Actual output:
58


Fixed program (verdict: Accepted):
gross = int(input())
numbers = input().split()
numbers = list(map(int,numbers))
numbers = sorted(numbers)
count = 0

for n in range(gross-2):
    for m in range(gross-1):
        for l in range(gross):
            if (n < m) and (m < l):
                if (int(numbers[n]) != (int(numbers[m]))) and (int(numbers[n]) != (int(numbers[l]))) and (int(numbers[m]) != (int(numbers[l]))):
                    if (int(numbers[n]) + int(numbers[m])) > int(numbers[l]):
                        count += 1
print(count)

Diff:
 gross = int(input())
 numbers = input().split()
+numbers = list(map(int,numbers))
 numbers = sorted(numbers)
 count = 0
 
 for n in range(gross-2):
     for m in range(gross-1):
         for l in range(gross):
             if (n < m) and (m < l):
                 if (int(numbers[n]) != (int(numbers[m]))) and (int(numbers[n]) != (int(numbers[l]))) and (int(numbers[m]) != (int(numbers[l]))):
                     if (int(numbers[n]) + int(numbers[m])) > int(numbers[l]):
                         count += 1
 print(count)
Buggy program (verdict: Wrong Answer):
S=input()
T=input()

max_ans=0
for i in range(len(S)):
  max_n = 0
  for j in range(len(T)):
    if len(S) > i + j:
      if S[i+j]==T[j]:
      	max_n=max_n+1
      else:
        if max_ans <= max_n:
          max_ans=max_n
        
print(len(T)-max_ans)

Failing test case input:
cabaac
bba

Expected output:
1


Actual output:
2


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

max_ans=0
for i in range(len(S)):
  max_n = 0
  for j in range(len(T)):
    if len(S) >= i + len(T):
      if S[i+j]==T[j]:
      	max_n=max_n+1
  
  if max_ans <= max_n:
    max_ans=max_n

print(len(T)-max_ans)

Diff:
 S=input()
 T=input()
 
 max_ans=0
 for i in range(len(S)):
   max_n = 0
   for j in range(len(T)):
-    if len(S) > i + j:
+    if len(S) >= i + len(T):
       if S[i+j]==T[j]:
       	max_n=max_n+1
-      else:
-        if max_ans <= max_n:
-          max_ans=max_n
-        
+  
+  if max_ans <= max_n:
+    max_ans=max_n
+
 print(len(T)-max_ans)
Buggy program (verdict: Wrong Answer):
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans = 0
for i in range(n):
    ans += a_li[3*n-1-n-i]
print(ans)

Failing test case input:
10
1100000000 0000100100 1100100011 0100001000 1000101001 1000001000 1010100000 1010001100 1000100000 1010100000 1000100110 1010000000 1000110000 1000011000 1011000000 1101100010 0100110000 0001100101 1000000000 1001000111 1000000011 1000110001 0010000110 1100000001 1001010100 1000011000 1100001001 1000001000 1000000000 1110000100

Expected output:
10322534213


Actual output:
10012553323


Fixed program (verdict: Accepted):
n = int(input())
a_li = list(map(int,input().split()))
a_li.sort()
ans = 0
for i in range(1,n+1):
    ans += a_li[3*n-1-(i*2-1)]
print(ans)

Diff:
 n = int(input())
 a_li = list(map(int,input().split()))
 a_li.sort()
 ans = 0
-for i in range(n):
-    ans += a_li[3*n-1-n-i]
+for i in range(1,n+1):
+    ans += a_li[3*n-1-(i*2-1)]
 print(ans)
Buggy program (verdict: Wrong Answer):
n = int(input())
l = []
for i in range(n):
    w = input()
    l.append(w)
for k in range(n):
    if  l[k-1][-1] != l[k][0]:
        flag =1
        break
    for j in range(i):
        if l[k] == l[j]:
            flag = 1
            break
        
if(flag == 1):
    print('No')
else:
    print('Yes')

Failing test case input:
3
aac
cra
agc

Expected output:
Yes


Actual output:
No


Fixed program (verdict: Accepted):
n = int(input())
l = []
flag = 0
for i in range(n):
    w = input()
    l.append(w)
for k in range(1,n):
    if  l[k-1][-1] != l[k][0]:
        flag =1
        break

    for j in range(k):
        if l[k] == l[j]:
            flag = 1
            break
        
if(flag == 1):
    print('No')
else:
    print('Yes')

Diff:
 n = int(input())
 l = []
+flag = 0
 for i in range(n):
     w = input()
     l.append(w)
-for k in range(n):
+for k in range(1,n):
     if  l[k-1][-1] != l[k][0]:
         flag =1
         break
-    for j in range(i):
+
+    for j in range(k):
         if l[k] == l[j]:
             flag = 1
             break
         
 if(flag == 1):
     print('No')
 else:
     print('Yes')
Buggy program (verdict: Wrong Answer):
n = int(input())
a = input().split()

a = list(map(int, a))

alice_n = a[::2]
bob_n = a[1::2]

print(sum(alice_n) - sum(bob_n))

Failing test case input:
2
-2 38

Expected output:
40


Actual output:
-40


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

a = list(map(int, a))
a.sort(reverse=True)
alice_n = a[::2]
bob_n = a[1::2]

print(sum(alice_n) - sum(bob_n))

Diff:
 n = int(input())
 a = input().split()
 
 a = list(map(int, a))
-
+a.sort(reverse=True)
 alice_n = a[::2]
 bob_n = a[1::2]
 
 print(sum(alice_n) - sum(bob_n))
Buggy program (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in range(1,n+1):
  dp[i]=a.count(i)

for j in range(q):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)

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

Expected output:
6
6
11


Actual output:
6
6
6


Fixed program (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=sum(a)
q=int(input())
dp=[0]*(10**5+1)
for i in a:
  dp[i]+=1

for j in range(q):
  b,c=map(int,input().split())
  ans+=(c-b)*dp[b]
  dp[c]+=dp[b]
  dp[b]=0
  print(ans)

Diff:
 n=int(input())
 a=list(map(int,input().split()))
 ans=sum(a)
 q=int(input())
 dp=[0]*(10**5+1)
-for i in range(1,n+1):
-  dp[i]=a.count(i)
+for i in a:
+  dp[i]+=1
 
 for j in range(q):
   b,c=map(int,input().split())
   ans+=(c-b)*dp[b]
   dp[c]+=dp[b]
   dp[b]=0
   print(ans)
Buggy program (verdict: Wrong Answer):
n,m,x=map(int,input().split())
*a,=map(int,input().split())
cst_0=0
cst_n=0
for i in range(1,x):
	if (x-i) in a:
		cst_0 += 1
for i in range(x+1,n):
	if i in a:
		cst_n += 1
ans=min(cst_0,cst_n)

	

Failing test case input:
5 3 3
1 2 4

Expected output:
1

Actual output:

Fixed program (verdict: Accepted):
n,m,x=map(int,input().split())
*a,=map(int,input().split())
cst_0=0
cst_n=0
for i in range(1,x):
	if (x-i) in a:
		cst_0 += 1
for i in range(x+1,n):
	if i in a:
		cst_n += 1
ans=min(cst_0,cst_n)
print(ans)
	

Diff:
 n,m,x=map(int,input().split())
 *a,=map(int,input().split())
 cst_0=0
 cst_n=0
 for i in range(1,x):
 	if (x-i) in a:
 		cst_0 += 1
 for i in range(x+1,n):
 	if i in a:
 		cst_n += 1
 ans=min(cst_0,cst_n)
-
+print(ans)
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for i in range(len(A)):
    flag = 1
    if A[i]%2 == 0:
        if A[i]%3 != 0:
            flag = flag - 1
        if A[i]%5 != 0:
            flag = flag - 1  
        if flag < 0: 
            ans = "DENIED"
        print(flag)
print(ans)

Failing test case input:
3
1 0 110

Expected output:
APPROVED


Actual output:
1
0
APPROVED


Fixed program (verdict: Accepted):
N = int(input())
A = list(map(int,input().split()))
ans = "APPROVED"
for i in range(len(A)):
    flag = 1
    if A[i]%2 == 0:
        if A[i]%3 != 0:
            flag = flag - 1
        if A[i]%5 != 0:
            flag = flag - 1  
        if flag < 0: 
            ans = "DENIED"
print(ans)

Diff:
 N = int(input())
 A = list(map(int,input().split()))
 ans = "APPROVED"
 for i in range(len(A)):
     flag = 1
     if A[i]%2 == 0:
         if A[i]%3 != 0:
             flag = flag - 1
         if A[i]%5 != 0:
             flag = flag - 1  
         if flag < 0: 
             ans = "DENIED"
-        print(flag)
 print(ans)
Buggy program (verdict: Wrong Answer):
N,A,B=map(int,input().split())
if A>=int(B/N):
  print(B)
else:
  print(A*N)

Failing test case input:
-96 2 -1

Expected output:
-192


Actual output:
-1


Fixed program (verdict: Accepted):
N,A,B=map(int,input().split())
if (A*N)>=B:
  print(B)
else:
  print(A*N)


Diff:
 N,A,B=map(int,input().split())
-if A>=int(B/N):
+if (A*N)>=B:
   print(B)
 else:
   print(A*N)
+
Buggy program (verdict: Wrong Answer):
s = int(input())
array = [s]
 
m = 2
while m < 100000:
  if (s % 2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in array:
    print(m)
    break
  else:
    array.append(m)
    m += 1

Failing test case input:
143

Expected output:
105


Actual output:
85


Fixed program (verdict: Accepted):
s = int(input())
array = [s]
 
m = 2
while m < 100000:
  if (s % 2 == 0):
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in array:
    print(m)
    break
  else:
    array.append(s)
    m += 1

Diff:
 s = int(input())
 array = [s]
  
 m = 2
 while m < 100000:
   if (s % 2 == 0):
     s = s / 2
   else:
     s = 3 * s + 1
   
   if s in array:
     print(m)
     break
   else:
-    array.append(m)
+    array.append(s)
     m += 1
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
if a<b:
  a,b=b,a
ans=a
a-=1
if a<b:
  a,b=b,a
ans+=a

Failing test case input:
-6 69

Expected output:
137


Actual output:

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

Diff:
 a,b=map(int,input().split())
 if a<b:
   a,b=b,a
 ans=a
 a-=1
 if a<b:
   a,b=b,a
 ans+=a
+print(ans)
Buggy program (verdict: Wrong Answer):
X = int(input())

if '3' or '5' or '7' in X:
  print('YES')
else:
  print('NO')

Failing test case input:
469

Expected output:
NO


Actual output:
YES


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

if X == 3 or X == 5 or X == 7:
  print('YES')
else:
  print('NO')

Diff:
 X = int(input())
 
-if '3' or '5' or '7' in X:
+if X == 3 or X == 5 or X == 7:
   print('YES')
 else:
   print('NO')
Buggy program (verdict: Wrong Answer):


colors = input().split()

bef = 0
count = 0
colors.sort()

for c in colors:
    print(c)
    if bef == 0:
        count += 1
        bef = c
    else:
        if c > bef:
            count += 1
            bef = c

print(count)


Failing test case input:
2 16 5

Expected output:
3


Actual output:
16
2
5
3


Fixed program (verdict: Accepted):


colors = input().split()

bef = 0
count = 0
colors.sort()

for c in colors:
    if bef == 0:
        count += 1
        bef = c
    else:
        if c > bef:
            count += 1
            bef = c

print(count)


Diff:
 
 
 colors = input().split()
 
 bef = 0
 count = 0
 colors.sort()
 
 for c in colors:
-    print(c)
     if bef == 0:
         count += 1
         bef = c
     else:
         if c > bef:
             count += 1
             bef = c
 
 print(count)
Buggy program (verdict: Wrong Answer):
N = int(input('')) 

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

A.insert(0,0)

A.insert(0,0)

subordinate = [0] * (N+1)





for index in range(N, 1, -1):
    subordinate[A[index]] = subordinate[A[index]] + 1


for index in range(1, N, 1):
    print(subordinate[index])



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

Expected output:
1
2
0
1
2
0
0


Actual output:
1
2
0
1
2
0


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

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

A.insert(0,0)

A.insert(0,0)

subordinate = [0] * (N+1)





for index in range(N, 1, -1):
    subordinate[A[index]] = subordinate[A[index]] + 1


for index in range(1, N+1, 1):
    print(subordinate[index])



Diff:
 N = int(input('')) 
 
 A = list(map(int,input().split()))
 
 A.insert(0,0)
 
 A.insert(0,0)
 
 subordinate = [0] * (N+1)
 
 
 
 
 
 for index in range(N, 1, -1):
     subordinate[A[index]] = subordinate[A[index]] + 1
 
 
-for index in range(1, N, 1):
+for index in range(1, N+1, 1):
     print(subordinate[index])
Buggy program (verdict: Wrong Answer):
k= int(input())

x,y = map(int,input().split())
if 1<=x<=y<=1000 and 1<=k<=1000:
    pass



    if x%k>>0 :
        if x<= (x/k+1)*k <=y :
            print('OK')
        else:
            print('NG')
    else:
        print('OK')

else:
    print('NG')

Failing test case input:
4
-4 7

Expected output:
OK


Actual output:
NG


Fixed program (verdict: Accepted):
k= int(input())
x,y = map(int,input().split())
if 1<=x<=y<=1000 and 1<=k<=1000:
    pass



    if x%k>>0 :
        if x<= (x
            print('OK')
        else:
            print('NG')
    else:
        print('OK')

else:
    print('NG')

Diff:
 k= int(input())
-
 x,y = map(int,input().split())
 if 1<=x<=y<=1000 and 1<=k<=1000:
     pass
 
 
 
     if x%k>>0 :
-        if x<= (x/k+1)*k <=y :
+        if x<= (x
             print('OK')
         else:
             print('NG')
     else:
         print('OK')
 
 else:
     print('NG')
Buggy program (verdict: Wrong Answer):
from collections import Counter
w = input()
c = Counter(w)

s = "No"
while(True):
  for t in c.most_common():
    if (t[1]%2) == 0:
      s = "Yes"
    else:
      break
  break
print(s)

Failing test case input:
__bdc`ac

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
from collections import Counter
w = input()
c = Counter(w)

s = "Yes"
while(s == "Yes"):
  for t in c.most_common():
    if (t[1]%2) != 0:
      s = "No"
  break
print(s)

Diff:
 from collections import Counter
 w = input()
 c = Counter(w)
 
-s = "No"
-while(True):
+s = "Yes"
+while(s == "Yes"):
   for t in c.most_common():
-    if (t[1]%2) == 0:
-      s = "Yes"
-    else:
-      break
+    if (t[1]%2) != 0:
+      s = "No"
   break
 print(s)
Buggy program (verdict: Wrong Answer):
import collections
n, k = map(int, input().split())
list_a = list(map(int, input().split()))

count = collections.Counter(list_a)
sort_c = sorted(count.items(), key=lambda x:x[1])
num_kind = len(sort_c)

result = 0
for i in range(num_kind - k):
  result += sort_c[i][1]


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

Expected output:
1

Actual output:

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

count = collections.Counter(list_a)
sort_c = sorted(count.items(), key=lambda x:x[1])
num_kind = len(sort_c)

result = 0
for i in range(num_kind - k):
  result += sort_c[i][1]
print(result)


Diff:
 import collections
 n, k = map(int, input().split())
 list_a = list(map(int, input().split()))
 
 count = collections.Counter(list_a)
 sort_c = sorted(count.items(), key=lambda x:x[1])
 num_kind = len(sort_c)
 
 result = 0
 for i in range(num_kind - k):
   result += sort_c[i][1]
+print(result)
Buggy program (verdict: Wrong Answer):
n,x,t = map(int,input().split())

num = n

print(num*t)


Failing test case input:
6 5 18

Expected output:
36


Actual output:
108


Fixed program (verdict: Accepted):
import math
n,x,t = map(int,input().split())

num = math.ceil(n/x)

print(num*t)


Diff:
+import math
 n,x,t = map(int,input().split())
 
-num = n
+num = math.ceil(n/x)
 
 print(num*t)
Buggy program (verdict: Wrong Answer):
S=list(input())
flag=0
b='a'
for s in S:
    if b==s:
        flag=1
    b=s
if flag==0:
    print("Bad")
else:
    print("Good")

Failing test case input:
15164

Expected output:
Good


Actual output:
Bad


Fixed program (verdict: Accepted):
S=list(input())
flag=0
b='a'
for s in S:
    if b==s:
        flag=1
    b=s
if flag==1:
    print("Bad")
else:
    print("Good")

Diff:
 S=list(input())
 flag=0
 b='a'
 for s in S:
     if b==s:
         flag=1
     b=s
-if flag==0:
+if flag==1:
     print("Bad")
 else:
     print("Good")
Buggy program (verdict: Wrong Answer):
import math

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

if(N!=K):
    print(math.ceil(N/(K-1)))
else:
    print(1)

Failing test case input:
7 3
1 3 1 4

Expected output:
3


Actual output:
4


Fixed program (verdict: Accepted):
import math

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


print(math.ceil((N-1)/(K-1)))

Diff:
 import math
 
 N,K=list(map(int, input().split()))
 A=list(map(int, input().split()))
 
-if(N!=K):
-    print(math.ceil(N/(K-1)))
-else:
-    print(1)
+
+print(math.ceil((N-1)/(K-1)))
Buggy program (verdict: Wrong Answer):
a=[]
b=[]
m=0

for _ in [0]*int(input()):
  a += input()
for _ in [0]*int(input()):
  b += input()

for s in a:
  m = max(m, a.count(s)-b.count(s))
print(m)


Failing test case input:
1
voldemort
5
tromedlnv
vpldemort
sromedlnv
tromevdok
troledmov
volderomt
polweterm
loledvort
tdomlreov
voldemosv

Expected output:
1


Actual output:
0


Fixed program (verdict: Accepted):
a=[]
b=[]
m=0

for _ in [0]*int(input()):
  a += [input()]
for _ in [0]*int(input()):
  b += [input()]

for s in a:
  m = max(m, a.count(s)-b.count(s))
print(m)


Diff:
 a=[]
 b=[]
 m=0
 
 for _ in [0]*int(input()):
-  a += input()
+  a += [input()]
 for _ in [0]*int(input()):
-  b += input()
+  b += [input()]
 
 for s in a:
   m = max(m, a.count(s)-b.count(s))
 print(m)
Buggy program (verdict: Wrong Answer):
n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod<=a:
  print(q*a+mod)
else:
  print(q*b+mod)


Failing test case input:
48 -13 9

Expected output:
143


Actual output:
-108


Fixed program (verdict: Accepted):
n,a,b=map(int,input().split())
q,mod=divmod(n,(a+b))
if mod<=a:
  print(q*a+mod)
else:
  print(q*a+a)

Diff:
 n,a,b=map(int,input().split())
 q,mod=divmod(n,(a+b))
 if mod<=a:
   print(q*a+mod)
 else:
-  print(q*b+mod)
-
+  print(q*a+a)
Buggy program (verdict: Wrong Answer):
S=int(input())
n=1
while n>0.001:
    if int(S/1000*n)==int(S/100*n)-int(S/1000*n):
        print("Bad")
        break
    else:
        n=n/10
else:
    print("Good")

Failing test case input:
3075

Expected output:
Good


Actual output:
Bad


Fixed program (verdict: Accepted):
S=int(input())
n=1
while n>0.001:
    if S
        print("Bad")
        break
    else:
        S=S-(1000*n)*(S
        n=n/10
else:
    print("Good")

Diff:
 S=int(input())
 n=1
 while n>0.001:
-    if int(S/1000*n)==int(S/100*n)-int(S/1000*n):
+    if S
         print("Bad")
         break
     else:
+        S=S-(1000*n)*(S
         n=n/10
 else:
     print("Good")
Buggy program (verdict: Wrong Answer):
X, Y = map(int, input().split())

points = [-1, 100000, 200000, 300000, 0]
print(400000*(X==Y==1) + points[min(4, X)] + points[min(4, Y)])

Failing test case input:
3 21

Expected output:
100000


Actual output:
300000


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

points = [-1, 300000, 200000, 100000, 0]
print(400000*(X==Y==1) + points[min(4, X)] + points[min(4, Y)])

Diff:
 X, Y = map(int, input().split())
 
-points = [-1, 100000, 200000, 300000, 0]
+points = [-1, 300000, 200000, 100000, 0]
 print(400000*(X==Y==1) + points[min(4, X)] + points[min(4, Y)])
Buggy program (verdict: Wrong Answer):
n = int(input())
mod = 10**9+7
a = pow(10,n,mod)
b = pow(9,n,mod)
c = pow(9,n,mod)
d = pow(8,n,mod)
print(a-b-c+d)

Failing test case input:
6100

Expected output:
898681079


Actual output:
-101318928


Fixed program (verdict: Accepted):
n = int(input())
mod = 10**9+7
a = pow(10,n,mod)
b = pow(9,n,mod)
c = pow(9,n,mod)
d = pow(8,n,mod)
print((a-b-c+d)%mod)

Diff:
 n = int(input())
 mod = 10**9+7
 a = pow(10,n,mod)
 b = pow(9,n,mod)
 c = pow(9,n,mod)
 d = pow(8,n,mod)
-print(a-b-c+d)
+print((a-b-c+d)%mod)
Buggy program (verdict: Wrong Answer):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(x)]
cand[0]=1
for i in range(2,log_x):
    print(int(pow(x,1.0/i)))
    cand[i]=int(pow(x,1.0/i))**i
print(max(cand))


Failing test case input:
1746

Expected output:
1728


Actual output:
41
12
6
4
3
2
2
2
1728


Fixed program (verdict: Accepted):
import math
x=int(input())
log_x=int(math.log(x,2))
cand=[0 for i in range(1001)]
cand[0]=1
for i in range(2,1000):
    cand[i]=int(pow(x,1.0/i))**i
cand[1000]=1000
print(max(cand[:x+1]))

Diff:
 import math
 x=int(input())
 log_x=int(math.log(x,2))
-cand=[0 for i in range(x)]
+cand=[0 for i in range(1001)]
 cand[0]=1
-for i in range(2,log_x):
-    print(int(pow(x,1.0/i)))
+for i in range(2,1000):
     cand[i]=int(pow(x,1.0/i))**i
-print(max(cand))
-
+cand[1000]=1000
+print(max(cand[:x+1]))
Buggy program (verdict: Wrong Answer):
N, M=map(int,input().split())
count=1
X=0
while N >= X:
  X = M * count
  count += 1
print(count-1)

Failing test case input:
01010 10

Expected output:
101


Actual output:
102


Fixed program (verdict: Accepted):
N, M=map(int,input().split())
count=1
X=0
while N > X:
  X = M * count
  count += 1
print(count-1)

Diff:
 N, M=map(int,input().split())
 count=1
 X=0
-while N >= X:
+while N > X:
   X = M * count
   count += 1
 print(count-1)
Buggy program (verdict: Wrong Answer):
def main():
   n = input()
   data = list(input())
   for i in data:
      a = ord(i) + int(n)
      if a > ord("Z"):
         a = a + ord("A") - ord("Z")
      print(chr(a),end = "")
   print("")

if __name__==  "__main__":
   main()

Failing test case input:
2
ZYXDBA

Expected output:
BAZFDC


Actual output:
CBZFDC


Fixed program (verdict: Accepted):
def main():
   n = input()
   data = list(input())
   for i in data:
      a = ord(i) + int(n)
      if a > ord("Z"):
         a = a + ord("A") - ord("Z") - 1
      print(chr(a),end = "")

if __name__==  "__main__":
   main()


Diff:
 def main():
    n = input()
    data = list(input())
    for i in data:
       a = ord(i) + int(n)
       if a > ord("Z"):
-         a = a + ord("A") - ord("Z")
+         a = a + ord("A") - ord("Z") - 1
       print(chr(a),end = "")
-   print("")
 
 if __name__==  "__main__":
    main()
+
Buggy program (verdict: Wrong Answer):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))

alf = list("abcdefghijklmnopqrstuvwxyz")
A = rls()
n = len(A)
ans = n*(n-1)/2 + 1
for i in alf:
    count = 0
    for j in A:
        if(i == j):
            count += 1
    ans -= count*(count-1)/2

print(ans)


Failing test case input:
xxwxxxxxxx

Expected output:
10


Actual output:
10.0


Fixed program (verdict: Accepted):
def ri(): return int(input())
def rli(): return list(map(int, input().split()))
def rls(): return list(input())
def pli(a): return "".join(list(map(str, a)))
def plis(a): return " ".join(list(map(str, a)))

alf = list("abcdefghijklmnopqrstuvwxyz")
A = rls()
n = len(A)
ans = n*(n-1)/2 + 1
for i in alf:
    count = 0
    for j in A:
        if(i == j):
            count += 1
    ans -= count*(count-1)/2

print(int(ans))


Diff:
 def ri(): return int(input())
 def rli(): return list(map(int, input().split()))
 def rls(): return list(input())
 def pli(a): return "".join(list(map(str, a)))
 def plis(a): return " ".join(list(map(str, a)))
 
 alf = list("abcdefghijklmnopqrstuvwxyz")
 A = rls()
 n = len(A)
 ans = n*(n-1)/2 + 1
 for i in alf:
     count = 0
     for j in A:
         if(i == j):
             count += 1
     ans -= count*(count-1)/2
 
-print(ans)
+print(int(ans))
Buggy program (verdict: Wrong Answer):

n=[]
line=''
while line != [0,0]:
    line=list(map(int,input().split()))
    n.append(line)
for i in range(len(n)-1):
    print('%d %d'%(n[i][0] if n[i][0]>=n[i][1] else n[i][1],n[i][0] if n[i][0]<=n[i][1] else n[i][1]))

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

Expected output:
0 1
2 2
3 9


Actual output:
1 0
2 2
9 3


Fixed program (verdict: Accepted):
n=[]
line=''
while line != [0,0]:
    line=list(map(int,input().split()))
    n.append(line)
for i in range(len(n)-1):
    print('%d %d'%(n[i][0] if n[i][0]<=n[i][1] else n[i][1],n[i][0] if n[i][0]>=n[i][1] else n[i][1]))

Diff:
-
 n=[]
 line=''
 while line != [0,0]:
     line=list(map(int,input().split()))
     n.append(line)
 for i in range(len(n)-1):
-    print('%d %d'%(n[i][0] if n[i][0]>=n[i][1] else n[i][1],n[i][0] if n[i][0]<=n[i][1] else n[i][1]))
+    print('%d %d'%(n[i][0] if n[i][0]<=n[i][1] else n[i][1],n[i][0] if n[i][0]>=n[i][1] else n[i][1]))
Buggy program (verdict: Wrong Answer):
n = int(input())
a = [int(input()) for i in range(n)]
cnt = 0

if 2 not in a:
  print(-1)

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

            
  if x == 2:
    print(cnt)
    exit()

print(-1)

Failing test case input:
4
4
19
1
4

Expected output:
-1


Actual output:
-1
-1


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

if 2 not in a:
  print(-1)
  exit()

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

            
  if x == 2:
    print(cnt)
    exit()

print(-1)

Diff:
 n = int(input())
 a = [int(input()) for i in range(n)]
 cnt = 0
 
 if 2 not in a:
   print(-1)
+  exit()
 
 x = 1
 for i in range(n-1):
  
   x = a[x-1]
   cnt += 1
 
             
   if x == 2:
     print(cnt)
     exit()
 
 print(-1)
Buggy program (verdict: Wrong Answer):
N = int(input())
SP = []
a = 1
for i in range(N):
    SP.append(input().split())
for i in SP:
    i.append(a)
    a += 1
SP.sort(reverse=True)
SP.sort(key=lambda x: x[0])
for i in range(N):
    print(SP[i][2])

Failing test case input:
10
yakutsk 10
yakutsl 20
yakutsk 30
yakutsk 2
yakutsk 50
yakutsk 60
yakutsk 70
yakktsu 80
yakutsk 90
yakutsk 100

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


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


Fixed program (verdict: Accepted):
N = int(input())
SP = []
a = 1
for i in range(N):
    SP.append(input().split())
for i in SP:
    i.append(a)
    a += 1
for i in range(N):
    SP[i][1] = int(SP[i][1])
SP.sort(reverse=True)
SP.sort(key=lambda x: x[0])
for i in range(N):
    print(SP[i][2])

Diff:
 N = int(input())
 SP = []
 a = 1
 for i in range(N):
     SP.append(input().split())
 for i in SP:
     i.append(a)
     a += 1
+for i in range(N):
+    SP[i][1] = int(SP[i][1])
 SP.sort(reverse=True)
 SP.sort(key=lambda x: x[0])
 for i in range(N):
     print(SP[i][2])
Buggy program (verdict: Wrong Answer):
X,D,C = map(int,input().split())
count=abs(X)
a = X
b = X%C
if a>D:
  print(count-D*C)
elif a==D:
  print(0)
elif a<D:
  D = D-a
  if D%2==0:
    print(b)
  else:
    print(min(abs(b-C),abs(b+C)))

Failing test case input:
1000011101011001 1000111000110011 1110101000010010

Expected output:
110089898999009


Actual output:
1000011101011001


Fixed program (verdict: Accepted):
X,D,C = map(int,input().split())
count=abs(X)
a = abs(X
b = abs(X%C)
if a>D:
  print(count-D*C)
elif a==D:
  print(b)
elif a<D:
  D = D-a
  if D%2==0:
    print(b)
  else:
    print(min(abs(b-C),abs(b+C)))

Diff:
 X,D,C = map(int,input().split())
 count=abs(X)
-a = X
-b = X%C
+a = abs(X
+b = abs(X%C)
 if a>D:
   print(count-D*C)
 elif a==D:
-  print(0)
+  print(b)
 elif a<D:
   D = D-a
   if D%2==0:
     print(b)
   else:
     print(min(abs(b-C),abs(b+C)))