ZhenlongDai/ACPR huggingface dataset:
Buggy program (verdict: Wrong Answer):
N,R = input().split()
N,R = int(N),int(R)
L = R
if N < 10:
    L=100*(10-N)
else:
    L = R

print(L)


Failing test case input:
6 319

Expected output:
719


Actual output:
400


Fixed program (verdict: Accepted):
N,R = input().split()
N,R = int(N),int(R)
L = R
if N < 10:
    L=R + 100*(10-N)
else:
    L = R

print(L)


Diff:
 N,R = input().split()
 N,R = int(N),int(R)
 L = R
 if N < 10:
-    L=100*(10-N)
+    L=R + 100*(10-N)
 else:
     L = R
 
 print(L)
Buggy program (verdict: Wrong Answer):
n = list(map(int, input().strip().split(' ')))
b = n[1]
h = 100000
c = 100000
int(c)
a = []
for i in range(n[0]):
  a.append(list(map(int, input().split())))
  if a[i][1] <= n[1] and a[i][0] <= c:
    h = a[i][1]
    c = a[i][0]
    

print(h)
print(c)
if h < n[1]:
  print(c)
else:
    print("TLE")

Failing test case input:
-5 0
0 0101
1 1
4 1101
6 28

Expected output:
TLE


Actual output:
100000
100000
TLE


Fixed program (verdict: Accepted):
n = list(map(int, input().strip().split(' ')))
b = n[1]
h = 100000
c = 100000
int(c)
a = []
for i in range(n[0]):
  a.append(list(map(int, input().split())))
  if a[i][1] <= n[1] and a[i][0] <= c:
    h = a[i][1]
    c = a[i][0]
    

if h <= n[1]:
  print(c)
else:
    print("TLE")

Diff:
 n = list(map(int, input().strip().split(' ')))
 b = n[1]
 h = 100000
 c = 100000
 int(c)
 a = []
 for i in range(n[0]):
   a.append(list(map(int, input().split())))
   if a[i][1] <= n[1] and a[i][0] <= c:
     h = a[i][1]
     c = a[i][0]
     
 
-print(h)
-print(c)
-if h < n[1]:
+if h <= n[1]:
   print(c)
 else:
     print("TLE")
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
tmp = sum(A)
sum_ = 0

for a in A:
    tmp -= a
    sum_ += a * tmp

print(sum_)


Failing test case input:
4
2519048 2493 176 11813

Expected output:
512820549


Actual output:
36512820801


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

for a in A:
    tmp -= a
    sum_ += a * tmp

print(sum_ % (1_000_000_007))


Diff:
 N = int(input())
 A = list(map(int, input().split()))
 tmp = sum(A)
 sum_ = 0
 
 for a in A:
     tmp -= a
     sum_ += a * tmp
 
-print(sum_)
+print(sum_ % (1_000_000_007))
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
absmin = 0
minnum = 0
for i in range(n):
  if abs(a[i]) < abs(a[absmin]):
    i = absmin
  if a[i] <= 0:
    minnum += 1
  a[i] = abs(a[i])
if minnum % 2 == 1:
  a[absmin] = -1 * abs(a[absmin])
ans = 0
for i in range(n):
  ans += a[i]
print(ans)

Failing test case input:
11
-29003401 1000100000 -8674852 1101000010 -856410392 0 1010010110 -493324020 1000000011 -485738863 1010000110

Expected output:
6994261769


Actual output:
6976912065


Fixed program (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
absmin = 0
minnum = 0
for i in range(n):
  if abs(a[i]) < abs(a[absmin]):
    absmin = i
  if a[i] <= 0:
    minnum += 1
  a[i] = abs(a[i])
if minnum % 2 == 1:
  a[absmin] = -1 * abs(a[absmin])
ans = 0
for i in range(n):
  ans += a[i]
print(ans)

Diff:
 n = int(input())
 a = list(map(int, input().split()))
 absmin = 0
 minnum = 0
 for i in range(n):
   if abs(a[i]) < abs(a[absmin]):
-    i = absmin
+    absmin = i
   if a[i] <= 0:
     minnum += 1
   a[i] = abs(a[i])
 if minnum % 2 == 1:
   a[absmin] = -1 * abs(a[absmin])
 ans = 0
 for i in range(n):
   ans += a[i]
 print(ans)
Buggy program (verdict: Wrong Answer):
a,b=map(int,input().split())
lst={0:0,1:300000,2:200000,3:1000000}
if a>3:
    x=0
else:
    x=a
if b>3:
    y=0
else:
    y=b
if x==1 and y==1:
    ans=1000000
else :
    ans=lst[x]+lst[y]


print(ans)

Failing test case input:
3 21

Expected output:
100000


Actual output:
1000000


Fixed program (verdict: Accepted):
a,b=map(int,input().split())
lst={0:0,1:300000,2:200000,3:100000}
if a>3:
    x=0
else:
    x=a
if b>3:
    y=0
else:
    y=b
if x==1 and y==1:
    ans=1000000
else :
    ans=lst[x]+lst[y]


print(ans)

Diff:
 a,b=map(int,input().split())
-lst={0:0,1:300000,2:200000,3:1000000}
+lst={0:0,1:300000,2:200000,3:100000}
 if a>3:
     x=0
 else:
     x=a
 if b>3:
     y=0
 else:
     y=b
 if x==1 and y==1:
     ans=1000000
 else :
     ans=lst[x]+lst[y]
 
 
 print(ans)
Buggy program (verdict: Wrong Answer):
n = input()
a = len(n)
c = 0
for i in range(a - 1):
    if i % 2 == 0:
        c += 9 * 10 ** i
n = int(n)
if a % 2:
    c += n % 10 ** (a - 1) + 1
print(c)

Failing test case input:
289

Expected output:
199


Actual output:
99


Fixed program (verdict: Accepted):
n = input()
a = len(n)
c = 0
for i in range(a - 1):
    if i % 2 == 0:
        c += 9 * 10 ** i
n = int(n)
if a % 2:
    c += n - 10 ** (a - 1 ) + 1
print(c)

Diff:
 n = input()
 a = len(n)
 c = 0
 for i in range(a - 1):
     if i % 2 == 0:
         c += 9 * 10 ** i
 n = int(n)
 if a % 2:
-    c += n % 10 ** (a - 1) + 1
+    c += n - 10 ** (a - 1 ) + 1
 print(c)
Buggy program (verdict: Wrong Answer):
N = input()

for i in N:
    if i == '7':
        print('Yes')
    else:
        print('No')

Failing test case input:
2610

Expected output:
No


Actual output:
No
No
No
No


Fixed program (verdict: Accepted):
N = input()
flg = False

for i in N:
    if i == '7':
        flg = True
if flg:
    print('Yes')
else:
    print('No')

Diff:
 N = input()
+flg = False
 
 for i in N:
     if i == '7':
-        print('Yes')
-    else:
-        print('No')
+        flg = True
+if flg:
+    print('Yes')
+else:
+    print('No')
Buggy program (verdict: Wrong Answer):
N,K=map(int,input().split())
l=list()
for i in range(N):
  l.append(input())
l.sort()
ans=int(l[K-1])-int(l[0])
for i in range(1,N-K+1):
  key=int(l[i+K-1])-int(l[i])
  if ans>key:
    ans=key
print(ans)

Failing test case input:
5 3
5
11
10
0
6

Expected output:
5


Actual output:
-5


Fixed program (verdict: Accepted):
N,K=map(int,input().split())
l=list()
for i in range(N):
  l.append(int(input()))
l.sort()
ans=int(l[K-1])-int(l[0])
for i in range(1,N-K+1):
  key=int(l[i+K-1])-int(l[i])
  if ans>key:
    ans=key
print(ans)

Diff:
 N,K=map(int,input().split())
 l=list()
 for i in range(N):
-  l.append(input())
+  l.append(int(input()))
 l.sort()
 ans=int(l[K-1])-int(l[0])
 for i in range(1,N-K+1):
   key=int(l[i+K-1])-int(l[i])
   if ans>key:
     ans=key
 print(ans)
Buggy program (verdict: Wrong Answer):
from collections import Counter
N, X, Y = map(int, input().split())
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

c = Counter(ans)
for i in range(1,N):
    print(c[i])


Failing test case input:
5 1 3

Expected output:
5
3
2
0


Actual output:
5
4
1
0


Fixed program (verdict: Accepted):
from collections import Counter
N, X, Y = map(int, input().split())
X, Y = X-1, Y-1
ans = []

for i in range(N):
    for j in range(i+1, N):
        ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))

