Harryxun/stf_run huggingface dataset:
from itertools import permutations

n, m = map(int, input().split())
paths = set()

for i in range(n) :
    _a, _b = map(int, input().split())
    # paths.add((_a, _b))
    # paths.add((_b, _a))
    
# print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))



### FIXED CODE ###

from itertools import permutations

n, m = map(int, input().split())
paths = set()

for i in range(m) :
    _a, _b = map(int, input().split())
    paths.add((_a, _b))
    paths.add((_b, _a))
    
print(sum(all(s in paths for s in zip((1,) + p, p)) for p in permutations(range(2, n + 1))))
N=input()
if len(N) >3:
  i=(int(N[:-3])+1)*1000
else:
  i=N
 
j=i-int(N)
 
elif j>999:
  print(0)
else:
  print(j)

### FIXED CODE ###

N=input()
if len(N)>3:
    i=(int(N[:-3])+1)*1000
else:
    i=1000

j=i-int(N)

if j>999:
  print(0)
else:
  print(j)
input()
I=list(map(int,input().split()))
L=[0,0,0]
a=1
m=10**9+7
for i in I:
  a*=L.count(i)
  L[L.index(i)]+=1
  a%=m
print(a)

### FIXED CODE ###

input()
I=list(map(int,input().split()))
L=[0,0,0]
a=1
m=10**9+7
for i in I:
  if i in L:
  	a*=L.count(i)
  	L[L.index(i)]+=1
  	a%=m
  else:
    a=0
    break
print(a)
H, A = map(int, intput().split())
res = H // A
if H % A > 0:
  	res += 1
print(res)

### FIXED CODE ###

H, A = map(int, input().split())
res = H // A + (H % A > 0)
print(res)
n=int(input())
s=sorted([input() for k in range(n)])
s3 = sorted(list(set(s)))
if(len(set(s))==len(s)):
    for u in range(len(s)):
        print(s[u])
    exit()
else:
    s1=s2 = [m for m in s3 if s.count(m)>1]
    i = (len(s)-len(s1))//len(s3)                                                                         while(len(s2)!=0):
        s2 = [m for m in s3 if s.count(m)>i]
        if(len(s2)==0):
               break
        s1 = s2
        i+=1
for j in s1:
    print(j)

### FIXED CODE ###

N = int(input())
d = {}
for _ in range(N):
  s = input()
  if(s not in d):
    d[s] = 1
  else:
    d[s] += 1
d2 = sorted(d.items(),key=lambda x:x[1], reverse=True)
s1=[]
s1.append(d2[0][0])
p=d2[0][1]
for t in d2[1:]:
  q=t[1]
  if(q==p):
    s1.append(t[0])
  else:
    break
s1=sorted(s1)
for i in s1:
  print(i)
import sys

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
mod=10**9+7
score=1

if K%2==1:  #これでKは偶数として扱えるようになった
    score*=A[0]
    A.pop(0)
    K-=1

#print(A)

P,M=[],[]
for i in A:
    if i>0:
        P.append(i)
    else:
        M.append(i)

M=M[::-1]
t=0
p,m=0,0
while t<=K:
    if score<0:  #負であることが確定しているなら小さくなるようにする
        P=P[::-1]
        M=M[::-1]
        if 0 in M:
            print(0)
            sys.exit()
    if t+2<=K:
        if 2*p+1<len(P) and 2*m+1<len(M):
            if P[2*p]*P[2*p+1] >= M[2*m]*M[2*m+1]:
                score*=P[2*p]*P[2*p+1]
                p+=1
                t+=2
            else:
                score*=M[2*m]*M[2*m+1]
                m+=1
                t+=2
        elif 2*p+1<len(P):
            score*=P[2*p]*P[2*p+1]
            p+=1
            t+=2
        else:
            score*=M[2*m]*M[2*m+1]
            m+=1
            t+=2
    elif t+1<=K:
        if 2*p<len(P):
            score*=P[2*p]
        else:
            score*=M[2*m]
        break
    else:
        break
    score%=mod

print(score%mod)

### FIXED CODE ###

import sys

N,K=map(int,input().split())
A=sorted(list(map(int,input().split())))[::-1]
mod=10**9+7
score=1

if K%2==1:  #これでKは偶数として扱えるようになった
    score*=A[0]
    A.pop(0)
    K-=1

#print(A)

