Harryxun/stf_run huggingface dataset:
s = list(input())
N = len(s)
a = [0] * (10+N)
if(s[0] == '<'): p = 0
else: p = 1
count = 0
count2 = 0
sum_ = 0
start = 0
end = 0
for i in range(N):
    if ((s[i] == '>')& (p == 0)):
        #print('a')
        count2 += 1
        p = 1
        max_ = i
    elif(p == 0):
        #print('b')
        count += 1
    elif(s[i] == '<'):
        #print('c')
        end = i
        if(count > count2):
            t = count
            a[max_] = t
            max_ -= 1
            t -= 1
            while(t >= 0):
                a[max_] = t
                max_ -= 1
                t -= 1
            k = 0
            a[end] = 0
            k += 1
            while(k < count2):
                a[end-k] = k
                k += 1
        else:
            t = count2
            a[max_] = t
            max_ += 1
            t -= 1
            while(t >= 0):
                a[max_] = t
                max_ += 1
                t -= 1
            k = 0
            a[start] = 0
            k += 1
            while(k < count):
                a[start+k] = k
                k += 1
        p = 0
        start = i
        count = 1
        count2 = 0
        max_ = 0
        #print(a)
    else:
        #print('d')
        count2 += 1
        
if(count > count2):
    if(max_==0):
        max_= N
    t = count
    a[max_] = t
    max_ -= 1
    t -= 1
    while(t >= 0):
        a[max_] = t
        max_ -= 1
        t -= 1
    k = 0
    a[end] = 0
    k += 1
    while(k < count2):
        a[end-k] = k
        k += 1
else:
    t = count2
    a[max_] = t
    max_ += 1
    t -= 1
    while(t >= 0):
        a[max_] = t
        max_ += 1
        t -= 1
    k = 0
    a[start] = 0
    k += 1
    while(k < count):
        a[start+k] = k
        k += 1
sum(a)

### FIXED CODE ###

s = list(input())
N = len(s)
a = [0] * (10+N)
if(s[0] == '<'): p = 0
else: p = 1
count = 0
count2 = 0
A = 0
start = 0
end = 0

for i in range(N):
    if ((s[i] == '>')& (p == 0)):
        #print('a')
        count2 += 1
        p = 1
        max_ = i
    elif(p == 0):
        #print('b')
        count += 1
    elif(s[i] == '<'):
        #print('c')
        end = i
        if(count > count2):
            count2 -=1
            A += count*(count+1)/2
            A += count2*(count2+1)/2
        else:
            count -=1
            A += count*(count+1)/2
            A += count2*(count2+1)/2
        p = 0
        start = i
        count = 1
        count2 = 0
        max_ = 0
    else:
        #print('d')
        count2 += 1
if(count > count2):
    count2 -=1
    A += count*(count+1)/2
    A += count2*(count2+1)/2
else:
    count -=1
    A += count*(count+1)/2
    A += count2*(count2+1)/2
print(int(A))
import re
s=input()
r=[0]
for i in re.finditer("[ACGT]+", s):
    r.append(len(i[0]))
print(max(r))


### FIXED CODE ###

import re
s=input()
r=[0]
for i in re.finditer("[ACGT]+", s):
    r.append(len(i.group()))
print(max(r))
import heapq
from collections import deque
from copy import copy
n,k = map(int,input().split())
d = deque(list(map(int,input().split())))
maxvalue = 0
for i in range(k):
    for j in range(k-i+1):
        jewel = []
        x = copy(d)
        for _ in range(i):
            jewel.append(x.popleft())
        for _ in range(j):
            jewel.append(x.pop())
        heapq.heapify(jewel)
        for _ in range(k-i-j):
            if jewel:
                a = heapq.heappop(jewel)
                if a >= 0:
                    jewel.append(a)
                    break
        maxvalue = max(maxvalue,sum(jewel))
print(maxvalue)

        

### FIXED CODE ###

import heapq
from collections import deque
from copy import copy
n,k = map(int,input().split())
d = deque(list(map(int,input().split())))
maxvalue = 0
for i in range(k+1):
    for j in range(k-i+1):
        jewel = []
        x = copy(d)
        for _ in range(i):
            if x:
                jewel.append(x.popleft())
        for _ in range(j):
            if x:
                jewel.append(x.pop())
        heapq.heapify(jewel)
        for _ in range(k-i-j):
            if jewel:
                a = heapq.heappop(jewel)
                if a >= 0:
                    jewel.append(a)
                    break
        maxvalue = max(maxvalue,sum(jewel))
