Harryxun/stf_run huggingface dataset:
from functools import reduce
import fractions

N,X = map(int,input().split())
xn = list(map(int,input().split()))
xn.sort()
distance = [xn[i]-xn[i-1] for i in range(1,N)]
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
print(gcd_list(distance))

### FIXED CODE ###

from functools import reduce
import fractions

N,X = map(int,input().split())
xn = list(map(int,input().split()))

distance = [abs(X-xn[i]) for i in range(N)]
def gcd_list(numbers):
    return reduce(fractions.gcd, numbers)
print(gcd_list(distance))
N, M = map(int, input().split())
ana = [0] * M
for i in range(M):
  ana[i] = input()
ans = [0] * N
ans[0] = 1# 一段目まで登る方法は一通り
ans[1] = 2# 二段目まで登る方法は二通り
 
for i in range(2,N):
    tmp = i+1
    tmp2 = str(tmp)
    if tmp2 in ana:
        continue
    else:
        ans[i] = (ans[i-1] + ans[i-2]) % 1000000007
 
print(ans[N-1])

### FIXED CODE ###

import sys
N, M = map(int, input().split())
if N == 1:
    print(1)
    sys.exit()
ana = [0] * M
ans = [0] * N
mod = 10 ** 9 + 7
if M != 0:
    for i in range(M):
      ans[int(input())-1] = -1
if ans[0] == -1 and ans[1] == -1:
    print(0)
    sys.exit()
elif ans[0] == -1:
    ans[0] = 0
    ans[1] = 1
elif ans[1] == -1:
    ans[0] = 1
    ans[1] = 0
else:
    ans[0] = 1
    ans[1] = 2

if N != 2:
    for i in range(2,N):
        if ans[i] == -1:
            ans[i] = 0
        else:
            ans[i] = (ans[i-1]  + ans[i-2]) % mod
print(ans[N-1])
N = int(input())
ori = [int(i) for i in input().split()]
print(N,ori)
count = ori.count(1)
print(count)
if count == 0:
    print(-1)
savepoint = 0
Break = 0
quit  = 0
for j in range(1,N+1):
    for i in range(savepoint+1,N):
        if ori[i] == j:
            Break = i
            savepoint = i
            #print(Break)
            #print(savepoint)
            #print(j,i)
            sub = j
            break
        #else: 
            #quit = 1
            #break
    #if quit == 1:
        #print(quit)
        #break
print(Break+1-sub)

### FIXED CODE ###

N = int(input())
ori = [int(i) for i in input().split()]
count = ori.count(1)
if count == 0:
    print(-1)

else:
    savepoint = 0
    for j in range(1,N+1):
        for i in range(savepoint,N):
            if ori[i] == j:
                savepoint = i
                #print(savepoint)
                #print(j,i)
                sub = j
                break
        if i == N-1:
            break
    print(N-sub)
s = input()
x, y = map(int, input().split())
N = len(s)
a = []
b = []
c = 0
n = 0
for i in range(len(s)):
  if s[i]=='F':
    n += 1
  else:
    if c%2==0:
      a += [n]
    else:
      b += [n]
    c += 1
    n = 0
if c%2==0:
  a += [n]
else:
  b += [n]

sa = sum(a)
sb = sum(b)
dpa1 = [0]*(2*sa+1)
dpa2 = [0]*(2*sa+1)
dpb1= [0]*(2*sb+1)
dpb2 = [0]*(2*sb+1)

dpa1[sa] = 1
dpb1[sb] = 1


if len(a)%2==0:
  A = dpa1
else:
  A = dpa2
if len(b)%2==0:
  B = dpb1
else:
  B = dpb2

for i in range(len(a)):
  c = a[i]
  if i%2==0:
    for j in range(2*sa+1):
      if dpa1[j]==1:
        dpa1[j] = 0
        dpa2[j-c] = 1
        dpa2[j+c] = 1
  else:
    for j in range(2*sa+1):
      if dpa2[j]==1:
        dpa2[j] = 0
        dpa1[j-c] = 1
        dpa1[j+c] = 1