P,M=[],[]
for i in A:
    if i>0:
        P.append(i)
    else:
        M.append(i)

M=M[::-1]
t=0
p,m=0,0
while t<=K:
    if score<0:  #負であることが確定しているなら小さくなるようにする
        P=P[::-1]
        M=M[::-1]
        if 0 in M:
            print(0)
            sys.exit()
    if t+2<=K:
        if 2*p+1<len(P) and 2*m+1<len(M):
            if P[2*p]*P[2*p+1] >= M[2*m]*M[2*m+1]:
                score*=P[2*p]*P[2*p+1]
                p+=1
                t+=2
            else:
                score*=M[2*m]*M[2*m+1]
                m+=1
                t+=2
        elif 2*p+1<len(P):
            score*=P[2*p]*P[2*p+1]
            p+=1
            t+=2
        elif 2*m+1<len(M):
            score*=M[2*m]*M[2*m+1]
            m+=1
            t+=2
        else:  #?
            score*=P[-1]*M[-1]
            break
    elif t+1<=K:
        if 2*p<len(P):
            score*=P[2*p]
        else:
            score*=M[2*m]
        break
    else:
        break
    score%=mod

print(score%mod)
import math
N,M=int(input())
def combination(n,r):
    return math.factrial(n)//(math.factrial(n-r)*math.factrial(r))
if N>=2 and M>=2:
    print(combination(N,2)+combination(M,2))
elif N>=2 and M<=2:
    print(combination(N,2))
else:
    print(combination(M,2))

### FIXED CODE ###