print(maxvalue)
n = int(input())
nums = [int(i) for i in input().split()]

bool = True
for i in range(n, 0, -1):
    t = nums[i] - 1
    if t < nums[i-1]:
        bool = False

if bool:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

a, b, c = map(int, input().split())
ans = b+c-a
if ans < 1:
    print(int(0))
else:
    print(ans)
import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

o = input()
e = input()
ans = ""
for i in range(len(o) + len(e)):
    if i%2 == 0:
        ans += o[i]
    else:
        ans += e[i]
print(ans)

### FIXED CODE ###

import collections
import sys
import numpy as np
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
MOD = 10**9+7
import itertools
import math

o = input()
e = input()
ans = ""
for i in range(len(e)):
    ans += o[i] + e[i]
if len(o)>len(e):
    ans += o[-1]
print(ans)
x=int(input())
s=list(input())
su=s
for i in range(len(s)-1):
    if s[i]==s[i+1]:
        su.pop(i)
    else:
        pass
print(len(su))

### FIXED CODE ###

n=int(input())
a=input()
s=list(a)
b=list(a)
j=0
for i in range(0,n-1):
    if s[i]==s[i+1]:
        b.pop(i-j)
        j=j+1
    else:
        pass
print(len(b))
N, K = map(int, input().split())
V = list(map(int, input().split()))
hand = []
ps = []
def func(V, hand, K):
    if K < 1:
        ps.append(hand)
        return
    if len(hand) > 0 and min(hand) < 0:
        hand_ = hand[:]
        hand_, min_val = handPop(hand_)
        C = func([min_val] + V, hand_, K-1)
        D = func(V + [min_val], hand_, K-1)
        A = func(V[1:], hand+[V[0]], K-1)
        B = func(V[:-1], hand+[V[-1]], K-1)
    else:
        A = func(V[1:], hand+[V[0]], K-1)
        B = func(V[:-1], hand+[V[-1]], K-1)

    
func(V, hand, K)
v_max = max([sum(x) for x in ps])
print(v_max if v_max > 0 else 0)

### FIXED CODE ###

N, K = map(int, input().split())
V = list(map(int, input().split()))
ans = 0
for L in range(min(N, K+1)):
    for R in range(min(N-L, K-L)+1):
        js = V[:L] + V[-R:] if R > 0 else V[:L]
        t = K - L - R
        s = 0
        for i in sorted(js):
            if i < 0 and t > 0:
                s += -i
                t -= 1
        ans = max(ans, sum(js) + s)
print(ans)
a=input()
for i in range(0,len(a)-1):
	if a[i]==a[i+1]:
		print(i+1,i+2)
		exit()
	elif i<len(a)-1:
		if a[i]==a[i+2]:
			print(i+1,i+3)
			exit()
print(-1,-1)

### FIXED CODE ###

a=input()
for i in range(0,len(a)-1):
	if a[i]==a[i+1]:
		print(i+1,i+2)
		exit()
	elif i<len(a)-2:
		if a[i]==a[i+2]:
			print(i+1,i+3)
			exit()
print(-1,-1)
from bisect import bisect_left
N, S = map(int, input().split())
x = list(map(int, input().split()))
x.sort()
i = bisect_left(x, S)
if x[i] != S:
    x.insert(i, S)
    N += 1
diff = []
for i in range(N - 1):
    diff.append(x[i + 1] - x[i])

# 最小公倍数を求める
def lcm(a, b):
    while b != 0:
        a, b = b, a % b
    return a
ans = diff[0]
for d in diff[1:]:
    ans = lcm(ans, d)
print(ans)

### FIXED CODE ###

N, S = map(int, input().split())
x = list(map(int, input().split()))
x.append(S)
x.sort()
diff = []
for i in range(N):
    diff.append(x[i + 1] - x[i])

# 最小公倍数を求める
def lcm(a, b):
    while b != 0:
        a, b = b, a % b
    return a

ans = diff[0]
for d in diff[1:]:
    ans = lcm(ans, d)
print(ans)
N = int(input())
A, B, AB = 'A', 'B', 'AB'
endA, startB = 0, 0
ans = 0

for _ in range(N):
    S = input()

    if S[0] == B:
        startB += 1

        if S[-1] == A:
            endA += 1
            startB_endA += 1

    elif S[-1] == A:
        endA += 1
    

    for i in range(1,len(S)):
        if S[i-1] + S[i] == AB:
            ans += 1