for i in range(len(b)):
  c = b[i]
  if i%2==0:
    for j in range(2*sb+1):
      if dpb1[j]==1:
        dpb1[j] = 0
        dpb2[j-c] = 1
        dpb2[j+c] = 1
  else:
    for j in range(2*sb+1):
      if dpb2[j]==1:
        dpb2[j] = 0
        dpb1[j-c] = 1
        dpb1[j+c] = 1
if sa<x or sb<y or -x<-sa or -y<-sb:
  print('No')
elif A[x+sa]==1 and B[y+sb]==1:
  print('Yes')
else:
  print('No')

### FIXED CODE ###

s = input()
x, y = map(int, input().split())
a = []
b = []
c = 0
n = 0
for i in range(len(s)):
  if s[i]=='F':
    n += 1
  else:
    if c%2==0:
      a += [n]
    else:
      b += [n]
    c += 1
    n = 0
if s[-1]=='F':
  if c%2==0:
    a += [n]
  else:
    b += [n]
sa = sum(a)
sb = sum(b)
dpa1 = [0]*(2*sa+1)
dpa2 = [0]*(2*sa+1)
dpb1= [0]*(2*sb+1)
dpb2 = [0]*(2*sb+1)
dpa1[sa] = 1
dpb1[sb] = 1
if len(a)>0:
  if sa-a[0]<abs(x-a[0]) or sb<abs(y):
    print('No')
    import sys
    sys.exit()
else:
  if sa<abs(x) or sb<abs(y):
    print('No')
    import sys
    sys.exit()

if len(a)%2==0:
  A = dpa1
else:
  A = dpa2
if len(b)%2==0:
  B = dpb1
else:
  B = dpb2

for i in range(len(a)):
  c = a[i]
  if i%2==0:
    for j in range(2*sa+1):
      if dpa1[j]==1:
        dpa1[j] = 0
        dpa2[j-c] = 1
        dpa2[j+c] = 1
  else:
    for j in range(2*sa+1):
      if dpa2[j]==1:
        dpa2[j] = 0
        dpa1[j-c] = 1
        dpa1[j+c] = 1
for i in range(len(b)):
  c = b[i]
  if i%2==0:
    for j in range(2*sb+1):
      if dpb1[j]==1:
        dpb1[j] = 0
        dpb2[j-c] = 1
        dpb2[j+c] = 1
  else:
    for j in range(2*sb+1):
      if dpb2[j]==1:
        dpb2[j] = 0
        dpb1[j-c] = 1
        dpb1[j+c] = 1

if A[x+sa]==1 and B[y+sb]==1:
  print('Yes')
else:
  print('No')
A,B = map(int,input().splite())

if A > 9:
    print(-1)
elif B > 9:
    print(-1)
else:
    print(A*B)

### FIXED CODE ###

A,B = map(int,input().split())
if A > 9:
    print(-1)
elif B > 9:
    print(-1)
else:
    print(A*B)
n=int(input())
a=list(map(int,input().split()))
num=1
count=0
for i in range(n):
    if a[i]%2==0:
        num=num*a[i]
while num%2==0:
    num=num/2
    count+=1
print(count)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
count=0
for i in range(n):
    if a[i]%2==0:
        num=a[i]
        while num%2==0:
            num /=2
            count+=1
print(count)
A, B, C, X, Y = list(map(int, input().split()))

# A 1枚、B 1枚を2C円で買うと捉え直す。
# ピザは、最大でも10**5枚（A, Bそれぞれに対して）
# A, Bのセットを、1~10**セットまで動かして一番安い組を考える

cheapest = float("inf")

for i in range(max(X, Y) + 1):

    price = 2 * C * i + A * max(0, X - i) + B * max(Y - i)

    cheapest = min(cheapest, price)

print(cheapest)


### FIXED CODE ###

A, B, C, X, Y = list(map(int, input().split()))

# A 1枚、B 1枚を2C円で買うと捉え直す。
# ピザは、最大でも10**5枚（A, Bそれぞれに対して）
# A, Bのセットを、1~10**セットまで動かして一番安い組を考える

cheapest = float("inf")

for i in range(max(X, Y) + 1):

    price = 2 * C * i + A * max(0, X - i) + B * max(0, Y - i)

    cheapest = min(cheapest, price)

