peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
import math
a,b,x = map(int,input().split())
x/=a

#theta = arctan(b/a)
half_area=a*b/2
if x==half_area:
    print(45)
if x<half_area:
    c = 2*x/b/b
    print(90-math.degrees(math.atan(c)))
if x>half_area:
    c = 2*(a*b-x)/a/a
    print(math.atan(c))
# Judge status: Accepted
a, b, c = map(int, input().split())
if a<=c and c<=b:
  print("Yes")
elif b<=c and c<=a:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
from sys import stdin
import re

alpha = stdin.readline().rstrip()

if alpha == alpha.upper():
    print('A')
else:
    print('a')
# Judge status: Wrong Answer
from math import factorial
N, a, b = map(int, input().split())
m=0
for i in range(N):
    if not i== a or i==b:
        k=factorial(N) // (factorial(N - i) * factorial(i))
        m=m+k
    print(m)
# Judge status: Accepted
diff = set('abcdefghijklmnopqrstuvwxyz') - set(input())
if diff:
    print(sorted(diff)[0])
else:
    print('None')
# Judge status: Wrong Answer
a,b,c=map(int,input().split())
if b<=c:
  print("delicious")
elif b<=a+c:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
S = list(input())
T = list(input())
ans = 0
for s, t in zip(S, T):
    if s != t:
        ans += 1
print(ans)
# Judge status: Wrong Answer
import numpy as np
import math

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

p = (1/n) * sum(x)

h = -(1/n)*(sum(x)**2)
m = np.array(x)
d = sum(m ** 2)

print(math.ceil(h + d))
# Judge status: Wrong Answer
K = int(input())
a = 0
n = 0
out = '-1'
for _ in range(K):
  a += 7 * (10 ** n)
  if a % K == 0:
    out = n + 1
    break
print(out)
# Judge status: Wrong Answer
import numpy as np
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

n = int(readline())
a = np.array(read().split(), np.int64)

mod = 10 ** 9 + 7
ans = 0

for i in range(61):
    b = a >> i & 1
    x = len(b) - sum(b)
    y = n - x
    z = x * y
    z *= 2 ** i
    z %= mod
    ans += z
ans %= mod

print(ans)
# Judge status: Accepted
x,y=map(int,input().split())
print(min(max(y-x,-y+x+2),abs(y+x)+1))
# Judge status: Wrong Answer
S, W = map(int, input().split())
if S <= 2 * W:
  print('unsafe')
else:
  print('safe')
# Judge status: Accepted
N = int(input())

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

for i in range(N):
    abc = list(map(int, input().split()))
    if i == 0:
        dp[i] = abc
    else:
        for j in range(3):
            dp[i][j] = max([dp[i-1][k] for k in range(3) if k != j]) + abc[j]

print(max(dp[N-1]))
# Judge status: Wrong Answer
import sys
import math


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n, m = inintm()

ans = 0

if m - n*2 >= 0:
    ans += n
    m -= n*2
    ans += m//4
    print(ans)
    exit()
else:
    if m % 2 == 0:
        print(m)
        exit()
    else:
        print(m-1)
        exit()
# Judge status: Accepted
N,K=map(int,input().split())
A=list(map(int,input().split()))

ii=0
for i in range(N):
    if A[i]==1:
        ii=1