ans += min(endA, startB)

print(ans)

### FIXED CODE ###

import sys

input = sys.stdin.readline

N = int(input())
A, B, AB = 'A', 'B', 'AB'
endA, startB, startB_endA = 0, 0, 0
ans = 0

for _ in range(N):
    S = input().rstrip()

    if S[0] == B:
        startB += 1

        if S[-1] == A:
            startB -= 1
            startB_endA += 1

    elif S[-1] == A:
        endA += 1
    

    for i in range(1,len(S)):
        if S[i-1] + S[i] == AB:
            ans += 1


if startB_endA == 0:
    ans += min(endA, startB)

elif endA == 0 and startB == 0:
    ans += max(0, startB_endA - 1)

else:
    ans += startB_endA + min(endA, startB)

print(ans)
import sys

N = int(input())
xyh = []
for _ in range(N):
    x, y, h = map(int, input().split())
    xyh.append(tuple(x, y, h))

for X in range(101):
    for Y in range(101):
        flag = True
        H = 0
        for cx, cy, ch in xyh:
            if ch != 0:
                H = ch + abs(X - cx) + abs(Y - cy)
        for cx, cy, ch in xyh:
            h  max(h - abs(X - cx) - abs(Y - cy), 0)
            if ch != h:
                flag = False

        if flag:
            print(X, Y, H)
            sys.exit(0)


### FIXED CODE ###

import sys

N = int(input())

list = []
for i in range(0, N):
    x, y, h = [int(x) for x in input().split()]
    list.append((x, y, h))

for X in range(0, 101):
    for Y in range(0, 101):
        b = True
        H = 0
        for Cx, Cy, Ch in list:
            if Ch != 0:
                H = Ch + abs(X - Cx) + abs(Y - Cy)
        for Cx, Cy, Ch in list:
            h = max(H - abs(X - Cx) - abs(Y - Cy), 0)
            if Ch != h:
                b = False
        if b == True:
            print(X, Y, H)
            sys.exit(0)
a,b = map(int, input().split())
c = mod(a*b, 2)
if (c == 0)
	print("Odd")
else if
	print("Even")

### FIXED CODE ###

a,b = map(int, input().split())
c = a*b % 2
if (c == 1):
	print("Odd")
else:
	print("Even")
# ABC-128-B
# score_sorted = sorted(score.items(), key=lambda x:x[0])
r_list = []
ans_list = []
N = int(input())
for i in range(1, N+1):
    Si, Pi = input().split()
    r_list.append((Si, int(Pi), i))
    
name_sorted_list = sorted(r_list, key=lambda x:x[0])
while len(name_sorted_list) > 0:
    test_list = []
    list_index = [i for i, x in enumerate(name_sorted_list) if x  == name_sorted_list[1]]
    for i in list_index:
        test_list.append(name_sorted_list[i])
        del name_sorted_list[i]
    test_list = sorted(test_list, key=lambda x:x[1])
    for item in test_list:
        ans_list.append(item)

for item in ans_list:
    print(item[2])

### FIXED CODE ###

r_list = []
ans_list = []
N = int(input())
for i in range(1, N+1):
    Si, Pi = input().split()
    r_list.append((Si, int(Pi), i))
    
name_sorted_list = sorted(r_list, key=lambda x:x[0])

while len(name_sorted_list) > 0:
    test_list = []
    list_index = [i for i, x in enumerate(name_sorted_list) if x[0]  == name_sorted_list[0][0]]
    for i in list_index:
        test_list.append(name_sorted_list[i])
    for i in reversed(list_index):
        del name_sorted_list[i]
    test_list = sorted(test_list, key=lambda x:x[1], reverse = True)
    for item in test_list:
        ans_list.append(item)
    
for item in ans_list:
    print(item[2])
k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if x+y+z<=s:
      ans+=1
print(ans)


### FIXED CODE ###

k,s=map(int,input().split())
ans=0
for x in range(k+1):
  for y in range(k+1):
    if s-k<=x+y<=s:
      ans+=1
print(ans)
n = int(input())
if n > 81:
    print("No")
else:
    is_ok = False
    for x in range(1, 10):
        if n % x == 0 and n // x <= 9:
            is_ok = True
            break

if is_ok:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

n = int(input())
if n > 81:
    print("No")