print(cheapest)
V, E = map(int, input().split())
G = [[] for i in range(V+1)]
for i in range(E):
    a, b, c = map(int, input().split())
    G[a-1].append((b-1, 0-c))
G[V-1].append((V, 0))

INF = float('inf')
dist = [INF] * (V + 1)
dist[0] = 0
Flag = False

for i in range(V+1):
    UnUpdate = True
    for v, e in enumerate(G):
        for t, cost in e:
            if dist[v] != INF and dist[v] + cost < dist[t]:
                dist[t] = dist[v] + cost
                UnUpdate = False
    if UnUpdate and i < V:
        Flag = True
        break

if Flag:
    print(0-dist[V])
else:
    print(1/0)

### FIXED CODE ###

INF = float('inf')


def Bellmanford(node, edges, source):
    d = [INF] * node  # ある頂点までのコストを保存するリスト
    d[source] = 0

    for i in range(node):
        for start, goal, cost in edges:
            # 辺の始まりの頂点までのコストが INF でなく
            # 辺の向かう先の頂点のコストが、より軽くなる場合に、
            # リストを更新する
            if d[start] != INF and d[start] + cost < d[goal]:
                d[goal] = d[start] + cost
                if i == node-1 and goal == node-1:
                    return 'inf'
    return -d[node-1]


N, M = map(int, input().split())
abc = [map(int, input().split()) for _ in range(M)]
Edges = [None] * M

for i in range(M):
    ai, bi, ci = abc[i]
    Edges[i] = (ai-1, bi-1, -ci)


ans = Bellmanford(N, Edges, 0)
print(ans)
n, avg = map(int, input().split())
a = list(map(int, input().split()))
mxsm = sum(a) + 5

dp = [[0] * mxsm for _ in range(n + 5)]

dp[0][0] = 1
rs = 0
for x in a:
    dp2 = [[it1 for it1 in lin] for lin in dp]
    for i in range(1, n + 1):
        for j in range(x, mxsm + 1):
            if dp[i - 1][j - x]:
                dp2[i][j] += dp[i - 1][j - x]
    dp = dp2

for i in range(1, n + 1):
    rs += dp[i][avg * i]

print(rs)



### FIXED CODE ###

n, avg = map(int, input().split())
a = list(map(int, input().split()))
mxsm = sum(a) + 5

dp = [[0] * mxsm for _ in range(n + 5)]

dp[0][0] = 1
rs = 0
for x in a:
    dp2 = [[it for it in lin] for lin in dp]
    for i in range(1, n + 1):
        for j in range(x, mxsm + 1):
            if dp[i - 1][j - x]:
                dp2[i][j] += dp[i - 1][j - x]
    dp = dp2

for i in range(1, n + 1):
    if len(dp[i]) > avg * i:
        rs += dp[i][avg * i]

print(rs)
import bisect

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = [0]
for _ in range(m):
    if a[-1] > b[-1]:
        am = a.pop()
        am = am // 2
        bisect.insort_left(b, am)
    else:
        bm = b.pop()
        bm = bm // 2
        bisect.insort_left(b, bm)
        
    
print(sum(a)+sum(b))

### FIXED CODE ###

import heapq

n, m = list(map(int, input().split()))
a = list(map(int, input().split()))
a.sort()
b = []
heapq.heappush(b,0)
for _ in range(m):
    bm = -b[0]
    if len(a) != 0 and a[-1] > bm:
        am = a.pop()
        am = am // 2
        heapq.heappush(b,-am)
    else:
        bm = -heapq.heappop(b)
        bm = bm // 2
        heapq.heappush(b,-bm)
        
    
print(sum(a)-sum(b))
N=input()
N=int(N)
S=[100]*N
P=[100]*N
for num in range(N):
    S[num]=input().split()
    S[num].append(num+1)
    S[num][1]=int(S[num][1])

S.sort()
flag=0
flag2=0
while(flag==0):
    flag2=0
    for num in range(0,N-1):
        if(S[num][0]==S[num+1][0]):
            if(S[num][1]<S[num+1][1]):
                S[num],S[num+1]=S[num+1],S[num]
                flag2=1
    if(flag2==0):
        flag=1
    
            

for num in range(N):
    print(S[num][2])


