Harryxun/stf_run huggingface dataset:
#!/usr/bin/env python
# coding: utf-8

# In[1]:


import sys
import numpy as np
import itertools
input = sys.stdin.readline
N, M = map(int, input().split())
l = [list(map(int, input().split())) for i in range(M+1)]


# In[ ]:


"""
5 2
3 1 2 5
2 2 3
1 0
"""


# In[4]:


#print(l)
import numpy as np


# In[9]:


s = range(N)
cnt = 0
# N個がonになる
for e in range(1, N+1):
    c = list(itertools.combinations(s,e))# N個onになる通り
    o = list(range(N))
    for b in c:
        #print(b)
        a = np.zeros((N))
        for d in b:
            a[d] = 1
        #print(a)
        for i in range(M):
            sum_ = 0
            for j in range(l[i][0]):
                ind = l[i][j+1]-1
                #print(ind)
                sum_ += a[ind]
            o[i] = sum_%2==l[-1][i]
        if np.all(o):
            cnt += 1
#0個on
o = list(range(N))
for i in range(M):
    sum_ = 0
    for j in range(l[i][0]):
        ind = l[i][j+1]-1
        sum_ += a[ind]
    o[i] = sum_%2==l[-1][i]
if np.all(o):
    cnt += 1
print(cnt)


# In[ ]:


"""
2 2
2 1 2
1 2
0 1
"""



### FIXED CODE ###

#!/usr/bin/env python
# coding: utf-8

# In[12]:


import sys
#import numpy as np
import itertools
input = sys.stdin.readline
N, M = map(int, input().split())
l = [list(map(int, input().split())) for i in range(M+1)]


# In[ ]:


"""
5 2
3 1 2 5
2 2 3
1 0
"""


# In[4]:


#print(l)
#import numpy as np


# In[15]:


cnt = 0
#print(itertools.product(range(0, 2), repeat=N))
for on in itertools.product(range(0, 2), repeat=N):
    for i in range(M):
        sum_ = 0
        for j in range(l[i][0]):
            ind = l[i][j+1]-1
            sum_ += on[ind]
        if sum_%2 != l[-1][i]:
            break
    else:
        cnt += 1
print(cnt)

"""
s = range(N)
cnt = 0
# N個がonになる
for e in range(1, N+1):
    c = list(itertools.combinations(s,e))# N個onになる通り
    o = list(range(N))
    for b in c:
        #print(b)
        a = np.zeros((N))
        for d in b:
            a[d] = 1
        #print(a)
        for i in range(M):
            sum_ = 0
            for j in range(l[i][0]):
                ind = l[i][j+1]-1
                #print(ind)
                sum_ += a[ind]
            o[i] = sum_%2==l[-1][i]
        if np.all(o):
            cnt += 1
#0個on
o = list(range(N))
a = np.zeros((N))
for i in range(M):
    sum_ = 0
    for j in range(l[i][0]):
        ind = l[i][j+1]-1
        sum_ += a[ind]
    o[i] = sum_%2==l[-1][i]
if np.all(o):
    cnt += 1
print(cnt)
"""


# In[ ]:


"""
2 2
2 1 2
1 2
0 1
"""
N, M = map(int, input().split())
A = [ int(a) for a in input().split() ]
A.sort(reverse=True)
 
for m in range(M):
    A[0] = A[0] // 2
    A.sort(reverse=True)
 
print(sum(A))

### FIXED CODE ###

S = input()

if S == 'Sunny':
    print('Cloudy')
elif S =='Cloudy':
    print('Rainy')
else:
    print('Sunny')
#!/usr/bin/env python3
import sys

def s_bannme(i,s):
    ans = [d for d in str(i)]
    if len(ans)>s:
        return int(ans[s])


def solve(N: int, M: int, S: "List[int]", C: "List[int]"):
            
    for i in range(1000):
        if M == 0:
            digits = len(str(i))
            if digits == N:
                pass
            else:
                exist = False
        else:
            exist = True
            for s, c in zip(S, C):
                digits = len(str(i))
                cons = s_bannme(i,s-1)
                if digits == N and cons == c:
                    pass
                else:
                    exist = False

        if exist:
            print(i)
            return
                
    print(-1)



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