N,M=map(int,input().split())
print(N*(N-1)//2+M*(M-1)//2)
T = float(input())
X = float(input())

print("%.4f".format(T/X))

### FIXED CODE ###

T, X = map(float, input().split())
 
print("{0:.4f}".format(T/X))
import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n,k=I()
a = l()
town = []
num = [0]*(n+1)
cnt = 1
num[0]=1

for i in range(n):
    num[a[cnt-1]] += 1
    if num[a[cnt-1]] == 2:
        ans = a[cnt-1]
        break
    town.append(a[cnt-1])
    cnt = a[cnt-1]

p = town.index(ans)
b = town[p:]
x = len(town)
y = len(b)
k -= x-y
z = k%y
if z == 0:
    print(town[k-1])
else:
    print(b[z-1])


### FIXED CODE ###

import re
import sys
import math
import itertools
import bisect
from copy import copy
from collections import deque,Counter
from decimal import Decimal
import functools
def v(): return input()
def k(): return int(input())
def S(): return input().split()
def I(): return map(int,input().split())
def X(): return list(input())
def L(): return list(input().split())
def l(): return list(map(int,input().split()))
def lcm(a,b): return a*b//math.gcd(a,b)
sys.setrecursionlimit(10 ** 9)
mod = 10**9+7
cnt = 0
ans = 0
inf = float("inf")

n,k=I()
a = l()
town = []
num = [0]*(n+1)
cnt = 1
num[0]=1

for i in range(n):
    num[a[cnt-1]] += 1
    if num[a[cnt-1]] == 2:
        ans = a[cnt-1]
        p = town.index(ans)
        b = town[p:]
        x = len(town)
        y = len(b)
        q = k-x+y
        if y == 0:
            print(town[n-1])
            sys.exit()
        if q < 0:
            print(town[k-1])
            sys.exit()
        z = q%y
        if z == 0:
            print(town[z-1])
        else:
            print(b[z-1])
        sys.exit()
        break
    town.append(a[cnt-1])
    cnt = a[cnt-1]
N, K = map(int, input().split())

if K==N+1:
    print(1)
elif K==N:
    print(N+2)
else:
    
    zentori=[]
    for i in range(1,2**(N+1)):
        baai=[]
        for j in range(N+1):
            if (i>>j) & 1:
                baai.append(j)
        if len(baai)>=K:
            zentori.append((sum(baai),len(baai)))
    
    setzentori=set(zentori)
    print(int(len(setzentori)%(10**9+7)))

### FIXED CODE ###

s=int(input())

print(2*s*3.14159265358979)
n = int(input())
a=input()
count = []

for i in n:
	count[i] = 0
	while True:
		if a[i]%2=0 :
			a[i] = a[i]/2
			count[i] += 1
		else:
			break

max(count)

### FIXED CODE ###

n = int(input())
a=list(map(int, input().split()))
count = 0
boolean = True

while boolean == True:
	for i in range(n):
		if a[i]%2 == 0 :
			a[i] = a[i]/2
			if i == (n-1):
				count += 1
		else:
			boolean = False
			break

print(count)
MOD = 10**9 + 7
dp = {0: 1}

S = int(input())
for s in range(3, S+1):
  for term in range(3, s+1):
    if s - term < 0:
      break
    else:
      dp[s] = dp.get(s-term, 0) + dp.get(s, 0) % MOD

print(dp[S])

### FIXED CODE ###

MOD = 10**9 + 7
dp = {0: 1}

S = int(input())
for s in range(3, S+1):
  for term in range(3, s+1):
    if s - term < 0:
      break
    else:
      dp[s] = dp.get(s-term, 0) + dp.get(s, 0) % MOD

print(dp.get(S, 0))
li = map(int, input().split())
number = 0
even_or_odd = 1
def check_number(list):
  for i in list:
    if i % 2 == 0:
      continue
    else:
      even_or_odd *= 0
      
def cut_in_two(list):
  for i in list:
    i /= 2

while True:
  if even_or_odd == 1:
    check_number(li)
    cut_in_two(li)
    number += 1
  else:
    print(number)
    break
  


### FIXED CODE ###

def how_many(n):
  ans = 0
  while n % 2 == 0:
    n /= 2
    ans += 1
  return ans
 
n = int(input())
li = map(int, input().split())

ans = min(map(how_many, li))

print(ans)
a, b, c, d, e, f= (int(i) for i in input().split()) 

den=0

for i in range(30+1):
  for j in range(15+1):
    water = 100*a*i+100*b*j
    maxsugar=int(water/100)*e
    if water + maxsugar <= f:
      for k in range(0,int(maxsugar/c)+1):
        for l in range(0,int(maxsugar/d)+1):
          sugar=c*k+d*l
          if 0 < water+sugar <= f and sugar <=maxsugar:
            if den < sugar/(water+sugar):
              den=sugar/(water+sugar)
              ans1=water+sugar
              ans2=sugar

print(ans1,ans2)
              


### FIXED CODE ###

a, b, c, d, e, f= (int(i) for i in input().split()) 

waterlist=[]
for i in range(0,f+100*a,100*a):
  for j in range(0,f+100*b,100*b):
    if i+j <=f:
      waterlist+=[i+j]
waterlist=list(set(waterlist))
#print(x)

sugarlist=[]
for i in range(int(f/c)+1):
  for j in range(int(f/d)+1):
    if c*i+d*j <=f:
      sugarlist+=[c*i+d*j]
sugarlist=list(set(sugarlist))
#print(y)

density=0

for i in range(len(waterlist)):
  for j in range(len(sugarlist)):
    if 0 < waterlist[i]+sugarlist[j] <= f and sugarlist[j]<=waterlist[i]/100*e:
      tmp=sugarlist[j]/(waterlist[i]+sugarlist[j])
      if density <= tmp:
        density = tmp
        ans1=waterlist[i]+sugarlist[j]
        ans2=sugarlist[j]
        
print(ans1,ans2)
s = input()
ans = 0
ans += [int(i) for i in s]
print(ans)

### FIXED CODE ###

s = input()

ans = 0

for i in s:
  ans += int(i)

print(ans)
def main():
    n = int(input())
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))[::-1]
    ind = [-1] * (n + 1)
    for i in range(n):
        if i == 0:
            ind[b[i]] = 0
        elif b[i] != b[i - 1]:
            ind[b[i]] = i
    for i in range(n):
        if a[i] != b[i]:
            continue
        elif i < n - 1:
            swap = 0
            for j in range(b[i] - 1, 0, -1):
                if ind[j] != -1:
                    swap = ind[j]
                    ind[j] += 1
                    break
            b[i], b[swap] = b[swap], b[i]
    if all(a[i] != b[i] for i in range(n)):
        print("Yes")
        print(" ".join(map(str, b)))
    else:
        print("No")


if __name__ == '__main__':
    main()


### FIXED CODE ###

