ZhenlongDai/ACPR huggingface dataset:
Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):

N = int(input())
A = list(map(int, input().split()))
s = 0
for a in A:
  s ^= a
ans = ""
for a in A:
  ans = str(s ^ a) + " " + ans
print(ans)

Failing test case input:
4
1 0 1 49

Expected output:
48 49 48 0


Actual output:
0 48 49 48 


Fixed submission (verdict: Accepted):

N = int(input())
A = list(map(int, input().split()))
s = 0
for a in A:
  s ^= a
ans = list()
for a in A:
  ans.append(s ^ a)
print(" ".join(map(str, ans)))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))

b = [0 for i in range(n)]

A = 0

for i in range(n):
  A = A ^ a[i]
  
for i in range(n):
  b[i] = A ^ a[i]

print(b)

Failing test case input:
4
1 0 1 49

Expected output:
48 49 48 0


Actual output:
[48, 49, 48, 0]


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

b = [0 for i in range(n)]

A = 0

for i in range(n):
  A = A ^ a[i]
  
for i in range(n):
  b[i] = A ^ a[i]

print(' '.join(map(str, b)))

Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
total = 0
for i in a[1:]:
    total ^= i

a[0] = total
print(*a)

Failing test case input:
4
74 1 -1 1

Expected output:
-1 -76 74 -76


Actual output:
-1 1 -1 1


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
total = 0
for i in a:
    total ^= i

ans = [0] * N
for i in range(N):
    ans[i] = total ^ a[i]

print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
S= 0
for n in range(N):
  S = S^A[n]
  print(S)
  
ans = ''
for n in range(N):
  m = S^A[n]
  ans += str(m) + ' '

print(ans)

Failing test case input:
4
2 -3 0 0

Expected output:
-3 2 -1 -1


Actual output:
2
-1
-1
-1
-3 2 -1 -1 


Fixed submission (verdict: Accepted):
import sys
N = int(sys.stdin.readline().rstrip())
A = list(map(int, sys.stdin.readline().rstrip().split()))
S= 0
for n in range(N):
  S = S^A[n]
  
ans = ''
for n in range(N):
  m = S^A[n]
  ans += str(m) + ' '

print(ans[:-1])

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))
sum_of_A = sum(A)
ans = []
for a in A:
    ans.append(sum_of_A^a)
print(" ".join(map(str, ans)))


Failing test case input:
4
1 11 0 49

Expected output:
58 48 59 10


Actual output:
60 54 61 12


Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
sum_of_A = A[0]
for a in A[1:]:
    sum_of_A ^= a
ans = []
for a in A:
    ans.append((sum_of_A)^a)
print(" ".join(map(str, ans)))
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = list(map(int, input().split()))
ans = []
s = 0
for i in range(N):
    s = s ^ a[i]

for i in range(N):
    tmp = s ^ a[i]
    ans.append(tmp)
    
print(ans)

Failing test case input:
4
1 -3 0 15

Expected output:
-14 14 -13 -4


Actual output:
[-14, 14, -13, -4]


Fixed submission (verdict: Accepted):
N = int(input())
a = list(map(int, input().split()))
ans = []
s = 0
for i in range(N):
    s = s ^ a[i]

for i in range(N):
    tmp = s ^ a[i]
    ans.append(str(tmp))
    
ans = ' '.join(ans)    
print(ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = map(int, input().split())
total = 0
for a in A:
  total ^= a
result = []
for a in A:
  result.append(total ^ a)
print(*result)

Failing test case input:
4
2 -3 0 0

Expected output:
-3 2 -1 -1


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
total = 0
for a in A:
  total ^= a
result = []
for a in A:
  result.append(total ^ a)
print(*result)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))

l = [20, 11, 9, 24]
total = 0
for i in l:
  total ^= i
ans=[]
for i in l:
  ans.append(total^i)
print(*ans)

Failing test case input:
4
16 -17 0 0

Expected output:
-17 16 -1 -1


Actual output:
26 5 7 22


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
total = 0
for i in a:
  total ^= i
ans=[]
for i in a:
  ans.append(total^i)
print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

s = 0
for i in range(N):
    s ^= A[i]
    print(s)
for i in range(N):
    ans = s^A[i]
    print(ans, end=" ")

Failing test case input:
4
6 -8 1 1

Expected output:
-8 6 -1 -1


Actual output:
6
-2
-1
-2
-8 6 -1 -1 

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

s = 0
for i in range(N):
    s ^= A[i]
for i in range(N):
    ans = s^A[i]
    print(ans, end=" ")

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = map(int, input().split())
total = 0
for a in A:
  total ^= a
result = []
for a in A:
  result.append(total ^ a)
print(result)

Failing test case input:
4
1 11 0 29

Expected output:
22 28 23 10


Actual output:

Fixed submission (verdict: Accepted):
N = int(input())
A = list(map(int, input().split()))
total = 0
for a in A:
  total ^= a
result = []
for a in A:
  result.append(total ^ a)
print(*result)
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

p = 0
for i in range(1, N):
    p ^= A[i]
print(p)

ans = [str(p)]
for i in range(1, N):
    t = A[i-1] ^ A[i]
    p = p ^ t
    ans.append(str(p))
print(" ".join(ans))


Failing test case input:
4
1 -3 0 15

Expected output:
-14 14 -13 -4


Actual output:
-14
-14 14 -13 -4


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

p = 0
for i in range(1, N):
    p ^= A[i]

ans = [str(p)]
for i in range(1, N):
    t = A[i-1] ^ A[i]
    p = p ^ t
    ans.append(str(p))
print(" ".join(ans))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
lis = list(map(int, input().split()))

s = 0
for i in lis:
    s = s^i
lis = list(map(lambda x: str(-(-s^x)), lis))
st = ' '.join(lis)
print(st)

