ZhenlongDai/ACPR huggingface dataset:
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin

x, a, b = map(int, stdin.readline().split())
print('A' if abs(a - x) > abs(b - x) else "B")

Failing test case input:
1 444 0001

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
from sys import stdin

x, a, b = map(int, stdin.readline().split())
print('A' if abs(a - x) < abs(b - x) else "B")

Problem: p03623
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x, a, b = map(int, input().split())
if abs(a-x) < abs(b-a):
  print("A")
else:
  print("B")

Failing test case input:
-1 8 0010

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
if abs(a-x) < abs(b-x):
  print("A")
else:
  print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
print('AB'[abs(a-x)<abs(b-x)::2])

Failing test case input:
1 25 1101

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
print('AB'[abs(a-x)>abs(b-x)::2])

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if (b-a)>=(c-b):
  print(c-b)
else:
  print(b-a)

Failing test case input:
2 217 1011

Expected output:
A


Actual output:
215


Fixed submission (verdict: Accepted):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if abs(b-a)>abs(c-a):
  print("B")
else:
  print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = list(map(int, input().split()))

if abs(a-x) > abs(b-x):
	print('A')
else:
	print('B')

Failing test case input:
23 3 9

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = list(map(int, input().split()))

if abs(a-x) < abs(b-x):
	print('A')
else:
	print('B')

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x,a,b = map(int,input().split())
a1,b1 = abs(x-a),abs(x-b)
if a1 >= b1:
    print(b1)
else:
    print(a1)

Failing test case input:
1 213 1110

Expected output:
A


Actual output:
212


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
a1,b1 = abs(x-a),abs(x-b)
if a1 >= b1:
    print("B")
else:
    print("A")

Problem: p03623
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
x , a , b = map(int,input().split())
if abs(x-a) > abs(x-b):
    print("A")
else:
    print("B")

Failing test case input:
1 999 0001

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x , a , b = map(int,input().split())
if abs(x-a) <abs(x-b):
    print("A")
else:
    print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())

xa = x - a
xb = b - x

if(xa < xb):
    print('A')
else:
    print("B")

Failing test case input:
1 156 0011

Expected output:
B


Actual output:
A


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

xa = x - a
xb = b - x
if(xa<0):
    xa = -xa
if(xb<0):
    xb = -xb

if(xa < xb):
    print('A')
else:
    print("B")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
  print("A")
else:
  print("B")

Failing test case input:
1 125 0011

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
if abs(x - a) > abs(x - b):
  print("B")
else:
  print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b=map(int,input().split())
print(min(abs(a-x),abs(b-x)))

Failing test case input:
1 232 0110

Expected output:
B


Actual output:
109


Fixed submission (verdict: Accepted):
x,a,b=map(int,input().split())
print('A' if min(abs(a-x),abs(b-x))==abs(a-x) else 'B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
  print(a)
else:
  print(b)

Failing test case input:
1 631 0110

Expected output:
B


Actual output:
110


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
  print('A')
else:
  print('B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
print(["B","A"][(x-a)^2 < (x-b)^2])

Failing test case input:
0 125 0001

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
print(["A","B"][abs(a-x)>abs(b-x)])

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int, input().split())
if (abs(x-a) > abs(x-b)):
    print("A")
else:
    print("B")

Failing test case input:
-1 0 0001

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int, input().split())
if (abs(x-a) < abs(x-b)):
    print("A")
else:
    print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = input().split()
x = int(x)
a = int(a)
b = int(b)
if (x-a)^2 <= (x-b)^2 :
 print("A")
else :
 print("B")

Failing test case input:
16 3 1

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = input().split()
x = int(x)
a = int(a)
b = int(b)
if (x-a)*(x-a) <= (x-b)*(x-b) :
  print("A")
else :
  print("B")

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c = map(int,input().split())

if abs(a-b) > abs(a-c):
    print('A')
else:
    print('B')

Failing test case input:
1 444 0001

Expected output:
B


Actual output:
A


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

if abs(a-b) < abs(a-c):
    print('A')
else:
    print('B')
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):


import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x,a,b = map(int, read().split())
print('A' if (a+b)/2>x else 'B')

Failing test case input:
1 999 0101

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):


import sys
import itertools



read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

x,a,b = map(int, read().split())
print('A' if abs(b-x)>abs(a-x) else 'B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

x, a, b = map(int, input().split())
print('B' if abs(a-x) < abs(a-b) else 'A')


Failing test case input:
0 0 0001

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):

x, a, b = map(int, input().split())
print('B' if abs(a-x) > abs(b-x) else 'A')

Problem: p03623
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
getList = lambda: list(map(int, input().split()))
a,b,x = getList()
if abs(a - x) < abs(b - x):
  print("A")
else:
  print("B")
  

Failing test case input:
1 1455 0000

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
getList = lambda: list(map(int, input().split()))
x,a,b = getList()
if abs(a - x) < abs(b - x):
  print("A")
else:
  print("B")

Problem: p03623
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
def mealdelivery(x , a , b):

    return "A" if abs(x - a) > abs(x - b) else "B"

def main():
    x , a , b = map(int , input().split())
    print(mealdelivery(x , a , b))

if __name__ == '__main__':
    main()