def solve(n):
    a = list(map(int, input().split()))
    b = list(map(int, input().split()))[::-1]
    ind = [-1] * (n + 1)
    for i in range(n):
        if i == 0:
            ind[b[i]] = 0
        elif b[i] != b[i - 1]:
            ind[b[i]] = i
    cnt = 0
    for i in range(n):
        if a[i] != b[i]:
            continue
        else:
            swap = 0
            for j in range(b[i] - 1, 0, -1):
                if ind[j] != -1 or ind[j] >= ind[j - 1]:
                    swap = ind[j]
                    ind[j] += 1
                    break
            if n <= swap:
                swap = cnt
                cnt += 1
                cnt %= n
            b[i], b[swap] = b[swap], b[i]
    return a, b


def main():
    n = int(input())
    a, b = solve(n)
    if all(a[i] != b[i] for i in range(n)):
        print("Yes")
        print(" ".join(map(str, b)))
    else:
        print("No")


if __name__ == '__main__':
    main()
N = int(input())
dp = [None for _ in range(N)]
for i in range(N):
  p = int(input())
  if p != 1 and (dp[p - 2]) == None:
    dp[p - 1] = 1
  else:
    dp[p - 1] = dp[p - 2] + 1
print(N - max(dp))

### FIXED CODE ###

N = int(input())
dp = [None for _ in range(N)]
for i in range(N):
  p = int(input())
  if dp[p - 2] == None or p == 1:
    dp[p - 1] = 1
  else:
    dp[p - 1] = dp[p - 2] + 1
print(N - max(dp))
global field
dxy = [[1,0],[0,1],[-1,0],[0,-1],[1,1],[-1,1],[-1,-1],[1,-1]]
def solve(w,h):
	if 0 <= w < W and 0 <= h < H and field[h][w] == 1:
		field[h][w] = 0
		for dx,dy in dxy:
			solve(w+dx,h+dy)

while 1:
	W,H = map(int,raw_input().split())
	if W == 0: break
	field = [map(int,raw_input().split()) for i in range(H)]
	ans = 0
	for h in range(H):
		for w in range(W):
			if field[h][w] == 1:
				solve(w,h)
				ans += 1
	print ans

### FIXED CODE ###

import sys
sys.setrecursionlimit(100000)

def dfs(x, y):
    C[y][x] = 0
    for dx,dy in zip([1,1,0,-1,-1,-1,0,1],[0,1,1,1,0,-1,-1,-1]):
        if 0 <= x+dx < w and 0 <= y+dy < h and C[y+dy][x+dx] == 1:
            dfs(x+dx, y+dy)

while 1:
    w,h = map(int,raw_input().split())
    if w == h == 0: break
    C = [map(int,raw_input().split()) for _ in xrange(h)]

    ans = 0
    for y in range(h):
        for x in range(w):
            if C[y][x] == 1:
                dfs(x, y)
                ans += 1
    print ans
x, n = map(int, input().split())
P = list(map(int, input().split()))
diff, ans = 1000, -1
for i in range(0, 102):
    if (P.count(i)):
        continue
    if (abs(i - x) < diff):
        diff = abs(i - x)
        ans = i
print(ans)

### FIXED CODE ###

a=list(map(int,input().split()))
print(a.index(0)+1)
N = int(input())
A = list(map(int, input().split(" ")))

def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1])

def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
        
A_sorted, c = BubbleSort(A, N)

print_list(A_sorted)
print(c)

### FIXED CODE ###

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

def print_list(A):
    for a in A[:-1]:
        print ("%d "%a, end="")
    print(A[-1])

def SelectionSort(A, N):
    count = 0
    for i in range(N):
        minj = i
        for j in range(i, N):
            if A[j] < A[minj]:
                minj = j
        if minj != i:
            v = A[i]
            A[i] = A[minj]
            A[minj] = v
            count += 1
    return A, count
        
A_sorted, c = SelectionSort(A, N)

print_list(A_sorted)
print(c)
s=input()
k=int(input())
i=0
while s[i]=="1" and k:k,i=k-1,i+1
print(s[i])

### FIXED CODE ###

s=input()
k=int(input())-1
i=0
while s[i]=="1" and k:k,i=k-1,i+1
print(s[i])
# N, K = map(int, input().split())

# X = list(map(int, input().split()))

with open("test.txt", 'r') as f:
    N, K = map(int, f.readline().split())
    X = list(map(int, f.readline().split()))

def calc_time(x_max, x_min):
    if x_max * x_min >= 0:
        if abs(x_max) > abs(x_min):
            return x_max
        else:
            return abs(x_min)
    else:
        return x_max - x_min + min(abs(x_max), abs(x_min))