Failing test case input:
4
12 -17 2 -1

Expected output:
18 -15 28 -31


Actual output:
18 -13 32 -29


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

s = 0
for i in lis:
    s = s^i
lis = list(map(lambda x: str(s^x), lis))
st = ' '.join(lis)
print(st)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A_list = [int(e) for e in input().split()]

all_A_xor = A_list[0]


for i in range(1,N):
    
    all_A_xor ^= A_list[i]



ans = [A^all_A_xor for A in A_list]
print(ans)

Failing test case input:
4
5 -12 1 0

Expected output:
-11 4 -15 -16


Actual output:
[-11, 4, -15, -16]


Fixed submission (verdict: Accepted):
N = int(input())
A_list = [int(e) for e in input().split()]

all_A_xor = A_list[0]


for i in range(1,N):
    
    all_A_xor ^= A_list[i]



ans = [A^all_A_xor for A in A_list]
print(' '.join(map(str, ans)))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
x = 0
for i in range(n):
    x = x^a[i]
print(x)
for i in range(n):
    print(x^a[i],end="")
    print(" ",end="")
print("")

Failing test case input:
4
5 -17 0 1

Expected output:
-18 4 -21 -22


Actual output:
-21
-18 4 -21 -22 


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
x = 0
for i in range(n):
    x = x^a[i]
for i in range(n):
    print(x^a[i],end="")
    print(" ",end="")
print("")

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(n):
    b ^= a[i]
ans = []
for i in range(n):
    ap = b ^ a[i]
    ans.append(ap)
print(*a)
print(*list(set(ans)))


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

Expected output:
23 -4 20 -23


Actual output:
1 -22 2 -1
-23 -4 20 23


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

print(*ans)
Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n=int(input())
arr=list(map(int,input().split()))
xors=0
for val in arr:
  xors^=val
ans=[]
for i in range(n):
  ans.append(xors^arr[i])
print(ans)

Failing test case input:
4
1 -1 3 20

Expected output:
-24 22 -22 -3


Actual output:
[-24, 22, -22, -3]


Fixed submission (verdict: Accepted):
n=int(input())
arr=list(map(int,input().split()))
xors=0
for val in arr:
  xors^=val
ans=[]
for i in range(n):
  ans.append(xors^arr[i])
print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))
ans = []
tmp = a[0]
for i in range(1,n):
    tmp = tmp^a[i]
for i in range(n):
    ans.append(tmp^a[i])
print(ans)

Failing test case input:
4
1 -1 0 15

Expected output:
-16 14 -15 -2


Actual output:
[-16, 14, -15, -2]


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int,input().split()))
ans = []
tmp = a[0]
for i in range(1,n):
    tmp = tmp^a[i]
ans = ''
for i in range(n):
    ans += str(int(tmp^a[i]))+' '
print(ans[:-1])

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from sys import stdin
input = stdin.readline

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

ans = []

for i in range(N - 1):
    ans.append(a[i] & a[i + 1])

ans.append(a[0] & a[N - 1])

print(*ans)


Failing test case input:
4
6 -17 2 2

Expected output:
-17 6 -21 -21


Actual output:
6 2 2 2


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

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

xor_all = 0

for a in A:
    xor_all = xor_all ^ a

ans = []

for a in A:
    ans.append(xor_all ^ a)

print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a_list = list(map(int, input().split()))
all_xor = 0
res = []

for a in a_list:
    all_xor ^= a

for a in a_list:
    res.append(a ^ all_xor)

print(res)


Failing test case input:
4
1 -22 2 2

Expected output:
-22 1 -23 -23


Actual output:
[-22, 1, -23, -23]


Fixed submission (verdict: Accepted):
N = int(input())
a_list = list(map(int, input().split()))
all_xor = 0
res = []

for a in a_list:
    all_xor ^= a

for a in a_list:
    res.append(a ^ all_xor)

print(*res)

Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
N = int(input())
a = list(map(int,input().split()))

tmp = 0
for i in a:
  tmp ^= i

ans = a[:]
for i in range(N):
  ans[i] ^= tmp
print(ans)

Failing test case input:
4
0 -22 2 1

Expected output:
-23 3 -21 -24


Actual output:
[-23, 3, -21, -24]


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

tmp = 0
for i in a:
  tmp ^= i

ans = a[:]
for i in range(N):
  ans[i] ^= tmp
print(*ans)
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
a = [int(i) for i in input().split()]
ans = []
for x in a:
    s = '1'*(len(str(x)))
    ans.append(x^int(s))
print(*ans)

Failing test case input:
4
0 -22 1 0

Expected output:
-21 1 -22 -21


Actual output:
1 -123 0 1


Fixed submission (verdict: Accepted):
N = int(input())
a = [int(i) for i in input().split()]
ans = []
s = 0
for x in a:
    s = s^x
for x in a:
    ans.append(x^s)
print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
N = int(input())
A = list(map(int, input().split()))

s = 0
for a in A:
	s ^= a
	print(s)
ans = []

for a in A:
	ans += [str(a ^ s)]
print(' ' .join(ans))

Failing test case input:
4
9 -17 0 0

Expected output:
-17 9 -26 -26


Actual output:
9
-26
-26
-26
-17 9 -26 -26


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

s = 0
for a in A:
	s ^= a
ans = []

for a in A:
	ans += [str(a ^ s)]
print(' ' .join(ans))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
wk=0
for i in range(0,n,2):
  wk^=a[i]^a[i+1]
ans=[]
for i in range(n):
  ans.append(str(wk^a[i]))
print(" ".join(list(set(ans))))

Failing test case input:
4
0 -22 2 1

Expected output:
-23 3 -21 -24


Actual output:
3 -21 -24 -23


Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
wk=0
for i in range(0,n,2):
  wk^=a[i]^a[i+1]