Failing test case input:
17 2 9

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
def mealdelivery(x , a , b):

    return "A" if abs(x - a) < abs(x - b) else "B"

def main():
    x , a , b = map(int , input().split())
    print(mealdelivery(x , a , b))

if __name__ == '__main__':
    main()

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())

print(max(abs(x-a), abs(x-b)))

Failing test case input:
-1 25 0011

Expected output:
B


Actual output:
26


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
print("A") if abs(x-a)<abs(x-b) else print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
if abs(x-a)>abs(x-b):
	print("A")
else:
	print("B")


Failing test case input:
1 190 0101

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
if abs(a-x)<abs(b-x):
	print("A")
else:
	print("B")

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, a, b = map(int, input().split())
if abs(a - x) >= abs(b - x):
  print('A')
else:
  print('B')

Failing test case input:
-1 0 0001

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
if abs(a - x) <= abs(b - x):
  print('A')
else:
  print('B')
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a <= 0:
  x_a = -x_a
elif x_b <= 0:
  x_b = -x_b
print('A' if x_a < x_b else 'B')


Failing test case input:
10 3 1

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a < 0:
  x_a = -x_a
if x_b < 0:
  x_b = -x_b
print('A' if x_a <= x_b else 'B')

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, a, b = map(int, input().split())

if abs(a - x) > abs(b - x):
  print('A')
else:
  print('B')  

Failing test case input:
0 125 0011

Expected output:
B


Actual output:
A


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

if abs(a - x) > abs(b - x):
  print('B')
else:
  print('A')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map( int, input().split() )

if abs(x - a) > abs(x - b): print( 'A' )
else:                       print( 'B' )

Failing test case input:
-1 22 0011

Expected output:
B


Actual output:
A


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

if abs(x - a) > abs(x - b): print( 'B' )
else:                       print( 'A' )

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int, input().split())
print("A" if abs(x-a)>abs(x-b) else "B")

Failing test case input:
-1 22 0011

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int, input().split())
print("A" if abs(x-a)<abs(x-b) else "B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b=map(int,input().split())
if(abs(x-a)>=abs(x-b)):
    print(b)
else:
    print(a)

Failing test case input:
0 25 1001

Expected output:
A


Actual output:
25


Fixed submission (verdict: Accepted):
x,a,b=map(int,input().split())
if(abs(x-a)>=abs(x-b)):
    print("B")
else:
    print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
print('A' if abs(x-a) > abs(x-b) else 'B')

Failing test case input:
1 5 1001

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
print('A' if abs(x-a) < abs(x-b) else 'B')

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if (a-b)>=(c-a):
  print("B")
else:
  print("A")

Failing test case input:
16 3 1

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
a,b,c=input().split()
a=int(a)
b=int(b)
c=int(c)
if abs(b-a)>abs(c-a):
  print("B")
else:
  print("A")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
list = list(map(int,input().split()))

x=list[0]
a=list[1]
b=list[2]

if a>x:
    s=a-x
else:
    s=x-a

if b>x:
    t=b-x
else:
    t=x-b
    
if s<t:
    print('B')
else:
    print('A')

Failing test case input:
0 25 0011

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
list = list(map(int,input().split()))

x=list[0]
a=list[1]
b=list[2]

if a>x:
    s=a-x
else:
    s=x-a

if b>x:
    t=b-x
else:
    t=x-b
    
if s<t:
    print('A')
else:
    print('B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = 0
a, b, c = (abs(int(i) - a) for i in input().split())
if b > c:
  print("B")
else:
  print("A")




Failing test case input:
10 0 9

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = (int(i) for i in input().split())
if abs(a-x) > abs(b-x):
  print("B")
else:
  print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
if x-a > b-x:
    print("B")
else:
    print("A")

Failing test case input:
1 156 0011

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
    print("B")
else:
    print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
d = int(b-a)
e = int(c-a)
if d < 0:
  d = -d

if e < 0:
  c = -c

if d > e:
  print("B")
else:
  print("A")


Failing test case input:
16 3 1

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
a,b,c=map(int,input().split())
d = int(b-a)
e = int(c-a)
if d < 0:
  d = -d

if e < 0:
  e = -e

if d > e:
  print("B")
else:
  print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b=input().split()
x=int(x)
a=int(a)
b=int(b)
if x<a:
 distance_xa=a-x
else:
 distance_xa=x-a

if x<b:
 distance_xb=b-x
else:
 distance_xb=x-b

if distance_xa>distance_xb:
 print("A")
else:
 print("B")

Failing test case input:
2 381 1110

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b=input().split()
x=int(x)
a=int(a)
b=int(b)
if x<a:
 distance_xa=a-x
else:
 distance_xa=x-a

if x<b:
 distance_xb=b-x
else:
 distance_xb=x-b

if distance_xa > distance_xb:
 print("B")
else:
 print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int, input().split())
if abs(x-a)>abs(x-b):
    print("A")
else:
    print("B")

Failing test case input:
10 2 7

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int, input().split())
if abs(x-a)<abs(x-b):
    print("A")
else:
    print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
A = abs(x-a)
B = abs(x-b)
print(min(A,B))

Failing test case input:
1 381 0110

Expected output:
B