### FIXED CODE ###

A,P=input().split()
A=int(A)
P=int(P)
print((A*3+P)//2)
A,B,C = [int(i) for i in input().split(' ')]

temp = A
A = B
B = temp

temp = A
A = C
C = temp

print(f'{A} {B} {C}')

### FIXED CODE ###

A,B,C = [int(i) for i in input().split(' ')]


A, B = B, A
A, C = C, A

print('{} {} {}'.format(A, B, C))
N, M = map(int, input().split())
road = [0 for _ in range(N)]

for _ in range(N):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)


### FIXED CODE ###

N, M = map(int, input().split())
road = [0] * N

for _ in range(M):
    a, b = [int(i) for i in input().split()]
    road[a - 1] += 1
    road[b - 1] += 1
for r in road:
    print(r)
mod=10**9+7

class Combination:
	def __init__(self,size):
		self.size = size + 2
		self.fact = [1, 1] + [0] * size
		self.factInv = [1, 1] + [0] * size
		self.inv = [0, 1] + [0] * size
		
		for i in range(2, self.size):
			self.fact[i] = self.fact[i - 1] * i % mod
			self.inv[i] = -self.inv[mod % i] * (mod//i) % mod
			self.factInv[i] = self.factInv[i - 1] * self.inv[i] % mod
			
	def npk(self,n,k):
		if n < k or n < 0 or k < 0:
			return 0
		return self.fact[n] * self.factInv[n - k] % mod
		
	def nck(self,n,k):
		if n < k or n < 0 or k < 0:
			return 0
		return self.fact[n] * (self.factInv[k] * self.factInv[n - k] % mod) % mod
		
	def nhk(self,n,k):
		return self.nck(n + k - 1, n - 1)
		
n,a,b=map(int,input().split())

ca=Combination(n+a)
cb=Combination(n+b)
nca=ca.nck(n,a)
ncb=cb.nck(n,b)

print(((2**n-1)%mod-nca-ncb)%mod)

### FIXED CODE ###

mod=10**9+7

n,a,b=map(int,input().split())
res=pow(2,n,mod)
res=(res-1)%mod

ncb=1
for i in range(1,b+1):
	ncb*=(n-i+1)*pow(i,mod-2,mod)
	ncb%=mod
	if i==a:
		nca=ncb
		
print((res-nca-ncb)%mod)
def main():
    red, green, blue  = map(int, input().split())
    K = int(input())

    while(K > 0):
        if green <= red:
            green *= 2
            K -= 1
            continue
        if blue <= green:
            blue *= 2
            K -= 1
            continue
        if judge(red, green, blue):
            break
        
    if judge(red, green, blue):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


### FIXED CODE ###

def judge(red, green,blue):
    if blue > green:
        if green > red:
            return (True)
    else:
        return(False)


def main():
    red, green, blue  = map(int, input().split())
    K = int(input())

    while(K > 0):
        if green <= red:
            green *= 2
            K -= 1
            continue
        if blue <= green:
            blue *= 2
            K -= 1
            continue
        if judge(red, green, blue):
            break
        
    if judge(red, green, blue):
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
a=[int(x) for x in input().split()]
if(a[0]+a[1]>a[2]):
  print(a[1]+a[2])
elif:
  print(a[1]+a[2]-abs(a[0]+a[1]-a[2]))

### FIXED CODE ###

a=[int(x) for x in input().split()]
if(a[0]+a[1]>=a[2]):
  print(a[1]+a[2])
else:
  print(2*a[1]+a[0]+1)
a=list(set(a))
b=0
for i in a:
    t=True
    for I in range(2,int(i**0.5)+1):
        if i%I==0: t=False
    if t: 
        b+=1
print(b)

### FIXED CODE ###

a=input()
def ip(a):
    i=2
    while i**2<=a:
        if a%i==0:return False
        i+=1
    return True
b=0
for i in range(int(a)):
    c=input()
    if ip(int(c)):b+=1
print(str(b))
n,m=map(int,input().split())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append((b,a))

AB.sort()

cnt=0
ans=0
for b,a in AB:
    if cnt==k:
        print(ans)
        break
    temp=min(k-cnt,a)
    ans+=b*temp
    cnt+=temp

### FIXED CODE ###

n,m=map(int,input().split())
AB=[]
for i in range(n):
    a,b=map(int,input().split())
    AB.append((a,b))

AB.sort()

cnt=0
ans=0
for a,b in AB:

    temp=min(m-cnt,b)
    ans+=a*temp
    cnt+=temp
    if cnt==m:
        print(ans)
        break
n,k=(int(i) for i in input().split())
r=[0 for i in range(n)]
l=[int(i) for i in input().split()]
wazap=[]
count=1
saver=None
temp=0
while r[temp]==0:
  r[temp]=count
  wazap.append(temp)
  temp=l[temp]-1
start=wazap[-1]
for i in range(len(wazap)):
  if wazap[i]==start-1:
    left=i
    break
loop=len(wazap)-left
if k<left:
  print(wazap[k]+1)
else:
  print(wazap[(k-left)%loop+left]+1)

### FIXED CODE ###

n,k=(int(i) for i in input().split())
r=[0 for i in range(n)]
l=[int(i) for i in input().split()]
wazap=[]
count=1
saver=None
temp=0
while r[temp]==0:
  r[temp]=count
  wazap.append(temp)
  temp=l[temp]-1
start=l[wazap[-1]]
left=None
for i in range(len(wazap)):
  if wazap[i]==start-1:
    left=i
    break
loop=len(wazap)-left
if k<left:
  print(wazap[k]+1)
else:
  print(wazap[(k-left)%loop+left]+1)
n = int(input())

a = [0]*n

for x in range(1, int(sqrt(n))+1):
    for y in range(1, x+1):
        for z in range(1, y+1):
            t = x**2+y**2+z**2+x*y+y*z+z*x-1
            if t >= n:
                break
            if ((x==y)and(y!=z))or((x==z)and(y!=x))or((y==z)and(x!=z)):
                a[t] = 3
            elif (x!=y)and(y!=z)and(x!=z):
                a[t] = 6
            else:
                a[t] = 1

for i in range(n):
    print(a[i])

### FIXED CODE ###

l, r, d = map(int, input().split())

ans = int(r/d)-int((l-1)/d)
print(ans)
def is_unique(seq):
    return len(seq) == len(set(seq))

## 最初に入力回数が与えられて、そのあとデータが入力される。といったパターン
N = int(input())
a = []
for i in range(N):
    a.append(input()) # ３度の入力に対して、1, 2, 3 と入力。
#print(a) # ['1', '2', '3']

if not(is_unique(a)):
	print("No")
	exit(99)

last_char=""
counter=0
for item in a:
	if counter == 0:
		last_char = item[-1]
		counter = 1
	else:
		if(len(item)):
			print("No")
			exit(99)
		if not (item[0] == last_char):
			print("No")
			exit(99)
		else:
			last_char = item[-1]
			
print("Yes")

### FIXED CODE ###

import sys
def is_unique(seq):
    return len(seq) == len(set(seq))

## 最初に入力回数が与えられて、そのあとデータが入力される。といったパターン
N = int(input())
a = []
for i in range(N):
    a.append(input()) # ３度の入力に対して、1, 2, 3 と入力。
#print(a) # ['1', '2', '3']

if not(is_unique(a)):
	print("No")
	sys.exit()

last_char=""
counter=0
for item in a:
	if counter == 0:
		last_char = item[-1]
		counter = 1
	else:
		if(len(item) > 11):
			print("No")
			sys.exit()
		if not (item[0] == last_char):
			print("No")
			sys.exit()
		else:
			last_char = item[-1]
			
print("Yes")
n, m, q = map(int, input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int,input().split())
A_list = []
for p in itertools.combinations_with_replacement(range(1,m+1),n):
    A_list.append(p)
# print(A_list)

ans = 0
for v in A_list:
    cur_score = 0
    for i in range(q):
        if v[b[i]-1] - v[a[i]-1] == c[i]:
            cur_score += d[i]
    ans = max(ans,cur_score)
print(ans)

### FIXED CODE ###

import itertools
n, m, q = map(int, input().split())
a = [0] * q
b = [0] * q
c = [0] * q
d = [0] * q
for i in range(q):
    a[i], b[i], c[i], d[i] = map(int,input().split())
A_list = []
for p in itertools.combinations_with_replacement(range(1,m+1),n):
    A_list.append(p)
# print(A_list)

ans = 0
for v in A_list:
    cur_score = 0
    for i in range(q):
        if v[b[i]-1] - v[a[i]-1] == c[i]:
            cur_score += d[i]
    ans = max(ans,cur_score)
print(ans)
text = "1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51"
textList = text.split(",")
firstInputText = input()
print(textList[int(firstInputText) - 1])
secondInputText = input()
print(textList[int(secondInputText) - 1])


### FIXED CODE ###

list = [1,1,1,2,1,2,1,5,2,2,1,5,1,2,1,14,1,5,1,5,2,2,1,15,2,2,5,4,1,4,1,51]
firstInputText = input()
print(list[int(firstInputText) - 1])
import sys
sys.setrecursionlimit(100000)

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(n)]for i in range(m)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