c = Counter(ans)
for i in range(1,N):
    print(c[i])


Diff:
 from collections import Counter
 N, X, Y = map(int, input().split())
+X, Y = X-1, Y-1
 ans = []
 
 for i in range(N):
     for j in range(i+1, N):
         ans.append(min(j-i, 1+abs(i-X)+abs(j-Y)))
 
 c = Counter(ans)
 for i in range(1,N):
     print(c[i])
Buggy program (verdict: Wrong Answer):
N = int(input())
S = input()
T = input()
ans = S+T
for i in range(1,N+1):
    
    if S[-i:] == T[:i]:
        ans = S + T[i:]
print(ans)

Failing test case input:
4
frtx
yoer

Expected output:
8


Actual output:
frtxyoer


Fixed program (verdict: Accepted):
N = int(input())
S = input()
T = input()
ans = S+T
for i in range(1,N+1):
    
    if S[-i:] == T[:i]:
        ans = S + T[i:]
print(len(ans))

Diff:
 N = int(input())
 S = input()
 T = input()
 ans = S+T
 for i in range(1,N+1):
     
     if S[-i:] == T[:i]:
         ans = S + T[i:]
-print(ans)
+print(len(ans))
Buggy program (verdict: Wrong Answer):
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_ = [int(x) for x in range(1, n+1)]
a += a_
a_count = Counter(a)
for i in range(n):
    print(a_count[i+1])

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

Expected output:
1
3
0
0
1
0
1


Actual output:
2
4
1
1
2
1
2


Fixed program (verdict: Accepted):
from collections import Counter
n = int(input())
a = [int(x) for x in input().split()]
a_count = Counter(a)
for i in range(n):
    print(a_count[i+1])


Diff:
 from collections import Counter
 n = int(input())
 a = [int(x) for x in input().split()]
-a_ = [int(x) for x in range(1, n+1)]
-a += a_
 a_count = Counter(a)
 for i in range(n):
     print(a_count[i+1])
+
Buggy program (verdict: Wrong Answer):
N = int(input())
s = input()
t = input()
idx = 0
for i in range(N):
    tmp_s = s[N - i - 1:]
    tmp_t = t[:i + 1]
    if tmp_s == tmp_t:
        idx = i + 1

print(s + t[idx:])

Failing test case input:
3
cba
cec

Expected output:
6


Actual output:
cbacec


Fixed program (verdict: Accepted):
N = int(input())
s = input()
t = input()
idx = 0
for i in range(N):
    tmp_s = s[N - i - 1:]
    tmp_t = t[:i + 1]
    if tmp_s == tmp_t:
        idx = i + 1

print(len(s + t[idx:]))


Diff:
 N = int(input())
 s = input()
 t = input()
 idx = 0
 for i in range(N):
     tmp_s = s[N - i - 1:]
     tmp_t = t[:i + 1]
     if tmp_s == tmp_t:
         idx = i + 1
 
-print(s + t[idx:])
+print(len(s + t[idx:]))
+
Buggy program (verdict: Wrong Answer):
import bisect
n = int(input())
A = [0]
for i in range(n):
    num  = int(input())
    if num>A[-1]:
        A.append(num)
    else:
        j = bisect.bisect_left(A, num)
        A[j] = num
print(len(A))

Failing test case input:
5
2
1
1
0
11

Expected output:
2


Actual output:
3


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 = [0]
+A = []
 for i in range(n):
     num  = int(input())
-    if num>A[-1]:
+    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))
Buggy program (verdict: Wrong Answer):
N, T = map(int, input().split())
c, t = list(map(int, input().split()))
ans = 1001
i = 0
for i in range(N):
    if T > t and c < ans:
        ans = c

if ans == 1000:
    print("TLE")
else:
    print(ans)

Failing test case input:
3 36
7 94
2 2
7 20

Expected output:
2


Actual output:
1001


Fixed program (verdict: Accepted):
N, T = map(int, input().split())
i = 0
ans = 1001
for i in range(N):
    c, t = map(int, input().split())
    if T >= t and c < ans:
        ans = c

if ans == 1001:
    print("TLE")
else:
    print(ans)

Diff:
 N, T = map(int, input().split())
-c, t = list(map(int, input().split()))
-ans = 1001
 i = 0
+ans = 1001
 for i in range(N):
-    if T > t and c < ans:
+    c, t = map(int, input().split())
+    if T >= t and c < ans:
         ans = c
 
-if ans == 1000:
+if ans == 1001:
     print("TLE")
 else:
     print(ans)
Buggy program (verdict: Wrong Answer):
a, b, k = map(int,input().split())
if (b - a) <= 2*k  :
    for i in range(a,b+1):
        print('{}'.format(i))
else:    
    for i in range(k):
        print('{}'.format(a+i))
    for i in range(1,k+1):
        print('{}'.format(b+i-k))
        