Actual output:
109


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
A = abs(x-a)
B = abs(x-b)
if A<B:
  print("A")
else:
  print("B")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
def main():
  x, a, b = map(int, input().split())


  if abs(a-x) > abs(b-x):
    print('A')
    return
  print('B')

if __name__ == '__main__':
  main()

Failing test case input:
1 631 0110

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
def main():
  x, a, b = map(int, input().split())


  if abs(a-x) > abs(b-x):
    print('B')
    return
  print('A')

if __name__ == '__main__':
  main()

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a < 0:
  x_a = -x_a
elif x_b < 0:
  x_b = -x_b
print('A' if x_a < x_b else 'B')


Failing test case input:
16 3 0

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a < 0:
  x_a = -x_a
if x_b < 0:
  x_b = -x_b
print('A' if x_a <= x_b else 'B')

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
X, A, B = map(int, input().split())

print(min(abs(X-A), abs(B-X)))

Failing test case input:
1 999 0000

Expected output:
B


Actual output:
1


Fixed submission (verdict: Accepted):
X, A, B = map(int, input().split())
D = {abs(X-A):"A", abs(X-B):"B"}

print(D[min(abs(X-A), abs(B-X))])

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
n=input().rstrip().split()
n=[int(x) for x in n]

if abs(n[1]-n[0])>abs(n[2]-n[0]):
  print("A")
else:
  print("B")

Failing test case input:
4 217 1010

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
n=input().rstrip().split()
n=[int(x) for x in n]

if abs(n[1]-n[0])<abs(n[2]-n[0]):
  print("A")
else:
  print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

x,a,b = map(int,input().split())

a_distant = a - x
b_distant = b - x

if a_distant > b_distant:
    print("B")
if b_distant > a_distant:
    print("A")
else:
    print("false")

Failing test case input:
1 381 0110

Expected output:
B


Actual output:
B
false


Fixed submission (verdict: Accepted):
import math

x,a,b = map(int,input().split())


a_distant = a - x
b_distant = b - x
if a_distant < 0:
    a_distant = a_distant*(-1)
if b_distant < 0:
    b_distant = b_distant*(-1)

if a_distant > b_distant:
    print("B")
else:
    print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a < 0:
  x_a = -x_a
elif x_b < 0:
  x_b = -x_b
print('A' if x_a <= x_b else 'B')


Failing test case input:
16 3 0

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
x_a = a-x
x_b = b-x
if x_a < 0:
  x_a = -x_a
if x_b < 0:
  x_b = -x_b
print('A' if x_a <= x_b else 'B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
print(min(abs(x-a),abs(x-b)))

Failing test case input:
-1 13 0010

Expected output:
B


Actual output:
11


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
print("A" if abs(x-a) < abs(x-b) else "B")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())

if abs(a-x) > abs(b-x):
  print("A")
else:
  print("B")

Failing test case input:
0 0 1001

Expected output:
A


Actual output:
B


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

if abs(a-x) < abs(b-x):
  print("A")
else:
  print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
print('A' if abs(x-a)>abs(x-b) else 'B')