def s_bannme(i,s):
    ans = [d for d in str(i)]
    if len(ans)>s:
        return int(ans[s])


def solve(N: int, M: int, S: "List[int]", C: "List[int]"):
            
    for i in range(1000):
        exist = True
        if M == 0:
            digits = len(str(i))
            if digits == N:
                pass
            else:
                exist = False
        else:
            for s, c in zip(S, C):
                digits = len(str(i))
                cons = s_bannme(i,s-1)
                if digits == N and cons == c:
                    pass
                else:
                    exist = False

        if exist:
            print(i)
            return
                
    print(-1)



# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    s = [int()] * (M)  # type: "List[int]"
    c = [int()] * (M)  # type: "List[int]"
    for i in range(M):
        s[i] = int(next(tokens))
        c[i] = int(next(tokens))
    solve(N, M, s, c)

if __name__ == '__main__':
    main()
#ABC057.B
N,M = int(input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)

### FIXED CODE ###

#ABC057.B
N,M = map(int,input().split())
L1 = []
L2 = []

for i in range(N):
    a,b = map(int,input().split())
    L1.append([a,b])
for m in range(M):
    c,d = map(int,input().split())
    L2.append([c,d])

for j in range(N):
    L3 = []
    for l in range(M):
        L3.append(abs(L1[j][0]-L2[l][0]) + abs(L1[j][1]-L2[l][1]))
    print(L3.index(min(L3))+1)
n,m=[int(x) for x in input().split()]
v=[int(x) for x in input().split()]
def insert(list, n): 
      
    for i in range(len(list)): 
        if list[i] > n: 
            break
      
    list = list[:i] + [n] + list[i:] 
    return list
v.sort()
while (m>0):
	k=v[-1]/2
	del v[-1]
	v=insert(v,k)
	m-=1
i,sum=0,0
print(v)
while(i<n):
	sum+=int(v[i])
	i+=1
print(sum)

### FIXED CODE ###

#coding:utf-8
 
import heapq
 
N, M = map(int, input().split())
invA = []
for a in map(int, input().split()):
    heapq.heappush(invA, -1*a)
for m in range(M):
    heapq.heappush(invA, heapq.heappop(invA)/2)
total = -1*sum(map(int, invA))
 
print(total)
while 1:
     x, y = map(int, raw_input().split())
     if x == 0 and y == 0:
         break
     if y < x:
         print '%s %s' % (y,x)
     else:
         print '%s %s' % (x,y)
    

### FIXED CODE ###

while 1:
   x, y = map(int, raw_input().split())
   if x == 0 and y == 0:
      break
   elif x > y:
      print '%s %s' % (y,x)
   else:
      print '%s %s' % (x,y)
n = int(input())
for _ in range(n):
    x,u = map(int,input().split())
c = 0    
for i in range(n):
    if u[i] == "JPY":
        c += x[i]
    else:
        c += x[i]*380000.0
print(c)

### FIXED CODE ###

count = 0
N =int(input())
for _ in range(N):
    x, u =[_ for _ in input().split()]
    x= float(x)
    if u =='JPY':
        count += x
    else:
        count += x * 380000
print(count)
n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
  
a=0
ans=1
for i in range(100100):
  if A[a]==1:
    print(ans)
    exit()
  ans+=1
  a=A[a]
print(-1)

### FIXED CODE ###

n=int(input())
A=[]
for i in range(n):
  A.append(int(input()))
A=[0]+A
a=1
ans=1
for i in range(100100):
  if A[a]==2:
    print(ans)
    exit()
  ans+=1
  
  a=A[a]
print(-1)
import math
n = int(input())
a = list(map(int,input().split()))
g = 0
for i in range(len(a)):
    g = math.gcd(g,a[i])
print(g)


### FIXED CODE ###

def gcd(x, y): 
  
   while(y): 
       x, y = y, x % y 
  
   return x 
n = int(input())
a = list(map(int,input().split()))
g = 0
for i in range(len(a)):
    g = gcd(g,a[i])
print(g)
n=int(input())
c=0
for i in range(,n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)

### FIXED CODE ###

n=int(input())
c=0
for i in range(n):
  if len(str(i+1))%2!=0:
    c+=1
print(c)
d,t,s　=　map(int,input.split())