def calc_start_and_goal_position(index):
    if index - K >= 0:
        start_index = index - K
    else:
        start_index = 0
    
    if N > index + K + 1:
        goal_index = index + 1
    else:
        goal_index = N - K + 1
    
    return start_index, goal_index

if __name__ == "__main__":
    index = -1
    for i, x in enumerate(X):
        if x >= 0:
            index = i 
            break
    if index == -1:
        index = i
    start_index, goal_index = calc_start_and_goal_position(index)

    time_min = float('inf')
    for i in range(start_index, goal_index):
        time = calc_time(X[i+K-1], X[i])
        if time < time_min:
            time_min = time
    print(time_min)

### FIXED CODE ###

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

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

def calc_time(x_max, x_min):
    if x_max * x_min >= 0:
        if abs(x_max) > abs(x_min):
            return x_max
        else:
            return abs(x_min)
    else:
        return x_max - x_min + min(abs(x_max), abs(x_min))

def calc_start_and_goal_position(index):
    if index - K >= 0:
        start_index = index - K
    else:
        start_index = 0
    
    if N > index + K + 1:
        goal_index = index + 1
    else:
        goal_index = N - K + 1
    
    return start_index, goal_index

if __name__ == "__main__":
    index = -1
    for i, x in enumerate(X):
        if x >= 0:
            index = i 
            break
    if index == -1:
        index = i
    start_index, goal_index = calc_start_and_goal_position(index)

    time_min = float('inf')
    for i in range(start_index, goal_index):
        time = calc_time(X[i+K-1], X[i])
        if time < time_min:
            time_min = time
    print(time_min)
A = int(input())
B = int(input())
if A <9 and B < 9:
    print('Yay!')
else:
    print(':(')


### FIXED CODE ###

A, B = map(int, input().split())
if A <= 8 and B <= 8:
    print('Yay!')
else:
    print(':(')
input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]
print(sum(map(lambda x: abs(x-b), input_list)))

### FIXED CODE ###

N = int(input())

input_list = []
index = 1
for i in input().split():
    item = int(i) - index
    input_list.append(item)
    index += 1