Failing test case input:
16 6 0

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
print('A' if abs(x-a)<abs(x-b) else 'B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b=map(int,input().split())
print(min(abs(x-a),abs(x-b)))

Failing test case input:
17 2 9

Expected output:
B


Actual output:
8


Fixed submission (verdict: Accepted):
x,a,b=map(int,input().split())
c=abs(x-a)
d=abs(x-b)
print('A' if c<d else 'B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = (int(i) for i in input().split())
da = abs(x-a)
db = abs(x-b)
if da > db:
  print('A')
else:
  print('B')

Failing test case input:
2 217 1011

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = (int(i) for i in input().split())
da = abs(x-a)
db = abs(x-b)
if da < db:
  print('A')
else:
  print('B')

Problem: p03623
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
x, a, b = map(int, input().split())
print('B' if abs(b-x) < abs(b-a) else 'A')

Failing test case input:
17 2 9

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
print('B' if abs(b-x) < abs(a-x) else 'A')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
xa = abs(x - a)
xb = abs(x - b)
if xa > xb:
    print("A")
else:
    print("B")


Failing test case input:
1 381 0111

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
xa = abs(x - a)
xb = abs(x - b)
if xa > xb:
    print("B")
else:
    print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

x,a,b=map(int,input().split())
if abs(x-a) > abs(x-b):
  print(b)
elif abs(x-a) < abs(x-b):
  print(a)

Failing test case input:
2 217 0010

Expected output:
B


Actual output:
10


Fixed submission (verdict: Accepted):

x,a,b=map(int,input().split())
if abs(x-a) > abs(x-b):
  print("B")
elif abs(x-a) < abs(x-b):
  print("A")

Problem: p03623
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
x, a, b = map(int, input().split())
if abs(x - a) < abs(a - b):
    print("A")
else:
    print("B")


Failing test case input:
1 999 1000

Expected output:
A

Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
if abs(x - a) < abs(x - b):
    print("A")
else:
    print("B")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b=map(int, input().split())
if abs(x-a)>abs(x-b):
  print("A")
else:
  print("B")

Failing test case input:
0 3 1001

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b=map(int, input().split())
if abs(x-a)<abs(x-b):
  print("A")
else:
  print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b=map(int,input().split())
print("A" if (a-x)<(b-x) else "B")

Failing test case input:
23 4 9

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b=map(int,input().split())
print("A" if abs((a-x))<abs((b-x)) else "B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
  print("A")
else:
  print("B")

Failing test case input:
1 999 0000

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x,a,b = map(int,input().split())
if abs(x-a) > abs(x-b):
  print("B")
else:
  print("A")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x,a,b = map(int, input().split())

if abs(x-a) < abs(x-b):
  print('a')
elif abs(x-a) > abs(x-b):
  print('b')

Failing test case input:
1 213 0010

Expected output:
B


Actual output:
b


Fixed submission (verdict: Accepted):
x,a,b = map(int, input().split())
 
if abs(x-a) < abs(x-b):
  print('A')
elif abs(x-a) > abs(x-b):
  print('B')

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from statistics import mean, median,variance,stdev
import sys
import math

a = input().split()


for i in range(len(a)):
    a[i] = int(a[i])



if a[2]-a[0] > a[1]-a[0]:
    print(a[1])
else: print(a[2])

Failing test case input:
1 999 0001

Expected output:
B


Actual output:
1


Fixed submission (verdict: Accepted):
from statistics import mean, median,variance,stdev
import sys
import math

a = input().split()


for i in range(len(a)):
    a[i] = int(a[i])



if abs(a[2]-a[0]) > abs(a[1]-a[0]):
    print("A")
else: print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = list(map(int,input().split()))
if abs(a - x) > abs(b - x):
  print("A")
else:
  print("B")

Failing test case input:
2 217 0011

Expected output:
B


Actual output:
A


Fixed submission (verdict: Accepted):
x, a, b = list(map(int,input().split()))
if abs(a - x) > abs(b - x):
  print("B")
else:
  print("A")
Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)
print("x = ", x)
print("a = ", a)
print("b = ", b)

if x < a:
    distance_xa = a - x
else:
    distance_xa = x - a
print("distance_xa = ", distance_xa)

if x < b:
    distance_xb = b - x
else:
    distance_xb = x - b
print("distance_xb = ", distance_xb)

if distance_xa < distance_xb:
    print("A")
else:
    print("B")


Failing test case input:
23 1 9

Expected output:
B


Actual output:
x =  23
a =  1
b =  9
distance_xa =  22
distance_xb =  14
B


Fixed submission (verdict: Accepted):
x, a, b = input().split()
x = int(x)
a = int(a)
b = int(b)
 
 
 

if x < a:
    distance_xa = a - x
else:
    distance_xa = x - a
 

if x < b:
    distance_xb = b - x
else:
    distance_xb = x - b
 

if distance_xa < distance_xb:
    print("A")
else:
    print("B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
print(min(abs(x-a), abs(x-b)))

Failing test case input:
1 25 1101

Expected output:
A


Actual output:
24


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
print("A" if abs(x-a) < abs(x-b) else "B")

Problem: p03623
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
x, a, b = map(int, input().split())
print(['B', 'A'][abs(x - a) > abs(x - b)])

Failing test case input:
2 381 1110

Expected output:
A


Actual output:
B


Fixed submission (verdict: Accepted):
x, a, b = map(int, input().split())
print(['A', 'B'][abs(x - a) > abs(x - b)])
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


def solve():
    N = int(input())
    Cs = input()

    ans = 0
    left, right = 0, N-1
    while left <= right:
        if Cs[left] == "W" and Cs[right] == "R":
            ans += 1  
            left, right = left+1, right-1
            continue
        elif Cs[left]=="W" and Cs[right]!="R":
            right -= 1
            if left == right: ans += 1  
            continue
        elif Cs[left]!="W" and Cs[right]=="R":
            left += 1
            continue
        else:
            left, right = left+1, right-1
            continue

    print(ans)


if __name__ == "__main__":
    solve()


Failing test case input:
8
RWRWWWRR

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):


def solve():
    N = int(input())
    Cs = input()

    ans = 0
    left, right = 0, N-1
    while left <= right:
        if Cs[left]=="W" and Cs[right]=="R":
            ans += 1  
            left, right = left+1, right-1
            continue
        elif Cs[left]=="W" and Cs[right]=="W":
            right -= 1
            continue
        elif Cs[left]=="R" and Cs[right]=="R":
            left += 1
            continue
        else:
            left, right = left+1, right-1
            continue


    print(ans)


if __name__ == "__main__":
    solve()

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())

c = list(input())

w_count = c.count("W")
r_count = c.count("R")

right_center = c[w_count:]
right_w_count = right_center.count("W")

if w_count >= r_count:
    print(w_count)
else:
    print(w_count - right_w_count)


Failing test case input:
8
RWRRWRWW

Expected output:
1


Actual output:
4


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

c = list(input())

w_count = c.count("W")
r_count = c.count("R")

right_center = c[r_count:]
right_w_count = right_center.count("W")

print(w_count - right_w_count)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
c = list(input())
w = 0
r = N-1
ans = 0
while w < r:
    f = 0
    for i in range(w,r+1):
        if c[i] == "W":
            w = i+1
            f += 1
            ans += 1
            break
    else:
        break
    for j in range(r,w-1,-1):
        if c[j] == "R":
            r = j-1
            if f == 0:
                ans += 1
            break
    else:
        break
print(ans)

Failing test case input:
8
RWRRWRWW

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
N = int(input())
c = list(input())
w = 0
r = N-1
ans = 0
while w < r:
    for i in range(w,r):
        if c[i] == "W":
            c[i] = "R"
            w = i
            break
    else:
        break
    for j in range(r,w,-1):
        if c[j] == "R":
            c[j] = "W"
            r = j
            break
    else:
        break
    ans += 1
print(ans)
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import collections
def main():
    N = int(input())
    S = list(input())
    if len(set(S))==1:
        print(0)
        return
    for i in range(N):
        
        if S[i] == 'W':
            break
    S = S[i:]
    
    cnt = 0
    left = 0
    right = len(S)-1
    while left<right:
        if S[left] == 'W':
            cnt +=1
            left += 1
            right -=1
        else:
            
            left += 1
            if S[left] == 'W':
                right -= 1
    print(cnt)
    return 0
if __name__ == "__main__":
    main()

Failing test case input:
4
RTWW

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import collections
def main():
    N = int(input())
    S = list(input())
    if len(set(S))==1:
        print(0)
        return
    cnt = 0
    left = 0
    right = len(S)-1
    while left<right:
        while left<len(S) and S[left]=='R':
            left += 1
        while right>=0 and S[right] == 'W':
            right -=1
        if left<right and S[left] == 'W':
            cnt +=1
            left += 1
            right -=1
    print(cnt)
    return 0
if __name__ == "__main__":
    main()

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())