ans=[]
for i in range(n):
  ans.append(str(wk^a[i]))
print(" ".join(ans))

Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
totxor = reduce(lambda a, b: a^b, A, 0)
ans = []
for a in A:
    ans.append(totxor ^ a)
print(ans)

Failing test case input:
4
20 11 9 24

Expected output:
26 5 7 22

Actual output:
[26, 5, 7, 22]


Fixed submission (verdict: Accepted):
from functools import reduce
N = int(input())
A = list(map(int, input().split()))
totxor = reduce(lambda a, b: a^b, A, 0)
ans = []
for a in A:
    ans.append(str(totxor ^ a))
print(' '.join(ans))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
lis = list(map(int, input().split()))

t = lis[0]
for i in range(1, n):
    t ^= i

ans = [0] * n
for i , j in enumerate(lis):
    ans[i] = t ^ j

print(*ans)

Failing test case input:
4
74 1 -1 1

Expected output:
-1 -76 74 -76


Actual output:
0 75 -75 75


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

t = lis[0]
for i in range(1, n):
    t ^= lis[i]

ans = [0] * n
for i , j in enumerate(lis):
    ans[i] = t ^ j

print(*ans)
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int,input().split()))

a_xor = 0
for i in a:
    a_xor = a_xor^i

ans = []
for i in a:
    ans.append(a_xor^i)
print(ans, end="")

Failing test case input:
4
1 -3 0 15

Expected output:
-14 14 -13 -4


Actual output:
[-14, 14, -13, -4]

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

a_xor = 0
for i in a:
    a_xor = a_xor^i

ans = []
for i in a:
    ans.append(a_xor^i)

for i in ans:
    print(i, end=" ")

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))
ans=[]
b=a.copy()
del b[0]
a1=0
for i in b:
    a1=a1^i
ans.append(a1)
for i in b:
    ansi=a1^i
    ans.append(ansi)

for i in range(n):
    print(ans[i],end=' ')

Failing test case input:
4
74 0 -2 -3

Expected output:
3 73 -73 -76


Actual output:
3 3 -3 -2 

Fixed submission (verdict: Accepted):
n=int(input())
a=list(map(int,input().split()))
ans=[]
b=a.copy()
del b[0]
a1=0
a2=a[0]
for i in b:
    a1=a1^i
ans.append(a1)
for i in b:
    ansii=a1^i
    ansi=a2^ansii
    ans.append(ansi)

for i in range(n):
    print(ans[i],end=' ')

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [None] * n
    for i in range(n - 1):
        allxor = a[i] ^ a[i + 1]
    for i in range(n):
        ans[i] = allxor ^ a[i]
    print(*ans)


if __name__ == "__main__":
    main()


Failing test case input:
4
6 -17 2 2

Expected output:
-17 6 -21 -21


Actual output:
6 -17 2 2


Fixed submission (verdict: Accepted):


def main():
    n = int(input())
    a = list(map(int, input().split()))
    ans = [None] * n
    allxor = 0
    for i in range(n):
        allxor ^= a[i]
    for i in range(n):
        ans[i] = allxor ^ a[i]
    print(*ans)


if __name__ == "__main__":
    main()

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n=int(input())
a=list(map(int,input().split()))

X=[]
b=a[0]
for i in range(1,n) :
    b^=a[i]

for i in range(n) :
    x=b^a[i]
    X.append(x)

print(X)


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

Expected output:
23 -4 20 -23


Actual output:
[23, -4, 20, -23]


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

X=[]
b=a[0]
for i in range(1,n) :
    b^=a[i]

for i in range(n) :
    x=b^a[i]
    X.append(x)

for i in X :
    print(i,end=" ")
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()

print(*a)

Failing test case input:
4
6 -17 2 0

Expected output:
-19 4 -23 -21


Actual output:
6 -17 2 0


Fixed submission (verdict: Accepted):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

n = ni()
a = na()
b = 0
for i in a:
    b ^= i

for i in range(n):
    a[i] ^= b

print(*a)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
b = 0
for i in range(n):
    b ^= a[i]
ans = []
for i in range(n):
    ap = b ^ a[i]
    ans.append(ap)

print(*list(set(ans)))


Failing test case input:
4
1 -3 0 15

Expected output:
-14 14 -13 -4


Actual output:
-14 -13 -4 14


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

print(*ans)

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
aa = map(int,input().split())
x = 0
for a in aa:
  x^=a
print(" ".join(str(x^a) for a in aa ))

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

Expected output:
23 -4 20 -23


Actual output:

Fixed submission (verdict: Accepted):
n = int(input())
aa = list(map(int,input().split()))
x = 0
for a in aa:
  x^=a
print(" ".join([str(x^a) for a in aa ]))

Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in range(1, n):
  x = x^a[i]
  
l = [x]
for i in range(n-1):
  x = a[i]^a[i+1]
  l.append(l[i]^x)
print(l)



Failing test case input:
4
102 2 -1 1

Expected output:
-4 -104 101 -101


Actual output:
[-4, -104, 101, -101]


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
x = 0
for i in range(1, n):
  x = x^a[i]
  
l = [x]
for i in range(n-1):
  x = a[i]^a[i+1]
  l.append(l[i]^x)
print(*l)

Problem: p02631
Buggy submission (PyPy3 (7.3.0), verdict: Wrong Answer):
n = int(input())
a = list(map(int, input().split()))
lis = []
for i in range(n-1):
    lis.append(a[i]^a[i+1])
ans = [26]
for i in range(n-1):
    ans.append(ans[i]^lis[i])
for i in range(len(ans)):
    ans[i] = str(ans[i])
print(" ".join(ans))

Failing test case input:
4
93 2 -1 2

Expected output:
-1 -96 93 -96


Actual output:
26 69 -72 69