ans=0


def dfs(v,n,visi):
    allv=True

    for i in visi:
        if not i:
            allv=False

    if allv:
        return 1

    ret=0

    for i in range(n):
        if G[v][i]==False:
            continue
        if visi[i]:
            continue
        visi[i]=True
        ret+=dfs(i,n,visi)
        visi[i]=False

    return ret

n,m=map(int,input().split())
ab=[list(map(int,input().split()))for i in range(m)]
G=[[False for i in range(8)]for i in range(8)]

for a,b in ab:
    G[a-1][b-1]=G[b-1][a-1]=True

visi=[False for i in range(n)]

visi[0]=True

print(dfs(0,n,visi))
list=[]
for i in range 3:
  list.append(int(input()))
if list[0]==list[1]:
  if list[1]==list[2]:
    print("No")
  else:
    printf("Yes")
    
else:
  if list[0]==list[2] or list[1]==list[2]:
    print("Yes")
  else:
    print("No")

### FIXED CODE ###

a,b,c = input().strip().split()

if a==b:
  if b==c:
    print("No")
  else:
    print("Yes")
    
else:
  if a==c or b==c:
    print("Yes")
  else:
    print("No")
# -*- coding: utf-8 -*-
x, N = map(int, input().split())
p1, p2, p3, p4, p5 = map(int, input().split())
num_list = [p1, p2, p3, p4, p5]