C = input()

if N % 2 == 0:
  mid = N
else:
  mid = N

Wcount = C.count("W", 0, mid)
if C[mid-1] == "W":
  Wcount -= 1
print(Wcount)

Failing test case input:
8
RWRWWRRW

Expected output:
2


Actual output:
3


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

C = input()

if N % 2 == 0:
  mid = N
else:
  mid = N

Rcount = C.count("R")
rcount = C.count("R", 0, Rcount)
print(Rcount-rcount)

Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
C=input()
L=[0]*(n+1)
R=[0]*(n+1)
for i in range(n):
  if C[i]=="W":
    L[i+1]=L[i]+1
  else:
    L[i+1]=L[i]
  if C[n-1-i]=="R":
    R[n-i-1]=R[n-i]+1
  else:
    R[n-i-1]=R[n-i]
ans=n
for i in range(n):
  cur=max(L[i],R[i])
  ans=min(ans,cur)
print(ans)



Failing test case input:
2
RR

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
import sys
input=lambda: sys.stdin.readline().rstrip()
n=int(input())
C=input()
L=[0]*(n+1)
R=[0]*(n+1)
for i in range(n):
  if C[i]=="W":
    L[i+1]=L[i]+1
  else:
    L[i+1]=L[i]
  if C[n-1-i]=="R":
    R[n-i-1]=R[n-i]+1
  else:
    R[n-i-1]=R[n-i]
ans=n
for i in range(n+1):
  cur=max(L[i],R[i])
  ans=min(ans,cur)
print(ans)
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
c = list(input())
count = n
a = 0
b = 0

for i in range(n+1):
  if i == 0:
    a = c.count("R")
    ans = max(a, b)
    count = min(ans, count)
  else:
    a = a - c[0:i-1].count("R")
    b = b + c[0:i-1].count("W")
    ans = max(a, b)
    count = min(ans, count)
print(count)
 


Failing test case input:
8
WRWRWRRW

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
n = int(input())
c = list(input())
a = c.count("R")
b = 0
count = max(a, b)

for i in range(n):
  if c[i] == "R":
    a = a - 1
  else:
    b = b + 1
  ans = max(a, b)
  count = min(ans, count)
print(count)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from heapq import heappop,heappush
def main():
    N = int(input())
    S = input()
    W = []
    R = []
    ans = 0
    for i,s in enumerate(S):
        if s == 'W':
            W.append(i+1)
        else:
            R.append(-i-1)
    while (W and R):
        l = heappop(W)
        r = -heappop(R)
        if l < r:
            ans += 1

        else:
            break
    print(ans)



if __name__ == "__main__":
    main()

Failing test case input:
8
WRWRWRRW

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
from heapq import heappop,heappush
def main():
    N = int(input())
    S = input()
    W = []
    R = []
    ans = 0
    for i,s in enumerate(S):
        if s == 'W':
            heappush(W,i)
        else:
            heappush(R,-i)
    while (W and R):
        l = heappop(W)
        r = -heappop(R)
        if l < r:
            ans += 1
            heappush(W,r)
            heappush(R,-l)

        else:
            break
    print(ans)



if __name__ == "__main__":
    main()

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
from collections import Counter

n = ii()
s = input()

d = Counter(s)
num = d['R']
ans = num
wcnt = 0
rcnt = 0
for i in s:
    if i == 'W':
        wcnt += 1
    else:
        rcnt += 1
        if num-rcnt > wcnt or wcnt == 0:
            ans -= 1
            num -= wcnt
            wcnt = 0
        else:
            break
print(ans)

Failing test case input:
8
WRWRXWRR

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
from collections import Counter

n = ii()
s = input()