Failing test case input:
2 4 001

Expected output:
2
4


Actual output:
2
3
4


Fixed program (verdict: Accepted):
a, b, k = map(int,input().split())
if (b - a) < 2*k  :
    for i in range(a,b+1):
        print('{}'.format(i))
else:    
    for i in range(k):
        print('{}'.format(a+i))
    for i in range(1,k+1):
        print('{}'.format(b+i-k))
        

Diff:
 a, b, k = map(int,input().split())
-if (b - a) <= 2*k  :
+if (b - a) < 2*k  :
     for i in range(a,b+1):
         print('{}'.format(i))
 else:    
     for i in range(k):
         print('{}'.format(a+i))
     for i in range(1,k+1):
         print('{}'.format(b+i-k))
Buggy program (verdict: Wrong Answer):
caps = [str[0] for str in input().split()]
print(caps)

Failing test case input:
AtCoder Befinnes Cpnsest

Expected output:
ABC


Actual output:
A, B, C

Fixed program (verdict: Accepted):
caps = [str[0] for str in input().split()]
print("".join(caps))

Diff:
 caps = [str[0] for str in input().split()]
-print(caps)
+print("".join(caps))
Buggy program (verdict: Wrong Answer):
n = int(input())
k = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if t < x + y:
        print('No')
        break
    if i == n-1:
        print('Yes')

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

Expected output:
No


Actual output:
Yes


Fixed program (verdict: Accepted):
n = int(input())
k = 0
for i in range(n):
    t,x,y = map(int,input().split())
    if t < x + y or t % 2 != (x + y) %2:
        print('No')
        break
    if i == n-1:
        print('Yes')

Diff:
 n = int(input())
 k = 0
 for i in range(n):
     t,x,y = map(int,input().split())
-    if t < x + y:
+    if t < x + y or t % 2 != (x + y) %2:
         print('No')
         break
     if i == n-1:
         print('Yes')
Buggy program (verdict: Wrong Answer):
N = int(input())
d_list = list(map(int, input().split()))
d_list.sort()

k = d_list[int(N/2)]
print(k)

count = 0
for i in range(N):
    if count == int(N/2):
        print('k is ' + str(k)) 
        print(d_list[int(N/2)] - d_list[int(N/2)-1])
        break
    elif k > d_list[i]:
        count += 1
    else:
        pass
else: 
    print(0)


Failing test case input:
8
0 1 24 3 0 8 4 0

Expected output:
2


Actual output:
3
k is 3
2


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

k = d_list[int(N/2)]
count = 0
for i in range(N):
    if count == int(N/2):
        print(d_list[int(N/2)] - d_list[int(N/2)-1])
        break
    elif k > d_list[i]:
        count += 1
    else:
        pass
else: 
    print(0)


Diff:
 N = int(input())
 d_list = list(map(int, input().split()))
 d_list.sort()
 
 k = d_list[int(N/2)]
-print(k)
-
 count = 0
 for i in range(N):
     if count == int(N/2):
-        print('k is ' + str(k)) 
         print(d_list[int(N/2)] - d_list[int(N/2)-1])
         break
     elif k > d_list[i]:
         count += 1
     else:
         pass
 else: 
     print(0)
Buggy program (verdict: Wrong Answer):
a,b=input().split()
a=int(a)
b=int(b)
e=a
d=b
c=1
d=0
if a>b:
  for i in range(1,e):
    if a%(e-i)==0 and b%(e-i)==0:
      a=a/(e-i)
      b=b/(e-i)
      c=c*(e-i)
  print(int(a*b*c))
if a<b:
  for i in range(1,d):
    if a%(d-i)==0 and b%(d-i)==0:
      a=a/(d-i)
      b=b/(d-i)
      c=c*(d-i)
  print(int(a*b*c))

Failing test case input:
123 456

Expected output:
18696

Actual output:
56088


Fixed program (verdict: Accepted):
a,b=input().split()
a=int(a)
b=int(b)
e=a
d=b
c=1
if a>b:
  for i in range(1,e):
    if a%(e-i)==0 and b%(e-i)==0:
      a=a/(e-i)
      b=b/(e-i)
      c=c*(e-i)
  print(int(a*b*c))
if a<b:
  for i in range(1,d):
    if a%(d-i)==0 and b%(d-i)==0:
      a=a/(d-i)
      b=b/(d-i)
      c=c*(d-i)
  print(int(a*b*c))

Diff:
 a,b=input().split()
 a=int(a)
 b=int(b)
 e=a
 d=b
 c=1
-d=0
 if a>b:
   for i in range(1,e):
     if a%(e-i)==0 and b%(e-i)==0:
       a=a/(e-i)
       b=b/(e-i)
       c=c*(e-i)
   print(int(a*b*c))
 if a<b:
   for i in range(1,d):
     if a%(d-i)==0 and b%(d-i)==0:
       a=a/(d-i)
       b=b/(d-i)
       c=c*(d-i)
   print(int(a*b*c))
Buggy program (verdict: Wrong Answer):
x,n = map(int,input().split())
p = list(map(int,input().split()))
if n==0:
    print(x)
    exit()
a,b = x,x
while True:
    a+=1
    b-=1
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break

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

Expected output:
15


Actual output:
14


Fixed program (verdict: Accepted):
x,n = map(int,input().split())
p = list(map(int,input().split()))
if x not in p:
    print(x)
    exit()
a,b = x,x
while True:
    a+=1
    b-=1
    if b not in p:
        print(b)
        break
    elif a not in p:
        print(a)
        break

Diff:
 x,n = map(int,input().split())
 p = list(map(int,input().split()))
-if n==0:
+if x not in p:
     print(x)
     exit()
 a,b = x,x
 while True:
     a+=1
     b-=1
     if b not in p:
         print(b)
         break
     elif a not in p:
         print(a)
         break
Buggy program (verdict: Wrong Answer):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1]
char_num = int(a[2])

target_char = word[char_num]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)


Failing test case input:
9
ntdoacujc
1

Expected output:
n********


Actual output:
*t********


Fixed program (verdict: Accepted):
import sys
a = []
for l in sys.stdin:
    a.append(l)


word_num = int(a[0])
word = a[1].split()[0]
char_num = int(a[2])

target_char = word[char_num - 1]

result = []
for each_char in word:
    if each_char != target_char:
        result.append('*')
    else:
        result.append(each_char)
result = ''.join(result)
print(result)


Diff:
 import sys
 a = []
 for l in sys.stdin:
     a.append(l)
 
 
 word_num = int(a[0])
-word = a[1]
+word = a[1].split()[0]
 char_num = int(a[2])
 