Fixed submission (verdict: Accepted):
n = int(input())
a = list(map(int, input().split()))
all = 0
for i in range(n):
    all = all^a[i]
ans = []
for i in range(n):
    ans.append(all^a[i])
for i in range(n):
    ans[i] = str(ans[i])
print(" ".join(ans))
Problem: p02631
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from functools import reduce

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

tot_xor = reduce(lambda x, y: x ^ y, [20, 11, 9, 24])
print(" ".join(list(map(str, [tot_xor ^ i for i in arr]))))

Failing test case input:
4
6 -17 1 0

Expected output:
-18 7 -23 -24


Actual output:
8 -31 15 14


Fixed submission (verdict: Accepted):
from functools import reduce

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

tot_xor = reduce(lambda x, y: x ^ y, arr)
print(" ".join(list(map(str, [tot_xor ^ i for i in arr]))))

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

input = sys.stdin.readline


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

    init = 0
    for a in A:
        init ^=a
    print(init)
    for a in A:
        print(init^a,end=" ")

if __name__ == "__main__":
    main()

Failing test case input:
4
6 -8 2 1

Expected output:
-5 5 -1 -4


Actual output:
-3
-5 5 -1 -4 

Fixed submission (verdict: Accepted):
import sys

input = sys.stdin.readline


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

    init = 0
    for a in A:
        init ^=a
    for a in A:
        print(init^a,end=" ")

if __name__ == "__main__":
    main()
Problem: p02359
Buggy submission (Python3, verdict: Wrong Answer):
from itertools import accumulate

n, t = map(int, input().split())
a = [0] * (t + 2)
for l, r in (map(int, input().split()) for _ in range(n)):
    a[l] += 1
    a[r + 1] -= 1
print(max(accumulate(a)))

Failing test case input:
1 17
0 0
1 3
0 8
3 11
3 10
5 21

Expected output:
0


Actual output:
1


Fixed submission (verdict: Accepted):
from itertools import accumulate

n, t = map(int, input().split())
a = [0] * (t + 1)
for l, r in (map(int, input().split()) for _ in range(n)):
    a[l] += 1
    a[r] -= 1
print(max(accumulate(a)))
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline







S = input().strip()

q = deque(S)
c = 0
while len(q):
     l = q[0]
     r = q[len(q)-1]

     if l == r:
          if len(q) != 1:
               q.pop()
          q.popleft()
     elif l == 'x':
          q.append('x')
          c += 1
     elif r == 'x':
          q.appendleft('x')
          c += 1
     else:
          print(-1)
          break

print(c)

Failing test case input:
cb`xx

Expected output:
-1


Actual output:
-1
2


Fixed submission (verdict: Accepted):
import sys
from collections import defaultdict, deque
import bisect
from heapq import *
from math import factorial
sys.setrecursionlimit(200000)
input = sys.stdin.readline







S = input().strip()

q = deque(S)
c = 0
while len(q):
     l = q[0]
     r = q[len(q)-1]

     if l == r:
          if len(q) != 1:
               q.pop()
          q.popleft()
     elif l == 'x':
          q.append('x')
          c += 1
     elif r == 'x':
          q.appendleft('x')
          c += 1
     else:
          print(-1)
          exit()

print(c)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S=input()
n=len(S)
l=0
r=n-1
ans=0
while l+1<=r:
    if S[l]=='x' and S[l]!=S[r]:
        ans+=1
        l+=1
    elif S[r]=='x' and S[l]!=S[r]:
        ans+=1
        r-=1
    elif S[l]==S[r]:
        r-=1
        l+=1
    else:
        ans-=1
        break
print(ans)





Failing test case input:
xb`xc

Expected output:
-1


Actual output:
0


Fixed submission (verdict: Accepted):
S=input()
n=len(S)
l=0
r=n-1
ans=0
while l+1<=r:
    if S[l]=='x' and S[l]!=S[r]:
        ans+=1
        l+=1
    elif S[r]=='x' and S[l]!=S[r]:
        ans+=1
        r-=1
    elif S[l]==S[r]:
        r-=1
        l+=1
    else:
        ans=-1
        break
print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()

cnt=0
while len(s)>1:
    if s[0]==s[-1]:
        s= s[1:-1]
    elif s[0]=="x" and s[-1]!="x":
        s = s[1:]
        cnt +=1
    elif s[-1]=="x" and s[0]!="x":
        s = s[:-1]
        cnt +=1
    else:
        cnt=0
        break
print(cnt)

Failing test case input:
cybx^

Expected output:
-1


Actual output:
0


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

cnt=0
while len(s)>1:
    if s[0]==s[-1]:
        s= s[1:-1]
    elif s[0]=="x" and s[-1]!="x":
        s = s[1:]
        cnt +=1
    elif s[-1]=="x" and s[0]!="x":
        s = s[:-1]
        cnt +=1
    else:
        cnt=-1
        break
print(cnt)
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
s = input()
ans = 0
while len(s)>= 2:
  if s[0] == s[-1]:
    s = s[1:-1]
  elif s[0] == 'x':
    ans += 1
    s = s[1:]
  elif s[-1] == 'x':
    ans += 1
    s = s[:-2]
  else:
    print(-1)
    sys.exit()
print(ans)

Failing test case input:
oxyx

Expected output:
-1


Actual output:
2


Fixed submission (verdict: Accepted):
import sys
s = input()
ans = 0
while len(s)>= 2:
  if s[0] == s[-1]:
    s = s[1:-1]
  elif s[0] == 'x':
    ans += 1
    s = s[1:]
  elif s[-1] == 'x':
    ans += 1
    s = s[:-1]
  else:
    print(-1)
    sys.exit()