d = Counter(s)
num = d['R']
ans = num
wcnt = 0
rcnt = 0
for i in s:

    if i == 'W':
        wcnt += 1
    else:
        if num - 1 >= wcnt or wcnt == 0:
            ans -= 1
            num -= wcnt+1
            wcnt = 0
        if num == 0:
            break
print(ans)
Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
a=int(input())
b=input()
r_num=0
w_num=0
for i in b :

  if i=='W' :
    w_num+=1
  else :
    r_num+=1

count=0
if r_num<w_num :
  for i in range(r_num) :
    if b[i]=='R' :
      count+=1
else :
  for i in range(w_num) :
    if b[i]=='W' :
      count+=1
print(count)

Failing test case input:
8
WRRWXWRR

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
a=int(input())
b=input()
r_num=0
w_num=0
for i in b :

  if i=='W' :
    w_num+=1
  else :
    r_num+=1

count=0

for i in range(r_num) :
  if b[i]=='W' :
    count+=1


print(count)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N=int(input())
c=list(input())
print(c)
i=0
count1=0
count2=0
for i in c:
    if i=="R":
        count1+=1
for j in range(count1):
    if c[j]=="R":
        count2+=1
print(count1-count2)

Failing test case input:
4
RTWW

Expected output:
0


Actual output:
['R', 'T', 'W', 'W']
0


Fixed submission (verdict: Accepted):
N=int(input())
c=list(input())
i=0
count1=0
count2=0
for i in c:
    if i=="R":
        count1+=1
for j in range(count1):
    if c[j]=="R":
        count2+=1
print(count1-count2)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
c_array = list(input())

w_num = c_array.count('W')
r_num = n-w_num
def get_ans(half):
    wl_num = c_array[:half].count('W')
    rr_num = c_array[half:].count('R')

    if w_num == 0 or r_num == 0:
        ans = 0
    else:
        ans = min(wl_num, rr_num) + abs(wl_num-rr_num)
    return ans

ans = min(get_ans(w_num), w_num, r_num)
print(ans)

Failing test case input:
4
RRSW

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
c_array = list(input())

w_num = c_array.count('W')
r_num = n-w_num
def get_ans(half):
    wl_num = c_array[:half].count('W')
    rr_num = c_array[half:].count('R')
    ans = min(wl_num, rr_num) + abs(wl_num-rr_num)
    return ans

ans = min(get_ans(r_num), w_num, r_num)
print(ans)

Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

n = int(input())
s = input()

nowL = 0 
nowR = n-1 
ans = 0 

while(True):
    print(nowL,nowR)
    while(nowL < n-1):
        
        if(s[nowL]=='W'):
            break
        else:
            nowL+=1
    while(nowR > 0):
        
        if(s[nowR]=='R'):
            break
        else:
            nowR-=1
    if(nowR <= nowL):
        
        break
    
    nowL+=1
    nowR-=1
    ans+=1
    
    
print(ans)



Failing test case input:
2
RN

Expected output:
0


Actual output:
0 1
0


Fixed submission (verdict: Accepted):
n = int(input())
s = input()

nowL = 0 
nowR = n-1 
ans = 0 

while(True):
    while(nowL < n-1):
        
        if(s[nowL]=='W'):
            break
        else:
            nowL+=1
    while(nowR > 0):
        
        if(s[nowR]=='R'):
            break
        else:
            nowR-=1
    if(nowR <= nowL):
        
        break
    
    nowL+=1
    nowR-=1
    ans+=1
    
    
print(ans)
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
from collections import Counter

n = ii()
s = input()

d = Counter(s)
num = d['R']
ans = num
wcnt = 0
rcnt = 0
for i in s:
    if i == 'W':
        wcnt += 1
    else:
        if num - 1 > wcnt or wcnt == 0:
            ans -= 1
            num -= wcnt
            wcnt = 0
        else:
            break
print(ans)


Failing test case input:
8
RRWWRRWW

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
def ii():return int(input())
def iim():return map(int,input().split())
def iil():return list(map(int,input().split()))
from collections import Counter

n = ii()
s = input()

d = Counter(s)
num = d['R']
ans = num
wcnt = 0
rcnt = 0
for i in s:

    if i == 'W':
        wcnt += 1
    else:
        if num - 1 >= wcnt or wcnt == 0:
            ans -= 1
            num -= wcnt+1
            wcnt = 0
        if num == 0:
            break
print(ans)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import re
import sys

n = int(input())
c = list(input())

count_r = 0
for i in c:
    if i == 'R':
        count_r += 1
count_w = n - count_r
ans = min(count_r, count_w)
if ans == 0:
    print(0)
    sys.exit()



l = 0
r = n-1
count = 0

while l < r:
    while c[l] == 'R':
        l += 1
    while c[r] =='W':
        r -= 1
    c[l] = 'R'
    c[r] = 'W'
    count += 1
    
    if l == r-1:
        break

ans = min(count, ans)

print(ans)

Failing test case input:
8
WRWRVRRW

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import re
import sys

n = int(input())
c = list(input())

count_r = 0
for i in c:
    if i == 'R':
        count_r += 1
count_w = n - count_r
ans = min(count_r, count_w)
if ans == 0:
    print(0)
    sys.exit()