min_abs = 100
min_num = 0

for num in range(1, 101):
    if num in num_list:
        continue
    else:
        b = abs(num-x)
        if b < min_abs:
            min_abs = b
            min_num = num
            
print(min_num)

### FIXED CODE ###

# -*- coding: utf-8 -*-
x, N = map(int, input().split())

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

i = 0            
while True:
    a = x - i
    b = x +i
    if not a in num_list:
        min_num = a
        break
    elif not b in num_list:
        min_num = b
        break
    else:
        i += 1
            
print(min_num)
n=int(input())
l = set(map(int,input().split()))
l2 = list(l)
if n % 3 != 0:
    print("No")
elif len(l) != 3:
  if len(l)==1 and l2[0]==0:
    print("Yes")
  elif len(l)==2 and ((l2[0]^l2[1]==l2[1] and l2[1]^l2[1]==l2[0]) or　(l2[0]^l2[1]==l2[0] and l2[1]^l2[1]==l2[0]) or (l2[1]^l2[0]==l2[0] and l2[0]^l2[0]==l2[1]) or (l2[1]^l2[0]==l2[1] and l2[0]^l2[0]==l2[1])):
    print("Yes")
  else:
    print("No")
else:
    if (l2[0] ^ l2[1] == l2[2]) and (l2[1] ^ l2[2] == l2[0]) and (l2[2] ^ l2[0] == l2[1]):
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

n=int(input())
l = list(map(int,input().split()))
s = set(l)
sl = sorted(list(s))
if len(s)==1 and sl[0]==0:
  print("Yes")
elif n%3==0 and len(s)==2 and l.count(sl[1])==2*n//3 and l.count(sl[0])==n//3 and sl[0]==0:
  print("Yes")
elif n%3==0 and len(s)==3 and l.count(sl[0])==l.count(sl[1])==l.count(sl[2]):
  if sl[0]^sl[1]^sl[2]==0:
    print("Yes")
  else:
    print("No")