-target_char = word[char_num]
+target_char = word[char_num - 1]
 
 result = []
 for each_char in word:
     if each_char != target_char:
         result.append('*')
     else:
         result.append(each_char)
 result = ''.join(result)
 print(result)
Buggy program (verdict: Wrong Answer):

import math
x = int(input())
l = [1]
for i in range(int(math.sqrt(x))+1):
    j = 1
    for j in range(100):
        if i ** j > x:
            l.append(i ** (j-1))
            break
            
print(l[-1])

Failing test case input:
250

Expected output:
243


Actual output:
225


Fixed program (verdict: Accepted):

import math
x = int(input())
l = [1]
for i in range(int(math.sqrt(x))+1):
    for j in range(2,100):
        if i ** j > x:
            l.append(i ** (j-1))
            break
            
print(max(l))

Diff:
 
 import math
 x = int(input())
 l = [1]
 for i in range(int(math.sqrt(x))+1):
-    j = 1
-    for j in range(100):
+    for j in range(2,100):
         if i ** j > x:
             l.append(i ** (j-1))
             break
             
-print(l[-1])
+print(max(l))
Buggy program (verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=len(bin(j))-2-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))


Failing test case input:
10
1 14 159 2653 58979 376446 2643383 27950288 419716939 9375105820

Expected output:
104328928


Actual output:
564750493


Fixed program (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=10**9+7
for j in range(60):
    cnt1=sum([1 for i in a if i>>j&1])
    cnt0=n-cnt1
    ans+=(cnt1*cnt0*2**j)
print(ans%(10**9+7))


Diff:
 n=int(input())
 a=list(map(int,input().split()))
 ans=0
 mod=10**9+7
 for j in range(60):
     cnt1=sum([1 for i in a if i>>j&1])
-    cnt0=len(bin(j))-2-cnt1
+    cnt0=n-cnt1
     ans+=(cnt1*cnt0*2**j)
 print(ans%(10**9+7))
Buggy program (verdict: Wrong Answer):
k,n =map(int,input().split())
a=list(map(int,input().split()))
a.sort()
a.append(k+a[0])
ans = 0
for i in range(n):
    ans = max(ans,a[i+1]-a[i])
print(ans)

Failing test case input:
27 3
2 6 29

Expected output:
4


Actual output:
23


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

Diff:
 k,n =map(int,input().split())
 a=list(map(int,input().split()))
 a.sort()
 a.append(k+a[0])
 ans = 0
 for i in range(n):
     ans = max(ans,a[i+1]-a[i])
-print(ans)
+print(k - ans)
Buggy program (verdict: Wrong Answer):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]>v:
        k+=1
print(k)

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

Expected output:
1


Actual output:
6


Fixed program (verdict: Accepted):
a=int(input())
b=list(map(int,input().split()))
k=1
v=b[0]
for i in range(a):
    if b[i]<v:
        k+=1
        v=b[i]
print(k)

Diff:
 a=int(input())
 b=list(map(int,input().split()))
 k=1
 v=b[0]
 for i in range(a):
-    if b[i]>v:
+    if b[i]<v:
         k+=1
+        v=b[i]
 print(k)
Buggy program (verdict: Wrong Answer):
N, A, B = map(int, input().split())
if N == 1:
  if A == B:
    print(1)
  else:
    print(0)
else:
  if A > B:
    print(0)
  elif A == B or N == 2:
    print(1)
  else:
    print((B-A) * (N-2))
  

Failing test case input:
13 -3 2

Expected output:
56


Actual output:
55


Fixed program (verdict: Accepted):
N, A, B = map(int, input().split())
if N == 1:
  if A == B:
    print(1)
  else:
    print(0)
else:
  if A > B:
    print(0)
  elif A == B or N == 2:
    print(1)
  else:
    print((B-A) * (N-2) + 1)

Diff:
 N, A, B = map(int, input().split())
 if N == 1:
   if A == B:
     print(1)
   else:
     print(0)
 else:
   if A > B:
     print(0)
   elif A == B or N == 2:
     print(1)
   else:
-    print((B-A) * (N-2))
-  
+    print((B-A) * (N-2) + 1)
Buggy program (verdict: Wrong Answer):
n, k = map(int,input().split())
x = n
d = set(map(str,input().split()))
can_use = {str(i) for i in range(10)} ^ d
s_can_use = sorted(list(can_use))

for i in range(10**6):
    if set(list(str(x))) | can_use == can_use:
        print(n)
        break
    else:
        n += 1
        x = n
print(n)

Failing test case input:
1000 8
1 3 4 5 6 7 8 9

Expected output:
2000

Actual output:
2000
2000


Fixed program (verdict: Accepted):
n, k = map(int,input().split())
x = n
d = set(map(str,input().split()))
can_use = {str(i) for i in range(10)} ^ d
s_can_use = sorted(list(can_use))

for i in range(10**6):
    if set(list(str(x))) | can_use == can_use:
        print(n)
        break
    else:
        n += 1
        x = n


Diff:
 n, k = map(int,input().split())
 x = n
 d = set(map(str,input().split()))
 can_use = {str(i) for i in range(10)} ^ d
 s_can_use = sorted(list(can_use))
 
 for i in range(10**6):
     if set(list(str(x))) | can_use == can_use:
         print(n)
         break
     else:
         n += 1
         x = n
-print(n)
+
Buggy program (verdict: Wrong Answer):
import sys 

word =input()
flag = 0

for i in range(4):
    if word.count(word[i]) == 2:
        flag += 1
    
if flag == 4:
    print("yes")
else:
    print("No")

Failing test case input:
FFEE

Expected output:
Yes

Actual output:
yes


Fixed program (verdict: Accepted):
import sys 

word =input()
flag = 0

for i in range(4):
    if word.count(word[i]) == 2:
        flag += 1
    
if flag == 4:
    print("Yes")
else:
    print("No")

Diff:
 import sys 
 
 word =input()
 flag = 0
 
 for i in range(4):
     if word.count(word[i]) == 2:
         flag += 1
     
 if flag == 4:
-    print("yes")
+    print("Yes")
 else:
     print("No")
Buggy program (verdict: Wrong Answer):
N, M = map(int, input().split())
H_li = list(map(int, input().split()))

par = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    if H_li[B-1]>H_li[A-1]:
        par[A-1] = 1
    else:
        par[B-1] = 1

print(N-sum(par))

Failing test case input:
6 5
8 1 9 1 2 1
1 3
4 2
4 0
4 2
4 6

Expected output:
2


Actual output:
3


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

par = [0 for i in range(N)]

for i in range(M):
    A, B = map(int, input().split())
    if H_li[B-1]>H_li[A-1]:
        par[A-1] = 1
    elif H_li[A-1]>H_li[B-1]:
        par[B-1] = 1
    else:
        par[A-1] = 1
        par[B-1] = 1