print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
s = (stdin.readline().rstrip())
l = 0
r = 1
ans = 0
exit = (len(s)+1)
for i in range(len(s)):
    if s[l] == s[-r]:
        l += 1
        r += 1

    elif s[l] == "x" and s[-r] != "x":
        ans += 1
        l += 1

    elif s[l] != "x" and s[-r] == "x":
        ans += 1
        r += 1

    else:
        ans = -1
        break

    if l == r == exit:
        break

print(ans)

Failing test case input:
axbax

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
from sys import stdin
s = (stdin.readline().rstrip())
l = 0
r = 1
ans = 0

for i in range(len(s)):

    if l+r > len(s):
        break

    if s[l] == s[-r]:
        l += 1
        r += 1

    elif s[l] == "x" and s[-r] != "x":
        ans += 1
        l += 1

    elif s[l] != "x" and s[-r] == "x":
        ans += 1
        r += 1

    else:
        ans = -1
        break

print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i <= len(S)-1 and j <= len(S)-1:
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)


Failing test case input:
bxbbx

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
S = list(input())
invS = []
for s in reversed(S):
    invS.append(s)
cnt = 0
loop = 0
i,j = 0,0
while i+j < len(S)-1 and i <= len(S)-1 and j <= len(S)-1 :
    if S[i] == invS[j]:
        i += 1
        j += 1
    elif S[i] == "x":
        cnt += 1
        i += 1
    elif invS[j] == "x":
        cnt += 1
        j += 1
    else:
        cnt = -1
        break
print(cnt)
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from collections import deque
S = input()
q = deque(S)
print(q)
c = 0
while len(q):
  l = q[0]
  r = q[len(q)-1]
  if l == r:
    if len(q) != 1:
      q.pop()
    q.popleft()
  elif l == 'x':
    q.append('x')
    c += 1
  elif r == 'x':
    q.appendleft('x')
    c += 1
  else:
    print(-1)
    exit()
print(c)


Failing test case input:
xwox

Expected output:
-1


Actual output:
deque(['x', 'w', 'o', 'x'])
-1


Fixed submission (verdict: Accepted):
from collections import deque
S = input()
q = deque(S)
c = 0
while len(q):
  l = q[0]
  r = q[len(q)-1]
  if l == r:
    if len(q) != 1:
      q.pop()
    q.popleft()
  elif l == 'x':
    q.append('x')
    c += 1
  elif r == 'x':
    q.appendleft('x')
    c += 1
  else:
    print(-1)
    exit()
print(c)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
cnt = 0
while len(s) > 0:
    if s[0] == s[-1]:
        s = s[1:-2]
    else:
        if s[0] == 'x':
            s += 'x'
            cnt += 1
        if s[-1] == 'x':
            s = 'x' + s
            cnt += 1
        if s[0] != 'x' and s[-1] != 'x':
            print(-1)
            exit()
print(cnt)

Failing test case input:
xb`xc

Expected output:
-1


Actual output:
2


Fixed submission (verdict: Accepted):
s = input()
cnt = 0
l = 0
r = len(s) - 1
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    elif s[l] == 'x':
        l += 1
        cnt += 1
    elif s[r] == 'x':
        r -= 1
        cnt += 1
    else:
        print(-1)
        exit()
print(cnt)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
n = len(s)

sr = s.replace("x", "")

if sr != "".join(reversed(sr)):
    print(-1)
else:
    ans = 0
    l = 0
    r = -1
    while l < n and -r <= n:
        if s[l] == s[r]:
            l += 1
            r -= 1
            continue
        elif s[l] == "x" and s[r] != "x":
            ans += 1
            l += 1
        elif s[l] != "x" and s[r] == "x":
            ans += 1
            r -= 1
    print(ans)


Failing test case input:
bxbbx

Expected output:
2


Actual output:
3


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

sr = s.replace("x", "")

if sr != "".join(reversed(sr)):
    print(-1)
else:
    ans = 0
    l = 0
    r = -1
    while l - r < n:
        if s[l] == s[r]:
            l += 1
            r -= 1
            continue
        elif s[l] == "x" and s[r] != "x":
            ans += 1
            l += 1
        elif s[l] != "x" and s[r] == "x":
            ans += 1
            r -= 1
        
    print(ans)
Problem: p03569
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
from collections import deque

s = deque(list(input()))

ans = 0
while len(s) > 1:
    l = s.popleft()
    r = s.pop()
    if l == r:
        continue
    elif l == 'x':
        ans += 1
        s.append(r)
    elif r == 'x':
        ans += 1
        s.append(l)
    else:
        print(-1)
        exit()

print(ans)
        

Failing test case input:
bb`xx

Expected output:
-1


Actual output:
2


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

s = deque(list(input()))

ans = 0
while len(s) > 1:
    l = s.popleft()
    r = s.pop()
    if l == r:
        continue
    elif l == 'x':
        ans += 1
        s.append(r)
    elif r == 'x':
        ans += 1
        s.appendleft(l)
    else:
        print(-1)
        exit()

print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
d=s.replace("x","")
rd=d[::-1]
if d!=rd:print(-1)
else:
    ans=0
    x,y=0,len(s)-1
    while x<y:
        if s[x]==s[y]:x+=1;y-=1
        if s[x]=="x":ans+=1;x+=1
        else:ans+=1;y-=1
    print(ans)

Failing test case input:
xxbbb

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
s=input()
d=s.replace("x","")
rd=d[::-1]
if d!=rd:print(-1)
else:
    ans=0
    x,y=0,len(s)-1
    while y-x>0:
        if s[x]==s[y]:
            x+=1;y-=1
        elif s[x]=="x":
            ans+=1;x+=1
        else:
            ans+=1;y-=1
    print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
s_exit_x=''
ans = 0
for n,i in enumerate(s):
    if i !='x':
        s_exit_x += i
if s_exit_x != s_exit_x[::-1]:
    print(-1)