print(((N-1)+(K-2))//(K-1))
# Judge status: Accepted
n = int(input())
ans = ''
while n != 0:
    if n % 2 != 0:
        n -= 1
        ans = '1' + ans
    else:
        ans = '0' + ans
    n //= (-2)
if ans == '':
    ans = '0'
print(ans)
# Judge status: Accepted
n = int(input())
ans = list(input())

for i in range(n-1):
    compare = list(input())
    res = []
    
    for j in ans:
        if j in compare:
            res.append(j)
            compare.remove(j)
            
    ans = res
    
print(*sorted(ans),sep="")
# Judge status: Accepted
from bisect import bisect_right

def cal(X):
    output = []
    for i in range(len(X)):
        if len(output) > 0:
            if output[len(output)-1] == "S" and X[i] == "T":
                output.pop()
            else:
                output.append(X[i])
        else:
            output.append(X[i])

    return len(output)

def main():
    X = input()
    print(cal(X))

if __name__ == "__main__":
    main()
# Judge status: Accepted
A, B, C = map(int, input().split())
if A <= C <= B:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
n = int(input())
arr = []
cnt = 0

for i in range(n):
  s = sorted(list(input()))
  arr.append(s)

for i in range(n):
  for j in range(i, n):
    if i != j and arr[i] == arr[j]:      
      cnt += 1

print(cnt//2)
# Judge status: Wrong Answer
K = int(input())

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

for x in range(A, B+1):
  if x % 7 == 0:
    print("OK")
  else: 
    print("NG")
# Judge status: Accepted
a,b=(int(x) for x in input().split())
A=0
if a<b :
  n=10**b//10
  for i in range(b):
    A=A+a*n
    n=n//10
if b<a :
  n=10**a//10
  for i in range(a):
    A=A+b*n
    n=n//10
if a==b :
  n=10**a//10
  for i in range(a):
    A=A+b*n
    n=n//10
print(A)
# Judge status: Accepted
n = int(input()) % 500
if (n <= int(input())):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
#!/usr/bin/env python

k, s = map(int, input().split())

ans = 0 
for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-(x + y) <= k:
            ans += 1

print(ans)
# Judge status: Accepted
n, q = map(int, input().split())
s = input()
v = [0] * (n)

for i in range(1, n):
  if s[i - 1] == "A" and s[i] == "C":
    v[i] = 1 + v[i - 1]
  else:
    v[i] = v[i - 1]

for i in range(q):
  l, r = map(int, input().split())
  print(v[r - 1] - v[l - 1])
# Judge status: Wrong Answer
print('Christmas'+int(input())%5*' Eve')
# Judge status: Accepted
c=str(input())
if c=="a" or c=="e" or c=="i" or c=="o" or c=="u":
    print("vowel") 
else:
    print("consonant")
# Judge status: Wrong Answer
x = int(input())
y = []
result = []

for i in range(x):
  y.append(input())

for i in range(x):
  result = y.index(y[i])+1
  
print(result)
# Judge status: Accepted
print(eval('+'.join(max(a:=input())*9+a)))
# Judge status: Wrong Answer
S = input()

ans = 10**9
for i in range(len(S) - 3):
    x = S[i:i+3]
    now = abs(int(x) - 753)
    ans = min(ans, now)
print(ans)
# Judge status: Accepted
s = input()

format = []
for i in range(2 ** (len(s) - 1)):
    pat = ""
    for j in range(len(s) - 1):
        pat += s[j]
        if i >> j & 1:
            pat += "+"
        else:
            pat += "-"

    pat += s[-1]    
    format.append(pat)

for i in range(len(format)):
    if eval(format[i]) == 7:
        print(format[i] + "=7")
        exit()
# Judge status: Accepted
n, a, b, c, d = map(int, input().split())
s = input()

if '##' in s[a - 1:max(c, d) - 1]:
    print('No')
elif c < d or ('...' in s[b - 2:d + 1]):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N, M = map(int, input().split())
SC = [list(map(int, input().split())) for _ in range(M)]
 
for X in range(10**N):
  X = str(X)
  
  #all　すべてがtrueならという意味
  if len(X) == N and all(X[s-1] == str(c) for s, c in SC):
    print(X)
    break
else:
  print(-1)
# Judge status: Accepted
import math
N,K=map(int,input().split())
count=0
for i in range(1,N+1):
  if i<K:
    a=math.ceil((math.log2(K)-math.log2(i)))
    count+=(1/N)*(1/2)**a
  else:
    count+=1/N
print(count)
# Judge status: Accepted
import math
N=int(input())
M =int(math.sqrt(N))
for i in range(M):
    if N%(M-i)==0:
        K=N//(M-i)
        L=M-i
        break
print(L+K-2)
# Judge status: Wrong Answer
a = int(raw_input())
b = int(raw_input())
c = int(raw_input())
x = int(raw_input())

def dfs(x, i, a, b , c):
  	if x < 0:
  		return 0
  	if x == 0:
  		return 1
  	
  	if i == 3:
  		return 1 if x == 0 else 0
  	r = 0
  	m = {0:a,1:b,2:c}
  	v = {0:500,1:100,2:50}

  	for k in range(1, m[i] + 1):
  		r += dfs(x - k * v[i], i+1, a,b,c)
  	return r

print dfs(x,0,a,b,c)
# Judge status: Accepted
n=int(input())
p=list(map(int,input().split()))
for i in range(n):
    for j in range(n):
        a=p[:]
        a[i],a[j]=a[j],a[i]
        if a==sorted(a):
            print('YES')
            exit()
print('NO')
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a==1 or b==1:
  if a==b:
    print('Draw')
  elif a==1:
    print('Alice')
  else:
    print('Bob')
else:
  print('Alice' if a>b else 'Bob')
# Judge status: Wrong Answer
# coding = utf-8
f=input("")
ra=input("")
a=ra.split()
lista=[int(s) for s in a]
mix=1
base=0
cnt=0
for num in lista:
    for n in range(30):
        if num % 2**n ==0 :
            cnt+=1
            if base<n:
                base=n
            
print(base)
# Judge status: Accepted
import itertools

n = int(input())
a = tuple([int(i) for i in input().split()])
b = tuple([int(i) for i in input().split()])
ai = 0
bi = 0
i = 1
val = [None] * n

for i in range(n):
    val[i] = i+1
for v in itertools.permutations(val, n):
    if v == a: ai = i-1
    if v == b: bi = i-1
    i += 1

print(abs(ai-bi))
# Judge status: Accepted
line1 = input().split()
k = int(line1[0])
n = int(line1[1])
line2 = input().split()
a = [int(i) for i in line2]
dist_list = [a[i] - a[i - 1] for i in range(1, len(a))]
dist_list.append(k-a[-1] + a[0])
max_dist = max(dist_list)
index = len(dist_list) - dist_list[::-1].index(max_dist) - 1
start_index = (index + 1) % len(dist_list)
ans = 0
for i in range(start_index, start_index + n - 1):
  ans += dist_list[i % len(dist_list)]
print(ans)
# Judge status: Wrong Answer
N = int(input())
pl = list(map(int, input().split()))

cnt = 0
if pl[N-1] == N:
    cnt += 1
if N != 2:
    for i in range(1,N):
        if pl[i-1] == i:
            a = pl[i - 1]
            pl[i - 1] = pl[i]
            pl[i] = a
            cnt += 1
print(cnt)
# Judge status: Accepted
N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
for i in X:
    print(Y[N//2] if i <= Y[N//2-1] else Y[N//2-1])
# Judge status: Accepted
N, S = open(0).read().split()
N = int(N)
cnt = 0
l = 0
for i in range(N):
  if S[i]=='(':
    cnt += 1
  else:
    if cnt==0:
      l += 1
    else:
      cnt -= 1
cnt = 0
r = 0
for i in range(N-1,-1,-1):
  if S[i]==')':
    cnt += 1
  else:
    if cnt==0:
      r += 1
    else:
      cnt -= 1
print('('*l+S+')'*r)
# Judge status: Wrong Answer
k,x=map(int,input().split())
if(k*500>=x):
  print("YES")
else:
  print("NO")
# Judge status: Accepted
n = int(input())
list_score = list(map(int, input().split()))
ans = "Yes"
max_value = 0
for i in range(n):
    if list_score[i] > max_value:
        max_value = list_score[i]
    if max_value - list_score[i] > 1:
        ans = "No"
        break

print(ans)
# Judge status: Accepted
s = input()
if len(s) % 2 == 1:
    print("No")
else:
    for i in range(len(s)//2):
        if s[i*2] != 'h' or s[i*2+1] != 'i':
            print("No")
            exit()
    print("Yes")
# Judge status: Accepted
X = int(input())

# 100-105
# 200-210
# 300-315
# ...
# 1900-1995
# 2000-2100
# 2100-
flag = False

if(X >= 2000):
    flag = True

for i in range(1, 20):
    if(i*100 <= X and X <= i*105):
        flag = True
        break

if(flag):
    print(1)
else:
    print(0)
# Judge status: Accepted
N,M=map(int,input().split())
graph=[[] for i in range(N)]
for i in range(M):
  a,b=map(int,input().split())
  graph[a-1].append(b-1)
  graph[b-1].append(a-1)
ANS=[0 for i in range(N)]
finish=[0]
for i in finish:
  for k in graph[i]:
    if ANS[k]==0:
      ANS[k]=i+1
      finish.append(k)
print("Yes")
for i in range(1,N):
  ans=ANS[i]
  print(ans)
# Judge status: Accepted
S=input()
N=len(S)
A=[0]*(N+1)
B=[0]*(N+1)
for i in range(N):
	if S[i]=="<":
		A[i+1]=A[i]+1
	elif S[i]==">":
		A[i+1]=0
for i in range(N):
	if S[N-i-1]==">":
		B[N-i-1]=B[N-i]+1
	elif S[N-i-1]=="<":
		B[N-i-1]=0
ans=0
for i in range(len(A)):
	ans+=(max(A[i],B[i]))
print(ans)
# Judge status: Accepted
N = int(input())
A_i = list(map(int,input().split()))
cnt = [0]*N

for i in range(N-1):
    cnt[A_i[i]-1]+=1

for i in range(N):
    print(cnt[i])
# Judge status: Wrong Answer
N=int(input())
S=input()

x=0
y=0

for i in S:
    if i=="(":
        x+=1
    else:
        if x<=0:
            y+=1
        else:
            x-=1
print("("*x+S+")"*x)
# Judge status: Accepted
n,m = list(map(int, input().split()))
print(m//2 if n>=m//2 else n+(m-n*2)//4)
# Judge status: Accepted
X = int(input())
if X == 0:
    print("1")
elif X == 1:
    print("0")
# Judge status: Wrong Answer
import math

A,B=map(int,input().split())
print(math.ceil((A+B)//2))
# Judge status: Accepted
# -*- coding: utf-8 -*-
N, K, S = map(int, input().split())
a = []
if S != 10**9:
    for i in range(K):
        a.append(S)
    for i in range(N-K):
        a.append(S+1)
else:
    for i in range(K):
        a.append(S)
    for i in range(N-K):
        a.append(S-1)
maped_a = map(str, a)
ans = " ".join(maped_a)
print(ans)
# Judge status: Accepted
from decimal import Decimal
A,B = input().split()
print(int(int(A)*Decimal(B)))
# Judge status: Accepted
import copy
N=int(input())
a=[0]*(N+1)
cnta=copy.copy(a)
for i in range(1,N+1):
    a[i]=int(input())

button=1

for i in range(100000):
    cnta[button]=cnta[button]+1
    if cnta[2]==1:
        print(sum(cnta)-1)
        break
    elif cnta[button]>=2:
        print("-1")
        break
    button=a[button]
# Judge status: Accepted
from fractions import gcd

mod = 10 ** 9 + 7

N, *A = map(int, open(0).read().split())

L = 1
for a in A:
    L *= a // gcd(L, a)

L %= mod

print(sum(L * pow(a, mod - 2, mod) % mod for a in A) % mod)
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 0
for i in range(1, 2*n+1):
  if i % 2 == 0:
    ans += a[-i]
print(ans)
# Judge status: Wrong Answer
n,k = map(int,input().split())
a = list(map(int,input().split()))

ans = 1
pre = 1

for i in range(k):
    pre *= a[i]

ans = pre

for i in range(k,n):
    ans /= a[i-k]
    ans *= a[i]
    if(ans > pre):
        print("yes")
    else:
         print("No")
    pre = ans
# Judge status: Wrong Answer
N=int(input())
for i in range(N,0,-1):
        if int(i**0.5)**2 == i:
            print(i)
            break
# Judge status: Accepted
s = input();

print(chr(ord(s) + 1));
# Judge status: Wrong Answer
a, b, c = map(int,input().split())
print("YES" if a<=c<=b else "NO" )
# Judge status: Wrong Answer
n = int(input())
s = input()
count = [0]*26
for i in s:
    count[ord(i)-ord("a")] += 1
mod = 10**9+7
ans = 1
for i in count:
    ans *= (i+1)
    ans %= mod
print(ans)
# Judge status: Wrong Answer
num = input()
predicted_value = 0
finished = False
i = 1
while i < len(num):
    if num[i] != num[i-1]:
        num = num[:i-1] + num[i+1:]
        predicted_value += 2
        if i > 1:
            i -= 2
    i += 1
print(predicted_value)
# Judge status: Accepted
import sys

# N
n = int(input())

res = n

for i in range(n+1):
    cc = 0
    t = i
    while(t > 0):
        cc += t % 6
        t //= 6
    t = n - i
    while(t > 0):
        cc += t % 9
        t //= 9
    if (res > cc):
        res = cc
print(res)
# Judge status: Wrong Answer
class MyList(list):
    def last_index(self):
        return len(self)-1

N = int(input())
P = MyList(map(int, input().split()))
temp = P.last_index()
j=1
count = 0

for i in P:
    if j<len(P):
        if i > P[j]:
            count+=1
            j+=1
        else:
            j+=1
    else:
        if temp > 0:
            count+=1
print(count)
# Judge status: Accepted
h, w = map(int, input().split())
if h == 1 or w == 1:
  print(1)
else:
  if h*w%2 != 0:
    print(h*w//2 + 1)
  else:
    print(h*w//2)
# Judge status: Accepted
N = int(input())

def main(l):
  tmp = []
  for a in l:
    n = a[1]
    for i in range(97, n+2):
      tmp.append([a[0]+chr(i), max(i, n)])
  return tmp
  
l = [['a', 97]]
for i in range(1, N):
  l = main(l)
for i in range(len(l)):
  print(l[i][0])
# Judge status: Accepted
line=input().split(' ')
N=int(line[0])
M=int(line[1])

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

res=N-sum(A)

if res<0:
    print(-1)
else:
    print(res)
# Judge status: Wrong Answer
a, b, x = map(int, input().split())

ans = b // x - a // x
print(ans)
# Judge status: Wrong Answer
#!/usr/bin/env python3
n, k = map(int, input().split())
print(k * (n - 1) + n * (n - 1) // 2 + k * (k < 0) - (k + n - 1) * (-n > k))
# Judge status: Wrong Answer
n, m = map(int, input().split())

l, r = [], []
for i in range(m):
    tmpa, tmpb = map(int, input().split())
    l.append(tmpa)
    r.append(tmpb)

print(r[0] - l[m - 1] + 1)
# Judge status: Accepted
N, R = (int(x) for x in input().split())
if N > 9:
    print(R)
else:
    print(R + (100 * (10 - N)))
# Judge status: Wrong Answer
a, b = map(int, input().split())
result = a*b
if (result < 1):
    print(-1)
else:
    print(result)
# Judge status: Accepted
n = int(input())
a = sorted([int(_) for _ in input().split()])

flag = 0
for i in range(n-1):
    if a[i] == a[i+1]:
        flag = 1
        break

if flag:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
a,b,c,d=map(int,raw_input().split())
if a%d==0:
	p=a/d
else:
	p=a/d + 1

if c%b==0:
	q=c/b
else:
	q=c/b + 1

if q<=p:
	print "Yes"

else:
	print "No"
# Judge status: Accepted
N,M = map(int,input().split())
listA = list(map(int,input().split()))
A = sorted(listA,reverse=True)
T = sum(A)
b = True
for i in range(M):
    if A[i] < T/(4*M):
        b = False
if b == True:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a,b,c=map(int,input().split())


for i in range(1,100000):
    if (a+(a*i))%b==c:
        print("YES")
        break
else:
    print("NO")
# Judge status: Wrong Answer
n = int(input())
a = [list(map(int,input().split())) for i in range(2)]
ans = a[0][0] + a[1][-1]
for i in range(n-1):
    if sum(a[0][i+1:]) >= sum(a[1][i:n-1]):
        ans += a[0][i+1]
    else:
        ans += sum(a[1][i:n-1])
        break
print(ans)
# Judge status: Accepted
list = []
for i in range(4):
    list.append(int(input()))

#print(list)

a = 0
b = 0
c = 0
res = 0
for a in range(list[0]+1):
    for b in range(list[1]+1):
        for c in range(list[2]+1):
            total = 500*a + 100*b + 50*c
            if total == list[3]:
                res += 1
print(int(res))
# Judge status: Accepted
n, m = map(int, input().split())

Road = []
for _ in range(m):
    a, b = map(int, input().split())
    Road.append((a, b))

tmp = sorted(Road)
#print(tmp)

ans = [0]*n
for t in tmp:
  ans[t[0]-1] += 1
  ans[t[1]-1] += 1

for a in ans:
  print(a)
# Judge status: Accepted
_ = input()
A = [int(i) for i in input().split()]

cnt = 1
broken = 0
for a in A:
  if a == cnt:
    cnt += 1
  else:
    broken += 1

if cnt == 1:
  print("-1")
else:
  print(broken)
# Judge status: Wrong Answer
s = list(input())

ans = float('inf')
for i in range(len(s)-3):
    now = sum(t * 10**i for i, t in enumerate(list(map(int, s[i:i+3]))[::-1]))
    ans = min(ans, abs(now - 753))
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())

d = abs(abs(y) - abs(x))

if (x > 0 and y <= 0) or (x >= 0 and y < 0) or (x < 0 and y > 0):
    d += 1
elif x > y:
    d += 2

print(d)
# Judge status: Accepted
n=int(input())
ll=[]
for _ in range(n):
    x,l=map(int,input().split())
    ll.append((x+l,x-l))
ll=sorted(ll)
ans=0
c=-10**10
for t,s in ll:
    if c<=s:
        c=t
        ans+=1
print(ans)
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

import collections

A_count = collections.Counter(A)


ans = 0
for x, x_count in A_count.items():
    if x == x_count:
        continue
    elif x < x_count:
        ans += min(x, x_count-x)
    else:
        ans += x_count
print(ans)
# Judge status: Accepted
a = int(input())
p,q= input().split()
b,c =(int(p), int(q))
d = input().split()
ans_list = []
for i in range(a):
    e = abs(c+0.006 * int(d[i])-b)
    ans_list.append(e)
for i in range(a):
    if ans_list[i] == min(ans_list):
        print(i+1)
        break
# Judge status: Wrong Answer
n, m = map(int, input().split())
li = []
#mの約数を求める
for i in range(int(m**0.5) + 1, 0, -1):
    if i == int(m**0.5)+1 and (i-1)**2 == m:
        continue
    if m%i==0:
        li.append(i)
#
for i in li:
    if n <= m//i:
        print(i)
        break
# Judge status: Accepted
x = list(input())

cnt_S = 0
cnt_T = 0

for i in range(len(x)):
    if x[i] == "S":
        cnt_S += 1
    
    elif x[i] == "T":
        if cnt_T < cnt_S:
            cnt_T += 1

print(len(x)-2*cnt_T)
# Judge status: Accepted
a,b,c = map(int, input().split())

if a == b ==c:
    print(1)
elif a == b or b ==c or c == a:
    print(2)
else:
    print(3)
# Judge status: Wrong Answer
a,b,k=map(int,input().split())

if k<=a:
  print(str(a-k)+' '+str(b))
  
else:
  print(str(0)+' '+str(b-(k-a)))
# Judge status: Wrong Answer
X,Y = map(int,input().split())
if X%Y==0:
    print(-1)
else:
    x = X
    y = Y
    while y>0:
        x,y = y,x%y
    a = x
    m = X//a
    print(a**2*m)
# Judge status: Accepted
import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15

def main():
    N = int(input())
    A = list(map(int,input().split()))
    tot = 0
    for a in A:
        tot ^= a
    
    ans = []
    for a in A:
        ans.append(tot^a)
    print(*ans)
if __name__ == '__main__':
    main()
# Judge status: Accepted
X,Y=map(int,input().split())
print(X if X%Y else -1)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N, K = mapint()
mod = 10**9+7

ans = 0
for i in range(K, N+2):
    ans += (N+(N-i+1))*i//2-(i*(i-1)//2)+1
    ans %= mod
print(ans)
# Judge status: Accepted
S = input()
N = len(S)#7
a = 0
f = (N-1)//2
for i in range(N):
    if S[i] != S[-i-1]:
        a = 1
for i in range(f):
    if S[i] !=S[f-i-1]:
        a = 1
b = 0
for j in range((N+3)//2-1,N):
    b += 1
    if S[j] != S[N-b]:
        a = 1
if a == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a,b,c=map(int,input().split())
if a-b > c:
  print(0)
else:
 print(c-a+b)
# Judge status: Wrong Answer
num = input().split()

str = input()
strc = ''
for i in range(int(num[0])-1):
  strc = input()
  if str > strc:
    str = strc + str
  else:
    str = str + strc
print(str)
# Judge status: Accepted
a,b,c=input().split()
print("Yes" if (a==b or b==c or a==c) and not a==b==c else "No" )
# Judge status: Accepted
n,k=map(int,input().split())
h=[]
for i in range(n):
    h.append(int(input()))
h.sort()

ans=h[-1]-h[0]
for i in range(n-k+1):
    ans=min(ans,h[i+k-1]-h[i])
print(ans)
# Judge status: Wrong Answer
N=int(input())
a=1
b=0
for i in range(N):
    if (i+1)*i/2>=N:
        a=i
        b=(i+1)*i/2-N

        break

for i in range(1,a+1):
    if i!=b:
        print(i)
# Judge status: Accepted
import bisect

N = int(input())
L = list(map(int,input().split()))
L = sorted(L)
ans = 0

for i in range(N-2) :
    for j in range(i+1,N-1) :
        a = L[i] + L[j]
        X =bisect.bisect_left(L,a)
        ans += X- j - 1
        
    
print(ans)
# Judge status: Accepted
n,k=map(int,input().split())
d=set(list(map(str,input().split())))

for i in range(n,10*n):
    flag=0
    sn=str(i)
    for j in sn:
        if j in d:
            flag=1
    if flag==0:
        print(i)
        exit()
# Judge status: Accepted
n = int(input())

n_li = [n]
while True:
    if n%2==0:
        n = n/2
    elif n%2!=0:
        n = 3*n+1

    if n in n_li:
        break
    else:
        n_li.append(n)
print(len(n_li)+1)
# Judge status: Wrong Answer
a,b,c,d=map(int,list(input()))
n=3
ans=''
for i in range(n**2):
  op=[]
  for j in range(n):
    if (i>>j & 1):
      op.append(True)
    else:
      op.append(False)
  tmp=a
  tmp=tmp+b if op[0] else tmp-b
  tmp=tmp+c if op[1] else tmp-c
  tmp=tmp+d if op[2] else tmp-d
  if tmp==7:
    ans=str(a)
    ans+='+' if op[0] else '-'
    ans+=str(b)
    ans+='+' if op[1] else '-'
    ans+=str(c)
    ans+='+' if op[2] else '-'
    ans+=str(d)
    break
print(ans)
# Judge status: Wrong Answer
x, y = map(int, input().split())
a = [1,3,5,7,8,12]
b = [4,6,9,10]
c = [2]

if x in a and y in a:
    print("Yes")
elif x in b and y in b:
    print("Yes")
elif x in c and y in c:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
import numpy as np
N, K, Q = map(int, input().split())
A = np.array([int(input()) for _ in range(Q)])

ans = np.zeros(N)
ans += K

for a in A:
    ans[a-1] += 1

ans -= Q

for a in ans:
    if a>0:
        print("Yes")
    else:
        print("No")