else:
  print("No")
n = list(map(int, input().split()))
h = list(map(int, input().split()))
c = 0
for i in range(n[0]):
  if h[i] => n[1]:
    c += 1
    
print(c)

### FIXED CODE ###

n = list(map(int, input().split()))
h = list(map(int, input().split()))
c = 0
for i in range(n[0]):
  if h[i] >= n[1]:
    c += 1
    
print(c)
import itertools
while 1:
	n = input()
	if n == 0: break
	a = sorted(map(int,raw_input().split()))
	all = sum(a)
	ans = all
	for i in range((n+1)/2+1):
		c = 0
		for party in itertools.combinations(a,i):
			d = all-2*sum(party)
			if c == 0 and d < -ans
				break
			ans = min(ans,abs(d))
			c = 1
	print ans

### FIXED CODE ###

def S(i,x,y):
	if 2*x >= A: return 2*x-A
	if 2*y >= A: return 2*y-A
	return min(S(i+1,x+a[i],y),S(i+1,x,y+a[i]))
while 1:
	n = input()
	if n == 0: break
	a = sorted(map(int,raw_input().split()))[::-1]
	A = sum(a)
	print S(1,a[0],0)
import math
import statistics
import numpy as np
size = int(input())
A = np.array(list(map(int,input().split())))
i = np.array(list(range(1,size+1)))

remain_list = A-i
median = statistics.median(remain_list)
print(sum(remain_list - median))A


### FIXED CODE ###

import math
import statistics
import numpy as np
size = int(input())
A = np.array(list(map(int,input().split())))
i = np.array(list(range(1,size+1)))

remain_list = A-i
median = statistics.median(remain_list)
print(int(sum(abs(remain_list - median))))
def is_reachable(edges,start,end):
  g = {}
  for f,t,w in edges:
    if f in g: g[f].append(t)
    else: g[f] = [t]
  visiting = [start]
  visited = []
  while visiting:
    v = visiting.pop()
    if v in visited: continue
    if v == end: return True
    visited[v] = True
    for v2 in g.get(v, ()):
      if v2 in visited or v2 in visiting: continue
      visiting.append(v2)
  return False

N,M,P = map(int, input().split())

edges = []
for _ in range(M):
    a,b,c = map(int, input().split())
    edges.append((a,b,c))

neg_inf = float("-Inf")
no_answer = False

start = 1
end = N

distance = {}
for i in range(1,N+1):
  distance[i] = neg_inf
distance[start] = 0
previous = {}

for i in range(N-1):
    for f,t,w in edges:
        if distance[f] + w - P > distance[t]:
            distance[t] = distance[f] + w - P
            previous[t] = f

path = []
node = end
while node != start:
    path.append(node)
    node = previous[node]
path.append(start)

for f,t,w in edges:
    if distance.get[f] + w - P > distance[t] and is_reachable(edges,t,end):
        no_answer = True
        break

if no_answer:
    print(-1)
else:
    print(max(0,distance[end]))


### FIXED CODE ###

def is_reachable(edges,start,end):
  g = {}
  for f,t,w in edges:
    if f in g: g[f].append(t)
    else: g[f] = [t]
  visiting = [start]
  visited = {}
  while visiting:
    v = visiting.pop()
    if v in visited: continue
    if v == end: return True
    visited[v] = True
    for v2 in g.get(v, ()):
      if v2 in visited or v2 in visiting: continue
      visiting.append(v2)
  return False

N,M,P = map(int, input().split())

edges = []
for _ in range(M):
    a,b,c = map(int, input().split())
    edges.append((a,b,c))

neg_inf = float("-Inf")
no_answer = False

start = 1
end = N

distance = {}
for i in range(1,N+1):
  distance[i] = neg_inf
distance[start] = 0

for i in range(N-1):
    for f,t,w in edges:
        if distance[f] + w - P > distance[t]:
            distance[t] = distance[f] + w - P

for f,t,w in edges:
    if distance[f] + w - P > distance[t] and is_reachable(edges,t,end):
        no_answer = True
        break

if no_answer:
    print(-1)
else:
    print(max(0,distance[end]))