else:
    left=0
    right=len(s)-1
    while left < right:
        if s[left] == s[right]:
            left += 1
            right -=1
        elif s[left]=="x":
            left += 1
            ans += 1
        else:
            right -=1
            ans += 1
print(ans)

Failing test case input:
oxxy

Expected output:
-1


Actual output:
-1
0


Fixed submission (verdict: Accepted):
s=input()
s_exit_x=''
ans = 0
for n,i in enumerate(s):
    if i !='x':
        s_exit_x += i
if s_exit_x != s_exit_x[::-1]:
    print(-1)
else:
    left=0
    right=len(s)-1
    while left < right:
        if s[left] == s[right]:
            left += 1
            right -=1
        elif s[left]=="x":
            left += 1
            ans += 1
        else:
            right -=1
            ans += 1
    print(ans)
Problem: p03569
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
s = input()

core = []

for c in s:
    if c != 'x':
        core.append(c)
if core == []:
    print(0)
    exit()
l = 0
r = len(core) - 1

while l <= r:
    if core[l] != core[r]:
        print(-1)
        exit()
    l += 1
    r -= 1

ans = 0
l = 0
r = len(s) - 1

while l <= r:
    print(l, r)
    lx = 0
    rx = 0
    while s[l] == 'x':
        l += 1
        lx += 1
    while s[r] == 'x':
        r -= 1
        rx += 1
    ans += abs(lx - rx)
    l += 1
    r -= 1
print(ans)


Failing test case input:
bxbbx

Expected output:
2


Actual output:
0 4
1 2
2


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

core = []

for c in s:
    if c != 'x':
        core.append(c)
if core == []:
    print(0)
    exit()
l = 0
r = len(core) - 1

while l <= r:
    if core[l] != core[r]:
        print(-1)
        exit()
    l += 1
    r -= 1

ans = 0
l = 0
r = len(s) - 1

while l <= r:
    lx = 0
    rx = 0
    while s[l] == 'x':
        l += 1
        lx += 1
    while s[r] == 'x':
        r -= 1
        rx += 1
    ans += abs(lx - rx)
    l += 1
    r -= 1
print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
S = input()
S2 = "".join([s for s in S if s != "x"])

if S2 != S2[::-1]:
    print(-1)
    exit()

A = []
cnt = 0
for s in S:
    if s != "x":
        A.append(cnt)
        cnt = 0
    else:
        cnt += 1
A.append(cnt)

X = max(A)
ans = sum([X-a for a in A])
print(ans)


Failing test case input:
tpxt

Expected output:
1


Actual output:
3


Fixed submission (verdict: Accepted):
S = input()
S2 = "".join([s for s in S if s != "x"])

if S2 != S2[::-1]:
    print(-1)
    exit()

A = []
cnt = 0
for s in S:
    if s != "x":
        A.append(cnt)
        cnt = 0
    else:
        cnt += 1
A.append(cnt)