input_list.sort()
b = input_list[N//2]

print(sum(map(lambda x: abs(x-b), input_list)))
import numpy as np
import sys
import collections

N = int(input())
A = list(map(int, input().split()))
res = 1
for i in range(N):
    res *= A[i]
    if res > 1e18:
        print(-1)
        sys.exit()

print(res)

### FIXED CODE ###

import numpy as np
import sys
import collections

N = int(input())
A = list(map(int, input().split()))
res = 1
if 0 in A:
    print(0)
    sys.exit()
for i in range(N):
    res *= A[i]
    if res > 1e18:
        print(-1)
        sys.exit()
print(res)
a = list(map(int, input().split())).sorted()
print('Yes' if a[0] + a[1] == a[2] else 'No')

### FIXED CODE ###

a = list(map(int, input().split()))
a = sorted(a)
print('Yes' if a[0] + a[1] == a[2] else 'No')
if s[2] == s[3] and s[4] == s[5]:
    print('Yes')


### FIXED CODE ###

s = input()

if s[2] == s[3] and s[4] == s[5]:
    print('Yes')
else:
    print('No')
# A = [list(map(int, input().split())) for _ in range(3)]
# n = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
n, m = map(int, input().split())
S = []
C = []
for i in range(m):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
ans = [0, 0, 0]
for i in range(m):
    ans[S[i]-1] = C[i]
if n == 2 and ans[1] == 0:
    print(-1)
    exit()
if n == 3:
    print("".join(map(str, ans[:n])))
elif n == 2:
    print("".join(map(str, ans[1:3])))
elif n == 1:
    print("".join(map(str, ans[2])))


### FIXED CODE ###

# A = [list(map(int, input().split())) for _ in range(3)]
# n = int(input())
# B = [int(input()) for _ in range(n)]
# X = list(map(int, input().split()))
n, m = map(int, input().split())
S = []
C = []
for i in range(m):
    s, c = map(int, input().split())
    S.append(s)
    C.append(c)
for i in range(1000):
    d = list(str(i))
    if len(d) != n:
        continue
    else:
        judge = True
        for i in range(m):
            if d[S[i]-1] != str(C[i]):
                judge = False
        if judge:
            print("".join(d))
            exit()
print(-1)
N = int(input())
A = list(map(int, input().split()))

bar_length_count = dict()
for a in A:
    bar_length_count[a] = bar_length_count.get(a, 0) + 1

for val in bar_length_count.values():
    pass

count_at_least_2 = 0
for val in bar_length_count.values():
    if val >= 2:
        if val >= 4:
            count_at_least_2 += 2
        else:
            count_at_least_2 += 1

if count_at_least_2 < 2:
    import sys
    print(0)
    sys.exit(0)

else:
    bar_length_count = sorted({k:v for bar_length_count.items() if v >= 2}.items(), key=lambda x: x[0], reverse=True)
    if bar_length_count[0][1] >= 4:
        print(bar_length_count[0][0]**2)
    else:
        print(bar_length_count[0][0]*bar_length_count[1][0])
        

### FIXED CODE ###

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

bar_length_count = dict()
for a in A:
    bar_length_count[a] = bar_length_count.get(a, 0) + 1

for val in bar_length_count.values():
    pass

count_at_least_2 = 0
for val in bar_length_count.values():
    if val >= 2:
        if val >= 4:
            count_at_least_2 += 2
        else:
            count_at_least_2 += 1

if count_at_least_2 < 2:
    import sys
    print(0)
    sys.exit(0)

else:
    bar_length_count = sorted({k:v for k, v in bar_length_count.items() if v >= 2}.items(), key=lambda x: x[0], reverse=True)
    if bar_length_count[0][1] >= 4:
        print(bar_length_count[0][0]**2)
    else:
        print(bar_length_count[0][0]*bar_length_count[1][0])
from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor, log2

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def bit1l(i):
    assert i > 0
    return len(bin(i)) - 3


def count1(i, xs):
    return sum(bool(i & x) for x in xs)


def main():
    n, k = get_int_list()
    xs = get_int_list()

    if k == 0:
        print(sum(xs))
        return
    gains = []
    for i in range(bit1l(k) + 1):
        gains.append((i, (len(xs) - count1(1 << i, xs) * 2) * (1 << i)))
    gains.sort(key=lambda x: x[1], reverse=True)
    best = 0
    for i, gain in gains:
        if gain < 0:
            break
        if k < best + (1 << i):
            break
        best += (1 << i)
    print(sum((x ^ best) for x in xs))


if __name__ == '__main__':
    main()


### FIXED CODE ###

from bisect import bisect_left, bisect_right
from collections import Counter, defaultdict, deque, OrderedDict
from copy import deepcopy
from functools import lru_cache, reduce
from math import ceil, floor

import heapq
import itertools
import operator


def get_int():
    return int(input())


def get_str():
    return input().strip()


def get_int_list():
    return [int(i) for i in input().split()]


def get_char_list():
    return list(input().strip())


def bit1l(i):
    assert i > 0
    return len(bin(i)) - 3


def count1(i, xs):
    return sum(bool(i & x) for x in xs)


def main():
    n, k = get_int_list()
    xs = get_int_list()

    if k == 0:
        print(sum(xs))
        return
    gains = []
    for i in range(bit1l(k) + 1):
        gains.append((i, (len(xs) - count1(1 << i, xs) * 2) * (1 << i)))
    gains.sort(key=lambda x: x[1], reverse=True)
    best = 0
    for i, gain in gains:
        if gain < 0:
            break
        if k < best + (1 << i):
            continue
        best += (1 << i)
    print(sum((x ^ best) for x in xs))


if __name__ == '__main__':
    main()
s=input().split()

if s[1] == '+':
  print(s[0]+s[2])
else:
  print(s[0]-s[2])

### FIXED CODE ###

s=input().split()
A=int(s[0])
B=int(s[2])

if s[1] == '+':
  print(A+B)
else:
  print(A-B)
input()
A = list(map(int, input().split()))
A = A.sorted()
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)

### FIXED CODE ###

input()
A = list(map(int, input().split()))
A = sorted(A)
p = 1
for i in A:
  p *= i
  if p > 10**18:
    p = -1
    break
print(p)
x,y = list(map(input().split()))
print(x+y//2)

### FIXED CODE ###

x,y = list(map(int,input().split()))
print(x+y//2)
a,b = map(int, raw_input().split())
print("Odd" if a*b % 2 else "Even")


### FIXED CODE ###

a,b = map(int, input().split())
print("Odd" if a*b % 2 else "Even")