print(N-sum(par))


Diff:
 N, M = map(int, input().split())
 H_li = list(map(int, input().split()))
 
 par = [0 for i in range(N)]
 
 for i in range(M):
     A, B = map(int, input().split())
     if H_li[B-1]>H_li[A-1]:
         par[A-1] = 1
+    elif H_li[A-1]>H_li[B-1]:
+        par[B-1] = 1
     else:
+        par[A-1] = 1
         par[B-1] = 1
 
 print(N-sum(par))
+
Buggy program (verdict: Wrong Answer):
N = input()
N = int(N)

print(N)

count = 0

if N == 100000 :
  count = 90909
if N >= 10000 and N <= 99999 :
  count = N - 10000 + 1 + 900 + 9
if N >= 1000 and N <= 9999 :
  count = 909
if N >= 100 and N <= 999 :
  count = N - 100 + 1 + 9
if N >= 10 and N <= 99 :
  count = 9
if N >= 1 and N <= 9 :
  count = N

print(count)


Failing test case input:
215

Expected output:
125


Actual output:
215
125


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

count = 0

if N == 100000 :
  count = 90909
if N >= 10000 and N <= 99999 :
  count = N - 10000 + 1 + 900 + 9
if N >= 1000 and N <= 9999 :
  count = 909
if N >= 100 and N <= 999 :
  count = N - 100 + 1 + 9
if N >= 10 and N <= 99 :
  count = 9
if N >= 1 and N <= 9 :
  count = N

print(count)


Diff:
 N = input()
 N = int(N)
 
-print(N)
-
 count = 0
 
 if N == 100000 :
   count = 90909
 if N >= 10000 and N <= 99999 :
   count = N - 10000 + 1 + 900 + 9
 if N >= 1000 and N <= 9999 :
   count = 909
 if N >= 100 and N <= 999 :
   count = N - 100 + 1 + 9
 if N >= 10 and N <= 99 :
   count = 9
 if N >= 1 and N <= 9 :
   count = N
 
 print(count)
Buggy program (verdict: Wrong Answer):

N = int(input())
A = [list(map(int, input().split())) for i in range(N)]



dp = [[0] * 3 for _ in range(N)]
dp[0][0] = A[0][0]
dp[0][1] = A[0][1]
dp[0][2] = A[0][2]


for i in range(N):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j],dp[i-1][k]+A[i][j])

print(max(dp[N-1]))

Failing test case input:
1
101 29 1

Expected output:
101


Actual output:
160


Fixed program (verdict: Accepted):

N = int(input())
A = [list(map(int, input().split())) for i in range(N)]



dp = [[0] * 3 for _ in range(N)]
dp[0][0] = A[0][0]
dp[0][1] = A[0][1]
dp[0][2] = A[0][2]


for i in range(1,N):
    for j in range(3):
        for k in range(3):
            if j != k:
                dp[i][j] = max(dp[i][j],dp[i-1][k]+A[i][j])

print(max(dp[N-1]))

Diff:
 
 N = int(input())
 A = [list(map(int, input().split())) for i in range(N)]
 
 
 
 dp = [[0] * 3 for _ in range(N)]
 dp[0][0] = A[0][0]
 dp[0][1] = A[0][1]
 dp[0][2] = A[0][2]
 
 
-for i in range(N):
+for i in range(1,N):
     for j in range(3):
         for k in range(3):
             if j != k:
                 dp[i][j] = max(dp[i][j],dp[i-1][k]+A[i][j])
 
 print(max(dp[N-1]))
Buggy program (verdict: Wrong Answer):
N,K = map(int,input().split())
H = list(map(int,input().split()))

dp = [0]*N
dp[1]= abs(H[1]-H[0])

inf = float("inf")

for i in range(1,N-1):
    tmp = inf
    oppai = min(K,i+1)
    for jump in range(1,oppai+1):
        tmp = min(tmp,dp[i+1-jump]+abs(H[i+1]-H[i+1-jump]))
    dp[i+1]=tmp
print(dp)
  


Failing test case input:
6 1
40 19 34 219 155 10 13 11 80 118

Expected output:
430


Actual output:
[0, 21, 36, 221, 285, 430]


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

dp = [0]*N
dp[1]= abs(H[1]-H[0])

inf = float("inf")

for i in range(1,N-1):
    tmp = inf
    oppai = min(K,i+1)
    for jump in range(1,oppai+1):
        tmp = min(tmp,dp[i+1-jump]+abs(H[i+1]-H[i+1-jump]))
    dp[i+1]=tmp
print(dp[N-1])
  

Diff:
 N,K = map(int,input().split())
 H = list(map(int,input().split()))
 
 dp = [0]*N
 dp[1]= abs(H[1]-H[0])
 
 inf = float("inf")
 
 for i in range(1,N-1):
     tmp = inf
     oppai = min(K,i+1)
     for jump in range(1,oppai+1):
         tmp = min(tmp,dp[i+1-jump]+abs(H[i+1]-H[i+1-jump]))
     dp[i+1]=tmp
-print(dp)
+print(dp[N-1])
   
-
Buggy program (verdict: Wrong Answer):
n = int(input())
s = input()
k = int(input())
sa = s[k: k + 1]
sl = len(s)
sli = list(s)
hey = []
for sli in sli:
    if sli == sa:
        hey.append(sli)
    else:
        hey.append("*")
hey = "".join(hey)
print(hey)


Failing test case input:
9
eiubatdnn
2

Expected output:
*i*******


Actual output:
**u******


Fixed program (verdict: Accepted):
n = int(input())
s = input()
k = int(input())
sa = s[k - 1: k]
sl = len(s)
sli = list(s)
hey = []
for sli in sli:
    if sli == sa:
        hey.append(sli)
    else:
        hey.append("*")
hey = "".join(hey)
print(hey)


Diff:
 n = int(input())
 s = input()
 k = int(input())
-sa = s[k: k + 1]
+sa = s[k - 1: k]
 sl = len(s)
 sli = list(s)
 hey = []
 for sli in sli:
     if sli == sa:
         hey.append(sli)
     else:
         hey.append("*")
 hey = "".join(hey)
 print(hey)
Buggy program (verdict: Wrong Answer):
N, R1, R2 = map(int, input().split())
count={}
for m in range(N-1):
    count[m+1] = 0 
for i in range(N):
    for j in range(i+1, N):
        if i <= R1-1 and j >= R2-1:
            count[j-i-(R2-R1-1)] +=1
        else:
            count[j-i] += 1
for k in count.values():
    print(k)


Failing test case input:
19 1 8

Expected output:
19
20
21
18
14
13
12
11
10
9
8
7
5
3
1
0
0
0