ans = 0
for i in range(len(A) 
    ans += abs(A[i] - A[-i-1])
print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from sys import stdin
s = (stdin.readline().rstrip())
l = 0
r = 1
ans = 0
exit = (len(s)+1)
for i in range(len(s)):
    if s[l] == s[-r]:
        l += 1
        r += 1

    elif s[l] == "x" and s[-r] != "x":
        ans += 1
        l += 1

    elif s[l] != "x" and s[-r] == "x":
        ans += 1
        r += 1

    else:
        ans = -1
        break

    if l == (r-1) == exit:
        break

print(ans)

Failing test case input:
xabxa

Expected output:
2

Actual output:
3


Fixed submission (verdict: Accepted):
from sys import stdin
s = (stdin.readline().rstrip())
l = 0
r = 1
ans = 0

for i in range(len(s)):

    if l+r > len(s):
        break

    if s[l] == s[-r]:
        l += 1
        r += 1

    elif s[l] == "x" and s[-r] != "x":
        ans += 1
        l += 1

    elif s[l] != "x" and s[-r] == "x":
        ans += 1
        r += 1

    else:
        ans = -1
        break

print(ans)
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = list(str(input()))
l = 0
n = len(s)-1
ans = 0
for i in range(len(s)):
    if(s[l] == s[n] and l <= n):
        l += 1
        n -= 1
    elif(s[l] == 'x' and l <= n):
        l += 1
        ans += 1
    elif(s[n] == 'x' and l <= n):
        n -= 1
        ans += 1
    elif(s[l] != 'x' and s[n] != 'x'):
        ans = -1
        break
print(ans)

Failing test case input:
xxbbb

Expected output:
2


Actual output:
-1


Fixed submission (verdict: Accepted):
s = list(str(input()))
l = 0
n = len(s)-1
ans = 0
while l < n:
    if(s[l] == s[n]):
        l += 1
        n -= 1
    elif(s[l] == 'x'):
        l += 1
        ans += 1
    elif(s[n] == 'x'):
        n -= 1
        ans += 1
    elif(s[l] != 'x' and s[n] != 'x'):
        ans = -1
        break
print(ans)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s=input()
l=0
r=len(s)-1
x=0
while l<r:
  if s[l]==s[r]:
    l+=1
    r-=1
  elif s[l]=='x':
    x+=1
    l+=1
  elif s[l]=='x':
    x+=1
    r-=1
  else:
    x=-1
    break
print(x)

Failing test case input:
oxxx

Expected output:
3

Actual output:
-1


Fixed submission (verdict: Accepted):
s=input()
l=0
r=len(s)-1
x=0
while l<r:
  if s[l]==s[r]:
    l+=1
    r-=1
  elif s[l]=='x':
    x+=1
    l+=1
  elif s[r]=='x':
    x+=1
    r-=1
  else:
    x=-1
    break
print(x)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
ans = 0
r = 0
l = len(s)-1
while r < l:
  if s[r] == s[l]:
    r += 1
    l -= 1
  elif s[r] == "x":
    ans += 1
    r += 1
  elif s[l] == "x":
    ans += 1
    l -= 1
  else:
    print(-1)
    exit()

print(r)

Failing test case input:
xxbbb

Expected output:
2


Actual output:
3


Fixed submission (verdict: Accepted):
import sys
stdin = sys.stdin
sys.setrecursionlimit(10**6)
ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
nn = lambda: list(stdin.readline().split())
ns = lambda: stdin.readline().rstrip()

s = ns()
ans = 0
r = 0
l = len(s)-1
while r < l:
  if s[r] == s[l]:
    r += 1
    l -= 1
  elif s[r] == "x":
    ans += 1
    r += 1
  elif s[l] == "x":
    ans += 1
    l -= 1
  else:
    print(-1)
    exit()

print(ans)
Problem: p03569
Buggy submission (Python (3.8.2), verdict: Wrong Answer):
A=list(input())
from collections import deque
A=deque(A)
cnt=0
while len(A)>1:
   if A[0]==A[-1]:
      A.pop()
      A.popleft()
   elif (A[0]!="x" and A[-1]=="x" ):
      cnt+=1
      A.pop()
   elif (A[0]=="x" and A[-1]!="x" ):
      cnt+=1
      A.popleft()
   else:
      print(-1,A)
      exit()
print(cnt)

Failing test case input:
zzxo

Expected output:
-1


Actual output:
-1 deque(['z', 'z', 'x', 'o'])


Fixed submission (verdict: Accepted):
A=list(input())
from collections import deque
A=deque(A)
cnt=0
while len(A)>1:
   if A[0]==A[-1]:
      A.pop()
      A.popleft()
   elif (A[0]!="x" and A[-1]=="x" ):
      cnt+=1
      A.pop()
   elif (A[0]=="x" and A[-1]!="x" ):
      cnt+=1
      A.popleft()
   else:
      print(-1)
      exit()
print(cnt)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

count = 0
left, right = 0, len(s)-1
for i in range(100):
    if s[left] == s[right]:
        left, right = left+1, right-1
    elif s[left] == 'x':
        left = left+1
        count += 1
    elif s[right] == 'x':
        right = right-1
        count += 1
    else :
        count = -1
        break
    if left >= right:
        break

Failing test case input:
xxwo

Expected output:
-1


Actual output:

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

count = 0
left, right = 0, len(s)-1
while True:
    if s[left] == s[right]:
        left, right = left+1, right-1
    elif s[left] == 'x':
        left = left+1
        count += 1
    elif s[right] == 'x':
        right = right-1
        count += 1
    else :
        count = -1
        break
    if left >= right:
        break
print(count)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()

ans = 0
l = 0
r = len(s) - 1
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    elif s[l] == 'x':
        l += 1
        ans += 1
    elif s[r] == 'x':
        r -= 1
        ans += 1
    else:
        ans -= 1
        break
    
print(ans)


Failing test case input:
xx`cc

Expected output:
-1


Actual output:
1


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

ans = 0
l = 0
r = len(s) - 1
while l < r:
    if s[l] == s[r]:
        l += 1
        r -= 1
    elif s[l] == 'x':
        l += 1
        ans += 1
    elif s[r] == 'x':
        r -= 1
        ans += 1
    else:
        ans = -1
        break

print(ans)

Problem: p03569
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
s=input()
baks=s[:]
s="".join(list(filter(lambda x:x!="x",s)))
revs="".join(list(reversed(s)))
i=0 
j=len(s)-1
ans=0
while i<=j:
  if s[i]==s[j]:
    i+=1
    j-=1
  elif s[i]=="x":
    ans+=1
    i+=1
  elif s[j]=="x":
    ans+=1
    j-=1
  else:  break
if i <=j :
  print(-1)
  exit(0) 
else: print(ans)
  

  

Failing test case input:
xxxo

Expected output:
3


Actual output:
0


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

i=0 
j=len(s)-1
ans=0
while i<=j:
  if s[i]==s[j]:
    i+=1
    j-=1
  elif s[i]=="x":
    ans+=1
    i+=1
  elif s[j]=="x":
    ans+=1
    j-=1
  else:  break
if i <=j :
  print(-1)
  exit(0) 
else: print(ans)
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
invs = s[::-1]
s = s


i=0
j=0
ans = 0 
while i<len(s) and j<len(s):
  if s[i]==invs[j]:
    i+=1
    j+=1
  elif s[i]=='x':
    i+=1
  elif invs[j]=='x':
    
    j+=1
    ans+=1
  else:
    print(-1)
    break
else:
  if i==j:
    print(ans)
  elif i>j and invs[j]=='x':
    print(ans+1)
  elif i<j and s[i]=='x':
    print(ans)
  else:
    print(-1)

Failing test case input:
xxxo

Expected output:
3


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
invs = s[::-1]
s = s


i=0
j=0
ans = 0 
while i<len(s) and j<len(s):
  if s[i]==invs[j]:
    i+=1
    j+=1
  elif s[i]=='x':
    i+=1
  elif invs[j]=='x':
    
    j+=1
    ans+=1
  else:
    print(-1)
    break
else:
  if i==j:
    print(ans)
  elif i>j and all([c=='x' for c in invs[j:]]):
    print(ans+i-j)
  elif i<j and all([c=='x' for c in s[i:]]):
    print(ans)
  else:
    print(-1)

Problem: p03569
Buggy submission (PyPy3 (2.4.0), verdict: Wrong Answer):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    ss = ""
    for i in s:
        if i != "x":
            ss += i

    if ss != ss[::-1]:
        print(-1)
    else:
        cnt = 0
        cnt_x = [0] * (len(ss) + 1)
        pos = 0
        for i in range(len(s)):
            if s[i] not in set(ss):
                cnt += 1

            if s[i] in set(ss) or i == len(s) - 1:
                cnt_x[pos] = cnt
                cnt = 0
                pos += 1

        res = max(cnt_x) * len(cnt_x) - sum(cnt_x)
        print(res)


if __name__ == '__main__':
    resolve()


Failing test case input:
xxbbb

Expected output:
2


Actual output:
6


Fixed submission (verdict: Accepted):
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    s = input()
    ss = []
    for i in s:
        if i != "x":
            ss.append(i)

    if ss != ss[::-1]:
        print(-1)
    else:
        n = len(ss) + 1
        cnt = 0
        cnt_x = [0] * (n)
        pos = 0
        for i in range(len(s)):
            if s[i] == "x":
                cnt += 1

            if s[i] != "x" or i == len(s) - 1:
                cnt_x[pos] = cnt
                cnt = 0
                pos += 1

        res = 0
        for i in range(n 
            res += abs(cnt_x[i] - cnt_x[-(i + 1)])

        print(res)


if __name__ == '__main__':
    resolve()
Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):

s=list(input())


l=0
r=len(s)-1

count=0
while True:
    
    if s[l]!=s[r]:
        if s[l]=="x":
            
            l+=1
        elif s[r]=="x":
            
            r-=1
            l+=1
        else:
            res=-1
            break

        


        count+=1
    else:
        r-=1
        l+=1

    if l>=r:
        res=count
        break


print(res)


Failing test case input:
owxx

Expected output:
-1


Actual output:
2


Fixed submission (verdict: Accepted):

s=list(input())


l=0
r=len(s)-1

count=0
while True:
    
    if s[l]!=s[r]:
        if s[l]=="x":
            
            l+=1
        elif s[r]=="x":
            
            r-=1
            
        else:
            res=-1
            break

        


        count+=1
    else:
        r-=1
        l+=1

    if l>=r:
        res=count
        break


print(res)

Problem: p03569
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
s = input()
 
ans = 0
p = 0
q = len(s) - 1
while p < 1:
	if s[p] == s[q]:
		p += 1
		q -= 1
	elif s[p] == "x":
		p += 1
		ans += 1
	elif s[q] == "x":
		q -= 1
		ans += 1
	else:
		ans = -1
		break
print(ans)

Failing test case input:
bxbbx

Expected output:
2


Actual output:
1


Fixed submission (verdict: Accepted):
s = input()
ans = 0
p = 0
q = len(s) - 1
while p < q:
	if s[p] == s[q]:
		p += 1
		q -= 1
	elif s[p] == "x":
		p += 1
		ans += 1
	elif s[q] == "x":
		q -= 1
		ans += 1
	else:
		ans = -1
		break
print(ans)
Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
list = list(map(int, input().split()))

sum = 0
a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
if (a < b):
	if(a < c):
		if(b<c):
			print(a+b)
		else :
			print(a+c)
	else :
		print(c+a)
else :
	print(a+ c if (c < a) else a)

Failing test case input:
31 0 1

Expected output:
31


Actual output:
61


Fixed submission (verdict: Accepted):
s = "100 10 25"
list = list(map(int, input().split()))


a = abs(list[1]-list[0])
b = abs(list[1]-list[2])
c = abs(list[2]-list[0])
if (a < b):
	print(b if b>c else c)
else :
	print(a if c<a else c)

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a = sorted(map(int,input().split()))
a[0]=0
cost = 0
for i in range(len(a)-1):
  cost += a[i+1]-a[i]
print(cost)

Failing test case input:
-5 0 99

Expected output:
104


Actual output:
99


Fixed submission (verdict: Accepted):
a = list(map(int,input().split()))
a = sorted(a)
cost = 0
for i in range(len(a)-1):
  cost += a[i+1]-a[i]
print(cost)

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a,b,c=map(int,input().split())
print(abs(a-b)+abs(b-c))

Failing test case input:
100 111 001

Expected output:
110


Actual output:
121


Fixed submission (verdict: Accepted):
a=list(map(int,input().split()))
print(max(a)-min(a))

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
from statistics import median

task=[int(i) for i in input().split()]
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
sum

Failing test case input:
96 16 0

Expected output:
96


Actual output:

Fixed submission (verdict: Accepted):
from statistics import median

task=[int(i) for i in input().split()]
    
b=median(task)
sum=0

for i in range(3):
    sum+=abs(b-task[i])
    
print(sum)

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
import sys

def main():
  input = sys.stdin.readline
  A = list(map(int, input().split()))
  A = sorted(A)
  ans = 0
  for i in range(1, len(A)-1):
    ans += A[i+1] - A[i]
  print(ans)


if __name__ == '__main__':
  main()

Failing test case input:
-1 46 -2

Expected output:
48


Actual output:
47


Fixed submission (verdict: Accepted):
import sys

def main():
  input = sys.stdin.readline
  A = list(map(int, input().split()))
  A = sorted(A)
  ans = 0
  for i in range(len(A)-1):
    ans += A[i+1] - A[i]
  print(ans)


if __name__ == '__main__':
  main()

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
a =list(map(int, input().split()))
a.sort
print(a[2]-a[0])

Failing test case input:
4 1 -151

Expected output:
155


Actual output:
-155


Fixed submission (verdict: Accepted):
a =list(map(int, input().split()))
a.sort()
print(a[2]-a[0])

Problem: p03292
Buggy submission (Python (3.4.3), verdict: Wrong Answer):
list=[int(i) for i in input().split()]
list.sort()
print(list[2]-list[1])


Failing test case input:
1 0 -44

Expected output:
45


Actual output:
1


Fixed submission (verdict: Accepted):
list=[int(i) for i in input().split()]
list.sort()
print(list[2]-list[0])