else:
    is_ok = False
    for x in range(1, 10):
        if n % x == 0 and n // x <= 9:
            is_ok = True
            break
    if is_ok:
        print("Yes")
    else:
        print("No")
n = input()
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m = 3:
  print("bon")
else:
  print("pon")

### FIXED CODE ###

n = int(input())
m = n % 10

if m == 2 or m == 4 or m == 5 or m == 7 or m == 9:
  print("hon")
elif m == 3:
  print("bon")
else:
  print("pon")
import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

waru=(10**9)+7

for i in range(k):
    ans=combinations_count(n-k+1, i+1)
    ans*=pow(i+1, k-i-1)
    print(ans%waru)

### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

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

waru=(10**9)+7
# if n==k:
#     print(1)
#     for i in range(k-1):
#         print(0)
#     quit()

for i in range(k):
    if n-k+1<i+1:
        print(0)
    else:
        ans=combinations_count(n-k+1, i+1)
        ans*=combinations_count(k-1, i)
        print(ans%waru)
# 0<=a<=bのときの攻め方 ... 進むしかないね
# 0<=b<=a   ... 一回だけ符号をかえたらあとは進むしかないね
# a<=0<=b   ... abs(a)<abs(b)なら符号をかえたらショートカットできるね ちがったらすすむしかないね
# b<=0<=a   ... abs(a)<abs(b)ならすすんでから符号かえればいいね ちがったら符号かえてからすすめばいいね これは同じことだよ
# a<=b<=0   ... 進むしかないね
# b<=a<=0   ... 符号変えてすすんで符号かえればいいね
a, b = map(int, input().split())
if 0 <= a <= b:
    print(b - a)
elif 0 <= b <= a:
    print(1 + a - b)
    raise ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
elif a <= 0 <= b:
    if abs(a) <= abs(b):
        print(1 + b - abs(a))
    else:
        print(abs(b) + abs(a))
elif b <= 0 <= a:
    print(1 + abs(abs(b) - abs(a)))
elif a <= b <= 0:
    print(abs(b - a))
elif b <= a <= 0:
    print(2 + abs(abs(b) - abs(a)))
else:
    raise "fuck"


### FIXED CODE ###

# 0<x<yだとインクリメント、などのような分岐

x, y = map(int, input().split())
if 0<=x<y:
  print(y-x)
elif y<x:
  print(min(2+abs(x-y), 1+abs(-x-y)))
else:
  print(min(abs(y-x), 1+abs(-y-x)))
mport sys
import collections
input=sys.stdin.readline

n=int(input())
l=[int(input()) for i in range(n)]
ls=collections.Counter(l)
#print(ls)
a=0
for value in ls.values():
    if value%2==1:
        a+=1
print(a)

### FIXED CODE ###

import sys
import collections
input=sys.stdin.readline

n=int(input())
l=[int(input()) for i in range(n)]
ls=collections.Counter(l)
#print(ls)
a=0
for value in ls.values():
    if value%2==1:
        a+=1
print(a)
N, Q = map(int,input().split())
tree = [[0] for i in range(N+1)]
for i in range(N-1):
    a,b = map(int,input().split())
    if tree[a] == [0]:
        tree[a] = [b]
    else:
        tree[a].append(b)
counter = [0 for i in range(N+1)]
def dfs(p,x):
    if p == 0:
        return
    counter[p] += x
    for i in tree[p]:
        dfs(i,x)   
    
for i in range(Q):
    p,x = map(int,inupt().split())
    dfs(p,x)
print(counter[1:])

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline()[:-1]
 
n,q = map(int, input().split())
#長さn個のリストを入れ子にしたリストの作成：adj
adj = [[] for i in range(n)]
 
#adjに繋がっている要素を上流下流関わらず全て加える。
for j in range(n-1):
    a,b=map(int, input().split())
    adj[a-1].append(b-1)
    adj[b-1].append(a-1) 
 
#加算する値を合計したリストの作成
queries = [0 for i in range(n)]
for j in range(q):
    p, x = map(int, input().split())
    queries[p-1] += x
 
ans = [0 for i in range(n)]
 
#aの値，直前の値，直前のaの値
st = [(0, 0, -1)] 
 
#つながってる奴の一番後ろから処理していく。
#０スタート→1,2繋がってるなら2にいく。2に3が繋がってるなら次は3。
#3に繋がってるのがなければ1に戻る。
#この際，aの直前の値をタプルで保持したままリストに挿入して保管しておく。
while st:
    #stの先頭を取り出す。初期値は末尾のため-1
    l = st.pop()  
    ans[l[0]] = l[1] + queries[l[0]]
    for v in adj[l[0]]:
        if v != l[2]:
            st.append((v, ans[l[0]], l[0]))
 