Actual output:
19
18
17
16
15
14
12
11
10
9
8
7
5
4
3
2
1
0


Fixed program (verdict: Accepted):
N, R1, R2 = map(int, input().split())
n = R2 - R1 - 1
count={}
for m in range(N-1):
    count[m+1] = 0 
for i in range(N):
    for j in range(i+1, N):
        k = min(j-i, abs((R1-1)-i) + 1 +abs((R2-1)-j))
        count[k]+=1
for k in count.values():
    print(k)

Diff:
 N, R1, R2 = map(int, input().split())
+n = R2 - R1 - 1
 count={}
 for m in range(N-1):
     count[m+1] = 0 
 for i in range(N):
     for j in range(i+1, N):
-        if i <= R1-1 and j >= R2-1:
-            count[j-i-(R2-R1-1)] +=1
-        else:
-            count[j-i] += 1
+        k = min(j-i, abs((R1-1)-i) + 1 +abs((R2-1)-j))
+        count[k]+=1
 for k in count.values():
     print(k)
-
Buggy program (verdict: Wrong Answer):
n,m = list(map(int,input().split()))

if n > m:
  for i in range(n):
    print(m)
else:
  for i in range(m):
    print(n)

Failing test case input:
37 14

Expected output:
14141414141414141414141414141414141414141414141414141414141414141414141414


Actual output:
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14
14


Fixed program (verdict: Accepted):
n,m = list(map(int,input().split()))
 
if n > m:
  for i in range(n):
    print(str(m),end="")
else:
  for i in range(m):
    print(str(n),end="")

Diff:
 n,m = list(map(int,input().split()))
-
+ 
 if n > m:
   for i in range(n):
-    print(m)
+    print(str(m),end="")
 else:
   for i in range(m):
-    print(n)
+    print(str(n),end="")
Buggy program (verdict: Wrong Answer):
N,T = map(int,input().split())
CT = []
for n in range(N):
  c,t = map(int,input().split())
  CT.append([c,t])
CT = sorted(CT,key=lambda x: x[0])
ans = False
for ct in CT:
  if ct[1] <= T:
    print(ct[0])
    ans = True
    break
if ans:
  print("TLE") 


Failing test case input:
-5 0
0 0100
1 1
4 1101
6 28

Expected output:
TLE


Actual output:

Fixed program (verdict: Accepted):
N,T = map(int,input().split())
CT = []
for n in range(N):
  c,t = map(int,input().split())
  CT.append([c,t])
CT = sorted(CT,key=lambda x: x[0])
ans = True
for ct in CT:
  if ct[1] <= T:
    print(ct[0])
    ans = False
    break
if ans:
  print("TLE") 


Diff:
 N,T = map(int,input().split())
 CT = []
 for n in range(N):
   c,t = map(int,input().split())
   CT.append([c,t])
 CT = sorted(CT,key=lambda x: x[0])
-ans = False
+ans = True
 for ct in CT:
   if ct[1] <= T:
     print(ct[0])
-    ans = True
+    ans = False
     break
 if ans:
   print("TLE")
Buggy program (verdict: Wrong Answer):
a, b, k =  map(int, input().split())
turn_a = 1
for i in range(k):
  if turn_a == 1:
    if a % 2 == 1:
      b = b + (a-1)/2
      a = (a-1)/2
    else:
      b = b + a/2
      a = a/2
    turn_a = 0
  else:
    if b % 2 == 1:
      a = a + (b-1)/2
      b = (b-1)/2      
    else:
      a = a + b/2
      b = b/2 
    turn_a = 1
print(a, b)

Failing test case input:
7425724 65000432 157

Expected output:
24142046 48284092


Actual output:
24142046.0 48284092.0


Fixed program (verdict: Accepted):
a, b, k =  map(int, input().split())
turn_a = 1
for i in range(k):
  if turn_a == 1:
    if a % 2 == 1:
      b = b + (a-1)/2
      a = (a-1)/2
    else:
      b = b + a/2
      a = a/2
    turn_a = 0
  else:
    if b % 2 == 1:
      a = a + (b-1)/2
      b = (b-1)/2      
    else:
      a = a + b/2
      b = b/2 
    turn_a = 1
print(int(a), int(b))

Diff:
 a, b, k =  map(int, input().split())
 turn_a = 1
 for i in range(k):
   if turn_a == 1:
     if a % 2 == 1:
       b = b + (a-1)/2
       a = (a-1)/2
     else:
       b = b + a/2
       a = a/2
     turn_a = 0
   else:
     if b % 2 == 1:
       a = a + (b-1)/2
       b = (b-1)/2      
     else:
       a = a + b/2
       b = b/2 
     turn_a = 1
-print(a, b)
+print(int(a), int(b))
Buggy program (verdict: Wrong Answer):
n = int(input())
t = [0] * n
a = [0] * n
for i in range(n):
    tt, aa = map(int, input().split())
    t[i], a[i] = tt, aa

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

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

Expected output:
4


Actual output:
1


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

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

Diff:
 n = int(input())
 t = [0] * n
 a = [0] * n
 for i in range(n):
     tt, aa = map(int, input().split())
     t[i], a[i] = tt, aa
 
 if n == 1:
     print(t[0]+a[0])
 else:
     for i in range(1, n):