if t <= d/s:
  print("Yes")
else:
  print("No")

### FIXED CODE ###

##A - Don't be late
D,T,S = map(int,input().split())
if D / S <= T:
    print("Yes")
else:
    print("No")
x,k,d= list(map(int, input().split())
x=abs(x)
a=x//d
if k>=a:
    if (k-a)%2==0:
        print(x%d)
    else:
        print(d-(x%d))
else:
    print(x-(k*d))


### FIXED CODE ###

x,k,d= list(map(int, input().split()))
x=abs(x)
a=x//d
if k>=a:
    if (k-a)%2==0:
        print(x%d)
    else:
        print(d-(x%d))
else:
    print(x-(k*d))
n = int(input())
p = [int(x) for x in input().split()]

ans = 0
index = 0

while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1

print(ans)

### FIXED CODE ###

n = int(input())
p = [int(x) for x in input().split()]

ans = 0
cnt = 0
'''
index = 0
while index <= n-1:
    if p[index] == index+1:
        if p[index+1] != index+2:
            index += 1
        else:
            index += 2
        ans += 1
    else:
        index += 1
'''

for i in range(n-1):
    if p[i] == i+1:
        p[i], p[i+1] = p[i+1], p[i]
        cnt += 1

if p[-1] == n:
    cnt += 1

print(cnt)
#ABC 049 C
S = input()
T = ''
S = S[::-1]
words = ["dream","dreamer","erase","eraser"]
rev_words = [w[::-1] for w in words]

i=0
while(1):
	for w in rev_words:
		s = S[i:i+len(w)]
		if s == w:
			flag = True
			T += w
			i += len(w)
			break
	if T == S:
		ans = "YES"
		break
	if flag == False:
		ans = 'NO'
		break
	flag = False
print(ans)

### FIXED CODE ###

#ABC 049 C
S = input()
T = ''
S = S[::-1]
words = ["dream","dreamer","erase","eraser"]
rev_words = [w[::-1] for w in words]

flag = False
i=0
while(1):
	for w in rev_words:
		s = S[i:i+len(w)]
		if s == w:
			flag = True
			T += w
			i += len(w)
			break
	if T == S:
		ans = "YES"
		break
	if flag == False:
		ans = 'NO'
		break
	flag = False

print(ans)
alphabeta = "abcdefghijklmnopqrstuvwxyz"
all_str  = set(alphabeta) 
str = input() 
str = set(str)
use = all_str-str 
print(sorted(use)[0])

### FIXED CODE ###

alphabeta = "abcdefghijklmnopqrstuvwxyz"
all_str  = set(alphabeta) 
str = input() 
str = set(str)


use = all_str-str 
if use == set():
  print("None")
else:
  print(sorted(use)[0])
i = 0
while(n = (int)input()):
  i = i + 1;
  print 'Case',i+':',n

### FIXED CODE ###

n = input()
i = 1
while n != 0:
  print "Case %d: %d" % (i, n)
  n = input()
  i += 1;
12
757232153 372327760 440075441 195848680 354974235 458054863 463477172 740174259 615762794 632963102 529866931 64991604
74164189 98239366 465611891 362739947 147060907 118867039 63189252 78303147 501410831 110823640 122948912 572905212

### FIXED CODE ###

N = int(input())
A = [int(hoge) for hoge in input().split()]
B = [int(hoge) for hoge in input().split()]
#Aiの総和を変えずに、なるべく少ない量のAiを変えて全部合格を目指す
if sum(B) > sum(A):
    print(-1)
else:
    diff = 0
    points = []
    ans = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a < b:
            diff += b - a
            ans += 1
        elif a > b:
            points.append(a-b)
    for p in sorted(points,reverse = True):
        if diff <= 0:
            print(ans)
            exit()
        diff -= p
        ans += 1 
    print(ans)
import sys

f = sys.stdin

n,m,x = map(int,f.readline().split())
h = [None] + [int(f.readline()) for _ in range(n)]
tuple_abt = [tuple(map(int, line.split())) for line in f]

dict_abt = {}
for ai,bi,ti in tuple_abt:
    try:
        if ti <= h[ai]:
            dict_abt[ai][bi] = ti
    except KeyError:
        dict_abt[ai] = {bi:ti}
    try:
        if ti <= h[bi]:
            dict_abt[bi][ai] = ti
    except KeyError:
        dict_abt[bi] = {ai:ti}

class Tree:
    def __init__(self, t, h, jump_t=0, next_h=0):
        if jump_t:
            t += jump_t
            h -= jump_t
            if h < 0:# 登って辻褄を合わせる
                t += -h
                h = 0
            if next_h < h:# 降りて辻褄を合わせる
                t += h - next_h
                h = next_h
        self.t = t
        self.h = h
        self.d = t - h #基本的に高い位置の方が早い為

d = [None] * (n + 1)
d[1] = Tree(0, x)
q = [(d[1].d, 1)] # (d(v), v)
while len(q):
    _, u = q.pop() #コストが最小の木を取得
    if u not in dict_abt:
        continue
    for v, t in dict_abt[u].items():
        dv = Tree(d[u].t, d[u].h, t, h[v])
        if d[v] == None or d[v].d > dv.d:
            d[v] = dv
            q.append((d[v].d, v))
if d[-1]:
    print(d[-1].t + h[-1] - d[-1].h)
else:
    print(-1)

### FIXED CODE ###

import sys
import heapq

f = sys.stdin

n,m,x = map(int,f.readline().split())
h = [None] + [int(f.readline()) for _ in range(n)]
tuple_abt = [tuple(map(int, line.split())) for line in f]

dict_abt = {}
for ai,bi,ti in tuple_abt:
    try:
        if ti <= h[ai]:
            dict_abt[ai][bi] = ti
    except KeyError:
        dict_abt[ai] = {bi:ti}
    try:
        if ti <= h[bi]:
            dict_abt[bi][ai] = ti
    except KeyError:
        dict_abt[bi] = {ai:ti}

class Tree:
    def __init__(self, t, h, jump_t=0, next_h=0):
        if jump_t:
            t += jump_t
            h -= jump_t
            if h < 0:# 登って辻褄を合わせる
                t += -h
                h = 0
            if next_h < h:# 降りて辻褄を合わせる
                t += h - next_h
                h = next_h
        self.t = t
        self.h = h
        self.d = t - h #基本的に高い位置の方が早い為

d = [None] * (n + 1)
d[1] = Tree(0, x)
q = [(d[1].d, 1)] # (d(v), v)
while len(q):
    _, u = heapq.heappop(q) #コストが最小の木を取得
    if u not in dict_abt:
        continue
    for v, t in dict_abt[u].items():
        dv = Tree(d[u].t, d[u].h, t, h[v])
        if d[v] == None or d[v].d > dv.d:
            d[v] = dv
            heapq.heappush(q,(d[v].d, v))
if d[-1]:
    print(d[-1].t + h[-1] - d[-1].h)
else:
    print(-1)
n = map(int,input.split())
if 7 in n:print('Yes')
else:print('No')

### FIXED CODE ###

n = input()
if '7' in n:print('Yes')
else:print('No')
# D - Dice in Line
n,k = map(int,input().split())
p = [0]*k + [*map(int,input().split())]
ans = sum = 0
for i in range(n):
    sum += p[i+k] - p[i]
    ans = max(ans, sum)
print((ans+k)/2)

### FIXED CODE ###

# D - Dice in Line
n,k = map(int,input().split())
p = [0]*k + list(map(int,input().split()))
ans = sum = 0
for i in range(n):
    sum += p[i+k] - p[i]
    ans = max(ans, sum)
print((ans+k)/2)
s=list(str(input()))
count=0
for i in range(3):
  if s[i]==s[i+1]:
    count+=1

if count==0:
  print('Good')
  else:
    print('Bad')    

### FIXED CODE ###

s=list(str(input()))
count=0
for i in range(3):
  if s[i]==s[i+1]:
    count+=1

if count==0:
  print('Good')
else:
    print('Bad')
s = input().split()
a = s[0]
b = s[1]

if a % 2 == 0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")


### FIXED CODE ###

s = input().split()
a = int(s[0])
b = int(s[1])

if a % 2 == 0 or b % 2 == 0:
    print("Even")
else:
    print("Odd")
INFTY = 10**10
def gcd(x,y):
    if y>x:
        x,y = y,x
    while y>0:
        x,y = y,x%y
    return x
N = int(input())
A = list(map(int,input().split()))
cmin = INFTY
MIN = []
for i in range(N-1):
    c = gcd(A[i],A[i+1])
#     print("cmin,c,A[i],A[i+1]={},{},{},{}".format(cmin,c,A[i],A[i+1]))
    if c<cmin:
        cmin = c
        MIN = [(A[i],A[i+1])]
    elif c==cmin:
        MIN.append((A[i],A[i+1]))
c = gcd(A[N-1],A[0])
if c<cmin:
    MIN = [(A[N-1],A[0])]
elif c==cmin:
    MIN.append((A[N-1],A[0]))
if len(MIN)==2:
    x,y,z,w = MIN[0][0],MIN[0][1],MIN[1][0],MIN[1][1]
    if x==y and y==z and z==w:
        emin = x
    else:
        B = [x,y,z,w]
        for a in B:
            if B.count(a)==2:
                b = a
                break
        C = A[:]
        C.remove(b)
        emin = INFTY
        for i in range(N-2):
            emin = min(emin,gcd(C[i],C[i+1]))
elif len(MIN)==1:
    x,y = MIN[0][0],MIN[0][1]
    B = A[:]
    B.remove(x)
    bmin = INFTY
    for i in range(N-2):
        bmin = min(bmin,gcd(B[i],B[i+1]))
    C = A[:]
    C.remove(y)
    cmin = INFTY
    for i in range(N-2):
        cmin = min(cmin,gcd(C[i],C[i+1]))
    emin = max(bmin,cmin)
print(emin)

### FIXED CODE ###

def gcd(x,y):
    while y>0:
        x,y = y,x%y
    return x

N = int(input())
A = sorted(list(map(int,input().split())))
amin = A[0]
ind = 0
for i in range(1,N):
    a = gcd(amin,A[i])
    if a<amin:
        ind = i
        amin = a
a0 = A[1]
for i in range(2,N):
    a0 = gcd(a0,A[i])
a1 = A[0]
for i in range(2,N):
    a1 = gcd(a1,A[i])
a = A[0]
for i in range(1,N):
    if i != ind:
        a = gcd(a,A[i])
print(max(a0,a1,a))
s = int(input())
if s == s.lower():
    print('a')
else:
    print('A')


### FIXED CODE ###

s = input()
if s == s.lower():
    print('a')
else:
    print('A')
import sys
sys.setrecursionlimit(5000000)

s = input()
cont_list = []
ini_di = s[0]
count = 1
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1
        if i == len(s) - 1:
            cont_list.append(count)
    else:
        cont_list.append(count)
        count = 1
        if i == len(s) - 1:
            cont_list.append(count)


def counting(i):
    a = max(cont_list[i], cont_list[i + 1])
    b = min(cont_list[i], cont_list[i + 1])
    return (1 + a) * a / 2 + b * (b - 1) / 2


if ini_di == "<":
    count2 = 0
    if len(cont_list) % 2 == 0:
        for i in range(0, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        for i in range(0, len(cont_list)-1, 2):
            count2 += int(counting(i))
        las = cont_list[len(cont_list)-1]
        count2 += int((1+las)*las/2)
    print(count2)
else:
    count2 = 0
    if len(cont_list) % 2 == 1:
        ini = cont_list[0]
        count2 += int((1+ini)*ini/2)
        for i in range(1, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        ini = cont_list[0]
        count2 += int((1 + ini) * ini / 2)
        las = cont_list[len(cont_list) - 1]
        count2 += int((1 + las) * las / 2)
        for i in range(1, len(cont_list)-1, 2):
            count2 += int(counting(i))
    print(count2)

### FIXED CODE ###

import sys
sys.setrecursionlimit(5000000)

s = input()
if len(s) == 1:
    print("1")
    exit()
cont_list = []
ini_di = s[0]
count = 1
for i in range(1, len(s)):
    if s[i] == s[i-1]:
        count += 1
        if i == len(s) - 1:
            cont_list.append(count)
    else:
        cont_list.append(count)
        count = 1
        if i == len(s) - 1:
            cont_list.append(count)


def counting(i):
    a = max(cont_list[i], cont_list[i + 1])
    b = min(cont_list[i], cont_list[i + 1])
    return (1 + a) * a / 2 + b * (b - 1) / 2


if ini_di == "<":
    count2 = 0
    if len(cont_list) % 2 == 0:
        for i in range(0, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        for i in range(0, len(cont_list)-1, 2):
            count2 += int(counting(i))
        las = cont_list[len(cont_list)-1]
        count2 += int((1+las)*las/2)
    print(count2)
else:
    count2 = 0
    if len(cont_list) % 2 == 1:
        ini = cont_list[0]
        count2 += int((1+ini)*ini/2)
        for i in range(1, len(cont_list), 2):
            count2 += int(counting(i))
    else:
        ini = cont_list[0]
        count2 += int((1 + ini) * ini / 2)
        las = cont_list[len(cont_list) - 1]
        count2 += int((1 + las) * las / 2)
        for i in range(1, len(cont_list)-1, 2):
            count2 += int(counting(i))
    print(count2)
##input##
Nvar = int(input())
T_list = map(lambda x:int(x),input().split(" "))
M_var = int(input())
P_dict = {}
for i in range(M_var):
    buf = map(lambda x:int(x),input().split(" "))
    P_dict[buf[0]] = buf[1]
##

time_sum = 0
for d_num in range(M_var):
    for q_num in range(Nvar):
        if q_num==d_num:
            time_sum += P_list[q_num+1]
        else:
            time_sum += T_list[q_num]


### FIXED CODE ###

##input##
Nvar = int(input())
T_list = list(map(lambda x:int(x),input().split(" ")))
M_var = int(input())
P_list = []
for i in range(M_var):
    P_list.append(list(map(lambda x:int(x),input().split(" "))))
##

for d_num in range(M_var):
    time_sum = 0
    for q_num in range(Nvar):
        if q_num==P_list[d_num][0]-1:
            time_sum += P_list[d_num][1]
        else:
            time_sum += T_list[q_num]
    print(time_sum)
n,k=map(int,input().split())
lists=list(map(int,input().split()))
Chlist=[0]*n
countlist=[0]*40
for s in range(n):
    Chlist[s]=format(lists[s],"0%ib"%40)
    for i in range(40):
        if Chlist[s][i]=="1":
            countlist[39-i]+=1
        else:
          continue
        
        
        
#countlistのi桁めが2**(i-1)の数である
power=0
for i in range(40):
    if 2**i<=k<2**(i+1):
        power=i
        break    
    else:
      continue
ans1=0
for j in range(power):
    ans1+=(2**j)*max(countlist[j],n-countlist[j])
ans1+=(2**power)*(countlist[power])


uselist=[0]*(k-2**power+1)
for i in range(k-2**power+1):
    c=format(i,"0%ib"%40)
    uselist[i]=c


ans2=0

ans2+=(2**power)*(n-countlist[power])

biggest=0
for i in uselist:
    big=0
    for j in range(40):
        if  i[39-j]=="1" and j!=power:
            big+=(2**j)*(n-countlist[j])
        elif i[39-j]=="0"and j!=power:
            big+=(2**j)*countlist[j]
    biggest=max(biggest,big)

ans2+=biggest
print(max(ans1,ans2))

### FIXED CODE ###

n,k=map(int,input().split())
k2=format(k+1,"0%ib"%40)
lists=list(map(int,input().split()))
countlist=[0]*40
for j in lists:
    c=format(j,"0%ib"%40)
    for i in range(40):
        if c[i]=="1":
            countlist[i]+=1

emptylist=[]
for i in range(40):
    if k2[i]=="1":
        emptylist.append(i)
if k>=1:
    ans=0
    for i in emptylist:
        subing=0
        for j in range(40):
            if j<i:
                if k2[j]=="1":
                    subing+=(2**(39-j))*(n-countlist[j])
                elif k2[j]=="0":
                    subing+=(2**(39-j))*countlist[j]
            if j==i:
                subing+=(2**(39-i))*countlist[i]
            
            if j>i:
                subing+=(2**(39-j))*max(countlist[j],n-countlist[j])
        ans=max(ans,subing)
    print(ans)
elif k==0:
    ans=0
    for i in range(40):
        ans+=(2**(39-i))*countlist[i]
    print(ans)