pattern = r"^R*W*$"


l = 0
r = n-1
count = 0

while l < r:
    while c[l] == 'R':
        l += 1
    while c[r] =='W':
        r -= 1
    if l >= r:
        break
    c[l] = 'R'
    c[r] = 'W'
    count += 1
    
    

ans = min(count, ans)

print(ans)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
l=list(map(str,input().split()))
c=list("".join(l))
w=c.count('W')
cc=c[-w:]
r=cc.count('R')
print(r)

Failing test case input:
2
RV

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n=int(input())
l=list(map(str,input().split()))
c=list("".join(l))
w=c.count('W')
cc=c[-w:]
r=cc.count('W')
print(w-r)
Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
s = int(input())
n = input()
str_list = list(n)
w_cnt = str_list.count('W')
r_cnt = str_list.count('R')
if w_cnt == 0 or r_cnt == 0:
    print(0)
else:
    w_result = str_list[w_cnt:]
    r_result = str_list[:r_cnt]
    r = w_result.count('R')
    w = r_result.count('W')
    if w <= r:
        print(r)
    else:
        print(w)


Failing test case input:
8
RRWRVRWW

Expected output:
1


Actual output:
2


Fixed submission (verdict: Accepted):
s = int(input())
n = input()
str_list = list(n)
w_cnt = str_list.count('W')
r_cnt = str_list.count('R')
if w_cnt == 0 or r_cnt == 0:
    print(0)
else:
    w_result = str_list[r_cnt:]
    r_result = str_list[:r_cnt]
    r = w_result.count('R')
    w = r_result.count('W')
    if w <= r:
        print(w)
    else:
        print(r)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
S = input()
n=0
if S.find("W")==-1 or S.find("R")==-1:
  print(0)
else:
  while S.find("W")<S.rfind("R"):
    S = S[S.find("W")+1:S.rfind("R")]
    n+=1
  print(n)

Failing test case input:
8
WWWRXRRR

Expected output:
3


Actual output:
4


Fixed submission (verdict: Accepted):
N = int(input())
S = input()
n=0
if S.find("W")==-1 or S.find("R")==-1:
  print(0)
else:
  while S.find("W")<S.rfind("R") and S.find("W")>=0:
    S = S[S.find("W")+1:S.rfind("R")]
    n+=1
  print(n)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
s = input()
res = 2000000 

ar=s.count('R')
pw=0
pr=0
for i in range(n-1):
	if (s[i] == 'R'):
		pr=pr+1
	else:
		pw=pw+1
	if (max(pw,ar-pr) < res):
		res = max(pw,ar-pr)

print(str(res))

Failing test case input:
2
RR

Expected output:
0

Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
s = input()
res = 2000000 
aw=s.count('W')
ar=s.count('R')
if (aw == 0 or ar == 0):
	res=0
pw=0
pr=0
for i in range(n-1):
	if (s[i] == 'R'):
		pr=pr+1
	else:
		pw=pw+1
	if (max(pw,ar-pr) < res):
		res = max(pw,ar-pr)

print(str(res))

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n = ni()
cs = input()
r = cs.count("R")
print(cs[:r].count("R"))


Failing test case input:
2
RO

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
ma = lambda :map(int,input().split())
ni = lambda:int(input())
yn = lambda fl:print("Yes") if fl else print("No")
import collections
import math
import itertools
import heapq as hq
n = ni()
cs = input()
r = cs.count("R")
print(cs[r:].count("R"))
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
N = int(input())
S = input()

ans = 0
W = -1
for i in range(N):
    if S[i] == "W":
        W = i
        break
if W == -1:
    print(ans)
    sys.exit()

R = N
for i in range(N-1,-1,-1):
    if S[i] == "R":
        R = i
        break
if R == N:
    print(ans)
    sys.exit()

ans += 1


while W < R:
    for i in range(W+1,R):
        if S[i] == "W":
            W = i
            break
    else:
        print(ans)
        sys.exit()
    
    for j in range(R-1, W, -1):
        if S[j] == "R":
            R =j 
            ans += 1
            break
    else:
        print(ans)
        sys.exit()
    
print(ans)

Failing test case input:
8
RRRRXWWW

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
import sys
N = int(input())
S = input()

ans = 0
W = -1
for i in range(N):
    if S[i] == "W":
        W = i
        break
if W == -1:
    print(ans)
    sys.exit()

R = N
for i in range(N-1,-1,-1):
    if S[i] == "R":
        R = i
        break
if R == N:
    print(ans)
    sys.exit()

if(R<=W):
    print(ans)
    sys.exit()

ans += 1

while True:
    flagW = False
    flagR = False

    for i in range(W+1,R):
        if S[i] == "W":
            W = i
            flagW = True
            break
    
    for j in range(R-1, W, -1):
        if S[j] == "R":
            R = j
            flagR = True
            break
    
    if flagW and flagR:
        ans += 1
        continue
    else:
        print(ans)
        sys.exit()

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
n = int(input())
c = list(input())
pos_w=0
pos_r=n-1
count = 0
for i in range(pos_w, n):
  if c[i] != 'W':
    continue
  pos_w = i
  for j in range(pos_r, -1, -1):
    if c[j] != 'R':
      continue
    pos_r = j
    if pos_w > pos_r:
      print(count)
      sys.exit()
    c[i] = 'R'
    c[j] = 'W'
    count += 1
    break