-        for j in range(1, 10**6+1):
+        for j in range(max(t[i-1]
             if t[i]*j >= t[i-1] and a[i]*j >= a[i-1]:
                 t[i], a[i] = t[i] * j, a[i] * j
                 break
-print(t[n-1]+a[n-1])
+    print(t[n-1]+a[n-1])
Buggy program (verdict: Wrong Answer):
import sys
import math
y = int(input().split()[0])
result = ""
i = 0
while True:
    print(i)
    z = (-2) ** (i+1)
    x = y % z
    print(x)
    if x != 0:
        y = y + x
        result = "1" + result
    else:
        result = "0" + result
    if y == 0:
        break
    i = i + 1
print(result)

Failing test case input:
2643092

Expected output:
11110000101010110010100


Actual output:
0
0
1
0
2
-4
3
0
4
-16
5
0
6
0
7
128
8
-256
9
0
10
-1024
11
0
12
-4096
13
0
14
-16384
15
0
16
0
17
0
18
0
19
524288
20
-1048576
21
2097152
22
-4194304
11110000101010110010100


Fixed program (verdict: Accepted):
import sys
import math
y = int(input().split()[0])
result = ""
i = 0
while True:
    z = (-2) ** (i+1)
    x = y % z
    if x != 0:
        y = y + x
        result = "1" + result
    else:
        result = "0" + result
    if y == 0:
        break
    i = i + 1
print(result)


Diff:
 import sys
 import math
 y = int(input().split()[0])
 result = ""
 i = 0
 while True:
-    print(i)
     z = (-2) ** (i+1)
     x = y % z
-    print(x)
     if x != 0:
         y = y + x
         result = "1" + result
     else:
         result = "0" + result
     if y == 0:
         break
     i = i + 1
 print(result)
+
Buggy program (verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split())) 

B = [0] * N

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

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

Expected output:
3
1
0
1
0
0
1


Actual output:
3
2
0
4
0
0
7


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

B = [0] * N

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

Diff:
 N = int(input())
 A = list(map(int, input().split())) 
 
 B = [0] * N
 
 for i in range(N-1):
-    B[A[i]-1] += A[i]
+    B[A[i]-1] += int(A[i]/A[i])
     
 [print(B[i]) for i in range(N)]
Buggy program (verdict: Wrong Answer):


 
def main():
	N = int(input())
	while N % 2 == 0:
		N = N / 2
	print(N*2)
 
if __name__ == '__main__':
	main()

Failing test case input:
1295498732

Expected output:
1295498732


Actual output:
647749366.0


Fixed program (verdict: Accepted):


 
def main():
	N = int(input())
	if N % 2 == 0:
		print(int(N))
	else:
		print(int(N*2))
 
if __name__ == '__main__':
	main()

Diff:
 
 
  
 def main():
 	N = int(input())
-	while N % 2 == 0:
-		N = N / 2
-	print(N*2)
+	if N % 2 == 0:
+		print(int(N))
+	else:
+		print(int(N*2))
  
 if __name__ == '__main__':
 	main()
Buggy program (verdict: Wrong Answer):
N   = int(input())
A   = input().split()
cou = 0

for mak in range(1,N) :
    for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = str(A[j])
            A[j]     = str(A[j - 1])
            A[j - 1] = str(tem)
            cou = cou + 1
print(' '.join(A))
print(cou)

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

Expected output:
-3 0 1 3 26
5


Actual output:
-3 0 1 26 3
4


Fixed program (verdict: Accepted):
N   = int(input())
A   = [int(temp) for temp in input().split()]
cou = 0

for mak in range(1,N) :
    for j in range(mak,N)[ : : -1] :
        if A[j] < A[j - 1] :
            tem      = int(A[j])
            A[j]     = int(A[j - 1])
            A[j - 1] = int(tem)
            cou = cou + 1
A   = [str(temp) for temp in A]
print(' '.join(A))
print(cou)

Diff:
 N   = int(input())
-A   = input().split()
+A   = [int(temp) for temp in input().split()]
 cou = 0
 
 for mak in range(1,N) :
     for j in range(mak,N)[ : : -1] :
         if A[j] < A[j - 1] :
-            tem      = str(A[j])
-            A[j]     = str(A[j - 1])
-            A[j - 1] = str(tem)
+            tem      = int(A[j])
+            A[j]     = int(A[j - 1])
+            A[j - 1] = int(tem)
             cou = cou + 1
+A   = [str(temp) for temp in A]
 print(' '.join(A))
 print(cou)
Buggy program (verdict: Wrong Answer):
n = int(input())
flag = False
x = int(n / 108 * 100)
for i in range(x,x+3):
    if int(i*1.08) == n:
        flag = True
if flag:
    print(x)
else:
    print(":(")

Failing test case input:
416

Expected output:
386


Actual output:
385


Fixed program (verdict: Accepted):
n = int(input())
flag = False
x = int(n / 108 * 100)
for i in range(x-5,x+5):
    if int(i*1.08) == n:
        flag = True
        x = i
if flag:
    print(x)
else:
    print(":(")


Diff:
 n = int(input())
 flag = False
 x = int(n / 108 * 100)
-for i in range(x,x+3):
+for i in range(x-5,x+5):
     if int(i*1.08) == n:
         flag = True
+        x = i
 if flag:
     print(x)
 else:
     print(":(")
+
Buggy program (verdict: Wrong Answer):
N=input()
if N[1]==N[2]:
    if N[1]==N[0] or N[1]==N[3]:
        print('Yes')
else:print('No')

Failing test case input:
3550

Expected output:
No


Actual output:

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

Diff:
 N=input()
 if N[1]==N[2]:
     if N[1]==N[0] or N[1]==N[3]:
         print('Yes')
+    else:
+        print('No')
 else:print('No')
Buggy program (verdict: Wrong Answer):
S=int(input())
n=1
while n>0.001:
    if int(S/1000*n)==int(S-1000*n)/(100*n):
        print("Bad")
        break
    else:
        n=n/10
else:
    print("Good")

Failing test case input:
1229

Expected output:
Bad


Actual output:
Good


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-1000*n)/(100*n):
+    if S
         print("Bad")
         break
     else:
+        S=S-(1000*n)*(S
         n=n/10
 else:
     print("Good")
Buggy program (verdict: Wrong Answer):

N = int(input())

S = set()
for i in range(N):
  d = int(input())
  S.add(i)

print(len(S))

Failing test case input:
3
29
15
15

Expected output:
2


Actual output:
3


Fixed program (verdict: Accepted):

N = int(input())

S = set()
for i in range(N):
  d = int(input())
  S.add(d)

print(len(S))

Diff:
 
 N = int(input())
 
 S = set()
 for i in range(N):
   d = int(input())
-  S.add(i)
+  S.add(d)
 
 print(len(S))
Buggy program (verdict: Wrong Answer):

def pin(type=int):
    return map(type,input().split())




N,A,B=pin()
if A==B:
    print(1)
elif A>B or N==1:
    print(0)
else:
    print((N-1)*(B-A))

Failing test case input:
12 -3 0

Expected output:
31


Actual output:
33


Fixed program (verdict: Accepted):

def pin(type=int):
    return map(type,input().split())




N,A,B=pin()
if A==B:
    print(1)
elif A>B or N==1:
    print(0)
else:
    print((N-2)*(B-A)+1)



Diff:
 
 def pin(type=int):
     return map(type,input().split())
 
 
 
 
 N,A,B=pin()
 if A==B:
     print(1)
 elif A>B or N==1:
     print(0)
 else:
-    print((N-1)*(B-A))
+    print((N-2)*(B-A)+1)
+
+
Buggy program (verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

count = 0
while sum(a) % 2 == 0 :
	for i in range(n):
		a[i] = a[i] / 2

	count += 1

print(count)

Failing test case input:
6
71148002 1055849701 81412222 21985869 236966 734273188

Expected output:
0


Actual output:
2


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

count = 0
flag = 0

while flag == 0 :
	
	for i in range(n):
		flag += 0 if a[i] % 2 == 0 else + 1
		a[i] = a[i] / 2


	count += 1 if flag == 0 else +0

print(count)

Diff:
 n = int(input())
 a = list(map(int, input().split()))
 
 count = 0
-while sum(a) % 2 == 0 :
+flag = 0
+
+while flag == 0 :
+	
 	for i in range(n):
+		flag += 0 if a[i] % 2 == 0 else + 1
 		a[i] = a[i] / 2
 
-	count += 1
+
+	count += 1 if flag == 0 else +0
 
 print(count)
Buggy program (verdict: Wrong Answer):
N,P=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x:x%2,a))
if 1 in a:
    print(2**N)