print(*ans)
# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0

Am = A - (A // C + A // D - A //lcm(C,D))
Bm = B - (B // C + B // D - B //lcm(C,D))
ans = Bm - Am

if A % C != 0 and A % D != 0:
	ans += 1
print(ans)

def lcm(x, y):
	return (x * y) // gcd(x, y)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

### FIXED CODE ###

# -*- coding: utf-8 -*-
A, B, C, D = map(int, input().split())
ans = 0
Am = 0
Bm = 0
df = 0
t = 0

def lcm(x, y):
	return (x * y) // gcd(x, y)

def gcd(a, b):
	while b:
		a, b = b, a % b
	return a

t = B - A + 1
Am = B // C - (A - 1) // C
Bm = B // D - (A - 1) // D
df = B // lcm(C, D) - (A - 1)//lcm(C, D)
ans = t - (Am + Bm) + df
print(ans)
# coding:UTF-8

# 入力値の受け取り
'''
input_list[0]→A
input_list[1]→B
input_list[2]→T
'''
input_list = input().split()

# 合計枚数の算出
print((input_list[2] + 0.5) // input_list[0] * input_list[1])

### FIXED CODE ###

# coding:UTF-8

# 入力値の受け取り
input_list = input().split()

num_A = int(input_list[0])
num_B = int(input_list[1])
num_T = int(input_list[2])

# 合計枚数の算出
output_answer = int((num_T + 0.5) // num_A * num_B)
print(output_answer)
for e in iter(input,'0 0'):
 N,M=map(int,e.split())
 S=[int(input())for _ in[0]*N]
 print(S)
 p=b=1
 for i in range(M):
  d=int(input())
  p+=d
  p+=S[~-p]
  print('pos', p)
  if(N<=p)*b:print(-~i);b=0


### FIXED CODE ###

import sys
r=sys.stdin.readline
for e in iter(r,'0 0\n'):
 N,M=map(int,e.split())
 k,p=1,0
 S=[int(r())for _ in[0]*N]
 for d in[int(r())for _ in[0]*M]:
  p+=d;
  if p<N:p+=S[p]
  if N<=p+1:break
  k+=1
 print(k)
N,M = map(int,input().split())
S = input()
N0 = 2**(N+1).bit_length()
INF = 2**31-1

# k番目の要素をxに更新
def update(k, x, data):
    k += N0-1
    data[k] = x
    while k >= 0:
        k = (k - 1) // 2
        data[k] = min(data[2*k+1], data[2*k+2])

# [l,r)の最小値
def query(l, r, data):
    L = l + N0; R = r + N0
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])

        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s



data1 = [INF]*(2*N0)
update(0,0,data1)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data1)+1,data1)

S = S[::-1]
data2 = [INF]*(2*N0)
update(0,0,data2)
for n in range(N):
    if S[n+1]=='0':
        update(n+1,query(n-M+1,n+1,data2)+1,data2)

cost1 = [INF]*(N+1)
cost2 = [INF]*(N+1)
for n in range(N+1):
    cost1[n] = query(n,n+1,data1)
    cost2[n] = query(N-n,N-n+1,data2)

ans = []
cost = 0
for n in range(N+1):
    if cost != cost1[n] and cost1[n]+cost2[n]==cost1[N]:
        ans.append(n)
        cost = cost1[n]
ans = [0]+ans
for i in range(len(ans)-2,-1,-1):
    ans[i+1] = ans[i+1]-ans[i]

ans = ' '.join([str(c) for c in ans[1:]])
if cost2[0]==INF:
    ans = '-1'
print(ans)

### FIXED CODE ###

d = {'SUN':7,'MON':6,'TUE':5,'WED':4,'THU':3,'FRI':2,'SAT':1}
print(d[input()])
s=input()
if s=='RRR':
    print(3)
elif s=='RRS':
    print(2)
elif s=='RSR':
    print(1)
elif s=='SRR':
    pront(2)
elif s=='SSR':
    print(1)
elif s=='SRS':
    print(1)
elif s=='RSS':
    print(1)
elif s=='SSS':
    print(0)

### FIXED CODE ###

s=input()

if 'RRR' in s:
    print(3)
elif 'RR' in s:
    print(2)