Failing test case input:
2
RU

Expected output:
0


Actual output:

Fixed submission (verdict: Accepted):
import sys
from collections import Counter
n = int(input())
c = list(input())
s = Counter(c)
if s['R'] == 0 or s['W'] == 0:
  print('0')
  sys.exit()
pos_w=0
pos_r=n-1
count = 0
for i in range(pos_w, n):
  if c[i] != 'W':
    continue
  pos_w = i
  for j in range(pos_r, -1, -1):
    if c[j] != 'R':
      continue
    pos_r = j
    if pos_w > pos_r:
      print(count)
      sys.exit()
    c[i] = 'R'
    c[j] = 'W'
    count += 1
    break

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
c = input()

r_num = c.count("R")

for i in range(n):
    if c[i] == "W":
        break

print(max(c[i:].count("R")-c[:r_num].count("R"), 0))


Failing test case input:
8
RWRWWRWR

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
c = input()

r_num = c.count("R")

for i in range(n):
    if c[i] == "W":
        break

print(max(c[i:].count("R")-c[i:r_num].count("R"), 0))
Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
c = list(input())
hrcnt = 0
rcnt = 0
for i in range(len(c)):
    if c[i]=='R':
        rcnt += 1
    if i+1<=len(c)/2 and c[i]=='R':
        hrcnt += 1
wcnt = len(c)-rcnt
if rcnt==len(c) or rcnt==0:
    ans = 0
elif rcnt<wcnt:
    ans = rcnt
elif rcnt>wcnt:
    ans = len(c)-rcnt
else:
    ans = rcnt-hrcnt

print(ans)

Failing test case input:
4
RQWW

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
n = int(input())
c = list(input())
hrcnt = 0
rcnt = 0
for i in range(len(c)):
    if c[i]=='R':
        rcnt += 1
for i in range(len(c)):
    if i+1<=rcnt and c[i]=='R':
        hrcnt += 1

wcnt = len(c)-rcnt
if rcnt==len(c) or rcnt==0:
    ans = 0
else:
    ans = rcnt-hrcnt

print(ans)

Problem: p02597
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
c = input()
d = c.count('w')
e = c[:d].count('w')
print(d-e)

Failing test case input:
8
RWRWWWRR

Expected output:
2


Actual output:
0


Fixed submission (verdict: Accepted):
n = int(input())
c = input()
d = c.count('R')
e = c[:d].count('R')
print(d-e)

Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
num = int(input())
wr = str(input())


r_num = wr.count("R")
i_counts = [r_num]

for i in range(num):
  rw_count = r_num
  wr_count = 0
  if wr[i] == "W":
    wr_count += 1
  else:
    rw_count -= 1
  i_count = abs(wr_count - rw_count)
  i_counts.append(i_count)

  ans = min(i_counts)

print(ans)

Failing test case input:
8
WRWRWRRW

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
num = int(input())
wr = str(input())

r_num = wr.count("R")
i_counts = [r_num]
rw_count = r_num
wr_count = 0
for i in range(num):
  if wr[i] == "W":
    wr_count += 1
  else:
    rw_count -= 1
  i_count = max(wr_count, rw_count)
  i_counts.append(i_count)

ans = min(i_counts)

print(ans)
Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    from itertools import groupby
    input = sys.stdin.readline

    N = int(input())
    S = input().rstrip('\n')

    G = groupby(S)
    WR = []
    for key, L in G:
        WR.append((key, len(list(L))))
    if WR[-1][0] == "W":
        WR.pop()
    if WR:
        if WR[0][0] == "R":
            WR = WR[1:]
    ans = 0
    tmp = 10**9
    for c, x in WR:
        if c == "W":
            tmp = x
        else:
            ans += min(tmp, x)
    print(ans)


if __name__ == '__main__':
    main()


Failing test case input:
4
WRVR

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    N = int(input())
    S = input().rstrip('\n')
    S = [s for s in S]

    l = 0
    r = N-1
    ans = 0
    while True:
        if l >= r:
            break
        if S[l] == "W" and S[r] == "R":
            S[l], S[r] = S[r], S[l]
            ans += 1
            l += 1
            r -= 1
        elif S[l] == "W" and S[r] == "W":
            r -= 1
        elif S[l] == "R" and S[r] == "R":
            l += 1
        else:
            l += 1
            r -= 1
    print(ans)


if __name__ == '__main__':
    main()

Problem: p02597
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
import math
import sys

def main():
    N=int(input())
    C=list(input())
    res=0
    for i in range(len(C)):
        if i>=1:
            if C[i]=="R" and C[i-1]=="W":
                res+=1
    print(res)


if __name__=="__main__":
    main()

Failing test case input:
8
RRWWWRRW

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
import math
import sys

def main():
    N=int(input())
    C=list(input())
    res=0
    
    R=0
    W=0
    for i in range(len(C)):
        if C[i]=="W":
            W+=1
        else:
            R+=1
    for i in range(len(C)):
        if i<R:
            if C[i]=="W":
                res+=1
    print(res)
if __name__=="__main__":
    main()