else:
    if P%2==0:
        print(2**(N-1))
    else:
        print(0)

Failing test case input:
45 1
17 55 85 55 74 20 90 94 40 70 2 89 91 50 16 9 14 43 24 66 25 9 89 71 41 16 53 13 61 15 85 72 62 67 42 26 36 66 4 87 59 91 4 20 26

Expected output:
17592186044416


Actual output:
35184372088832


Fixed program (verdict: Accepted):
N,P=map(int,input().split())
a=list(map(int,input().split()))
a=list(map(lambda x:x%2,a))
if 1 in a:
    print(2**(N-1))
else:
    if P%2==0:
        print(2**N)
    else:
        print(0)

Diff:
 N,P=map(int,input().split())
 a=list(map(int,input().split()))
 a=list(map(lambda x:x%2,a))
 if 1 in a:
-    print(2**N)
+    print(2**(N-1))
 else:
     if P%2==0:
-        print(2**(N-1))
+        print(2**N)
     else:
         print(0)
Buggy program (verdict: Wrong Answer):
from sys import stdin
a,b = [x for x in stdin.readline().rstrip().split()]
print(a+b)

Failing test case input:
cgqp c]s

Expected output:
c]scgqp


Actual output:
cgqpc]s


Fixed program (verdict: Accepted):
from sys import stdin
a,b = [x for x in stdin.readline().rstrip().split()]
print(b+a)

Diff:
 from sys import stdin
 a,b = [x for x in stdin.readline().rstrip().split()]
-print(a+b)
+print(b+a)
Buggy program (verdict: Wrong Answer):
h, w = map(int, input().split())
S = [input().split() for _ in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == 'snuke':
            print(chr(i+65) + str(j+1))



Failing test case input:
15 10
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snuke snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake
snake snake snake snake snake snake snake snake snake snake

Expected output:
H6

Actual output:
F8


Fixed program (verdict: Accepted):
h, w = map(int, input().split())
S = [input().split() for _ in range(h)]
for i in range(h):
    for j in range(w):
        if S[i][j] == 'snuke':
            print(chr(j+65) + str(i+1))



Diff:
 h, w = map(int, input().split())
 S = [input().split() for _ in range(h)]
 for i in range(h):
     for j in range(w):
         if S[i][j] == 'snuke':
-            print(chr(i+65) + str(j+1))
+            print(chr(j+65) + str(i+1))
Buggy program (verdict: Wrong Answer):
n = int(input())
a = [0] + [int(input()) for i in range(n)]
c = a[1]
p = 1
if 2 not in a:
    print(-1)
while c > 2:
    d = a[c]
    a[c] = 0
    c = d
    p += 1


if c == 2:
    print(p)
else:
    print(-1)


Failing test case input:
4
4
3
0
4

Expected output:
-1


Actual output:
-1
-1


Fixed program (verdict: Accepted):
n = int(input())
a = [0] + [int(input()) for i in range(n)]
c = a[1]
p = 1
while c > 2:
    d = a[c]
    a[c] = 0
    c = d
    p += 1

if c == 2:
    print(p)
else:
    print(-1)


Diff:
 n = int(input())
 a = [0] + [int(input()) for i in range(n)]
 c = a[1]
 p = 1
-if 2 not in a:
-    print(-1)
 while c > 2:
     d = a[c]
     a[c] = 0
     c = d
     p += 1
 
-
 if c == 2:
     print(p)
 else:
     print(-1)
Buggy program (verdict: Wrong Answer):
K, N = map(int, input().split())
A = list(map(int, input().split()))
B = 0
D = 0

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

B += K - A[-1]
print(B - D)


Failing test case input:
50 3
2 3 128

Expected output:
-75


Actual output:
-77


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

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

D = max(D, K + A[0] - A[-1])
print(K - D)


Diff:
 K, N = map(int, input().split())
 A = list(map(int, input().split()))
-B = 0
 D = 0
 
 for i in range(N-1):
-    B += A[i+1] - A[i]
     D = max(D, A[i+1] - A[i])
 
-B += K - A[-1]
-print(B - D)
+D = max(D, K + A[0] - A[-1])
+print(K - D)
Buggy program (verdict: Wrong Answer):
import sys
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(-1)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    ans+=1
print(ans)

Failing test case input:
15 14 7

Expected output:
0


Actual output:
-1


Fixed program (verdict: Accepted):
import sys
a,b,c=map(int,input().split())
ans=0
if a%2==1 or b%2==1 or c%2==1:
    print(0)
    sys.exit()
if a%2==0 and a==b==c:
    print(-1)
    sys.exit()
while a%2==0 and b%2==0 and c%2==0:
    ta=a/2
    tb=b/2
    tc=c/2
    a=tb+tc
    b=ta+tc
    c=ta+tb
    ans+=1
print(ans)

Diff:
 import sys
 a,b,c=map(int,input().split())
 ans=0
 if a%2==1 or b%2==1 or c%2==1:
-    print(-1)
+    print(0)
     sys.exit()
 if a%2==0 and a==b==c:
     print(-1)
     sys.exit()
 while a%2==0 and b%2==0 and c%2==0:
     ta=a/2
     tb=b/2
     tc=c/2
     a=tb+tc
     b=ta+tc
     c=ta+tb
     ans+=1
 print(ans)
Buggy program (verdict: Wrong Answer):

import bisect
n = int(input())
l = sorted(list(map(int,input().split())))



ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(l,l[i] + l[j]) - (j + 1)
        print(ans)

print(ans)

Failing test case input:
7
583 1452 16 24 75 304 3

Expected output:
0


Actual output:
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0


Fixed program (verdict: Accepted):

import bisect
n = int(input())
l = sorted(list(map(int,input().split())))



ans = 0
for i in range(n - 1):
    for j in range(i + 1, n):
        ans += bisect.bisect_left(l,l[i] + l[j]) - (j + 1)
        

print(ans)

Diff:
 
 import bisect
 n = int(input())
 l = sorted(list(map(int,input().split())))
 
 
 
 ans = 0
 for i in range(n - 1):
     for j in range(i + 1, n):
         ans += bisect.bisect_left(l,l[i] + l[j]) - (j + 1)
-        print(ans)
+        
 
 print(ans)