elif 'SSS' in s:
    print(0)
else :
    print(1)
import numpy as np

N,K = map(int, input().split())
h = np.array(list(map(int,input().split())))

dp = np.zeros(N, dtype = int)

for i in range(1,N):
  s = max(i-k,0)
  dp[i] = np.min(dp[s:i]+ np.abs(h[s:i] - h[i]))
  
print(dp[-1])
    


### FIXED CODE ###

import numpy as np

N,K = map(int, input().split())
h = np.array(list(map(int,input().split())))

dp = np.zeros(N, dtype = int)

for i in range(1,N):
  s = max(i-K,0)
  dp[i] = np.min(dp[s:i]+ np.abs(h[s:i] - h[i]))
  
print(dp[-1])
n, m = map(int, input().split())
l = [list(input().split()) for i in range(m)]
for num in range(1000):
    if m == 0:
        if n == 1:
            print(0)
            exit()
        else:
            print(10**(n-1))
            exit()    
    for i in range(m):
        if len(str(num)) < n:
            break
        if str(num)[int(l[i][0])-1] != l[i][1]:
            break
    else:
        print(num)
        exit()
print(-1)

### FIXED CODE ###

import math
n = int(input())
print(math.ceil(n/2))
# python template for atcoder1
from functools import reduce
from math import log2
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def floor(x, y):
    return int((-x)//y*(-1))


def floorlog(x):
    if x > 0:
        return floor(log2(x), 1)
    else:
        return 0


def XXor(X, A):
    #    print("x,a->", X, A)
    return X ^ A


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


def xorSum(X):
    ret = 0
    for a in A:
        ret += XXor(X, a)
    return ret


def solve():

    ans = 0
    ans_x = 0
    for x in range(K+1):
        tmp = xorSum(x)
        if tmp > ans:
            ans = tmp
            ans_x = x
    # print("ans_x->", ans_x)

    return ans


def solve2():
    a = sorted(A, reverse=True)
    ans = reduce(XXor, a)
    k_log = floorlog(K)
    a_log = floorlog(a[0])
    if k_log == a_log:
        ans = ans
    else:
        a.ppend(K)
        ans = reduce(XXor, a)

    return xorSum(ans)


# print("1---->", solve())
# print("2----->", solve2())
print(solve2())


### FIXED CODE ###

# python template for atcoder1
from functools import reduce
from math import log2
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def floor(x, y):
    return int((-x)//y*(-1))


def floorlog(x):
    if x > 0:
        return floor(log2(x), 1)
    else:
        return 0


def XXor(X, A):
    #    print("x,a->", X, A)
    return X ^ A


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


def xorSum(X):
    ret = 0
    for a in A:
        ret += XXor(X, a)
    return ret


def solve():

    ans = 0
    ans_x = 0
    for x in range(K+1):
        tmp = xorSum(x)
        if tmp > ans:
            ans = tmp
            ans_x = x
    # print("ans_x->", ans_x)

    return ans


def solve2():
    ans = 0
    for i in reversed(range(0, 40)):
        b = sum([(a >> i) % 2 for a in A])*2 < N
        if b and ans+(1 << i) <= K:
            ans += (1 << i)
        else:
            continue
    return xorSum(ans)


print(solve2())
n = int(input())
if n < 1199:
  print("ABC")
elif n < 2800:
  print("ARC")
else:
  print("AGC)

### FIXED CODE ###

n = int(input())
if n < 1200:
  print("ABC")
elif 1200 <= n < 2800:
  print("ARC")
else:
  print("AGC")
n,k=input().split();print(len(str(int(n,int(k)))))

### FIXED CODE ###

n,k=map(int,input().split())
c=0
while n:n//=k;c+=1
print(c)
x,a,b=map(int,input().split())
print("A" if (abs(a-b)<abs(a-c)) else "B")

### FIXED CODE ###

x,a,b=map(int,input().split())
print("A" if (abs(a-x)<abs(b-x)) else "B")
N = int(input())
H = [int(x) for x in input().split()]
C = 0
for i in range(N-1):
  if H[i] <= H[i+1]+1:
    C += 1
if C == N-1 OR C == N:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

N = int(input())
H = [int(x) for x in input().split()]
C = 0
for i in range(N-1):
  if H[i] > H[i+1]:
    H[i+1]=H[i+1]+1
  if H[i] <= H[i+1]:
    C += 1
if C == N-1:
  print("Yes")
else:
  print("No")