Harryxun/stf_run huggingface dataset:
import math
def dis(p1,p2):
  return ((p1[0]-p2[0])**2+(p1[1]-p2[1])**2)**0.5
 
n=int(input())
p=[list(map(int,input().split())) for i in range(n)]
ans=0
for i in range(n):
  for j in range(i+1,n):
    ans+=dis(p[i],p[j])
print(ans*4/math.factorial(n))

### FIXED CODE ###

r=int(input())
print(r**2)
import math
A,B=map(int,input().split())
print(str(gcd(A,B)))

### FIXED CODE ###

from fractions import gcd
A,B=map(int,input().split())
x=(A*B)//(gcd(A,B))

print(x)
N=int(intput())
M=list(map(int, input().split()))
ans=min(M)
for m in M:
  if m%ans!=0:
    ans=1
    break
print(ans)

### FIXED CODE ###

N=int(input())
M=list(map(int, input().split()))
ans=min(M)
mn=min(M)
from math import gcd
for m in M:
  if m%mn!=0:
    ans=min(ans, gcd(mn,m))
print(ans)
hamkei = input()
print(int(hankei)**2)

### FIXED CODE ###

hankei = input()
print(int(hankei)**2)
r=int(input())
g=int(input())
print(2g-r)

### FIXED CODE ###

r=int(input())
g=int(input())
print(2*g-r)
s = input()

if len(s) == 2:
  print(s)
else:
  print("".join(list(reverse(s))))

### FIXED CODE ###

s = input()
 
if len(s) == 2:
  print(s)
else:
  print("".join(list(reversed(s))))
While 1:
    m,f,r=map(int,input().split())
    if m==f==r==-1:break
    a=m+f
    if m==-1 or f==-1:print('F')
    elif a >= 80:print('A')
    elif a >= 65:print('B')
    elif a >= 50:print('C')
    elif a >= 30:
        if r >= 50:print('C')
        else:print('D')
    else:print('F')

### FIXED CODE ###

while True:
    m,f,r=map(int,input().split())
    if m==f==r==-1:break
    a=m+f
    if m==-1 or f==-1:print('F')
    elif a >= 80:print('A')
    elif a >= 65:print('B')
    elif a >= 50:print('C')
    elif a >= 30:
        if r >= 50:print('C')
        else:print('D')
    else:print('F')
N, M = map(int, input().split())
d = {}
for _ in range(M):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
for i in d[1]:
    if N in d[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

N, M = map(int, input().split())
d = {}
for _ in range(M):
    a, b = map(int, input().split())
    if a not in d:
        d[a] = [b]
    else:
        d[a].append(b)
if 1 not in d:
    print('IMPOSSIBLE')
else:
    for i in d[1]:
        if i in d:
            if N in d[i]:
                print('POSSIBLE')
                break
    else:
        print('IMPOSSIBLE')
n, m = map(int, (input().split()))
x = list(map(int, input().split()))
x = sorted(x)
diff = []
for i in range(m-1):
    diff.append(x[i+1] - x[i])

diff = sorted(diff, reverse=True)

dist = x[-1] - x[0]
if dist < n:
    print(0)
    exit()

for i in range(n-1):
    dist -= diff[i]

print(dist)


### FIXED CODE ###

n, m = map(int, (input().split()))
x = list(map(int, input().split()))
x = sorted(x)
diff = []
for i in range(m-1):
    diff.append(x[i+1] - x[i])

diff = sorted(diff, reverse=True)

dist = x[-1] - x[0]
if dist < n:
    print(0)
    exit()

if m < n:
    print(0)
    exit()

for i in range(n-1):
    dist -= diff[i]

print(dist)
L, R = map(int, input().split(' '))

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans = 0:
            print(ans)
            exit(0)

print(ans)

### FIXED CODE ###

L, R = map(int, input().split(' '))

N = 2019


ans = 2019

for i in range(L, R):
    for j in range(i + 1, R + 1):
        mod = (i * j) % N
        if ans > mod:
            ans = mod
        if ans == 0:
            print(ans)
            exit(0)

print(ans)
def crmv(c,istr):
    if len(istr)<=1:
        return c
    '''
    lidx=[]
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            lidx.append(i)
    if len(lidx)==0:
        return c

    rv=0
    for i in lidx:
        tstr=istr[:i]+istr[i+1+1:]
        r=crmv(c+2,tstr)
        if r>rv:
            rv=r
    '''
    rv=-1
    for i in range(len(istr)-1):
        if istr[i] != istr[i+1]:
            tstr=istr[:i]+istr[i+1+1:]
            r=crmv(c+2,tstr)
            if r>rv:
                rv=r
    if rv == -1:
        return c
            

    return rv

istr=input()
print(crmv(0,istr))

### FIXED CODE ###

istr=input()
c0=0
c1=0
for ch in istr:
    if ch == '0':
        c0+=1
    else:
        c1+=1
print(min(c0,c1)*2)
n = int(raw_input())
h = [int(elem) for elem in raw_input().split()]
cost = [0] * n

def calc_cost(k):
    if cost[k] != 0:
        return cost[k]
    if k == 1:
        cost[k] = calc_cost(k-1) + abs(h[k] - h[k-1])
    elif k == 0:
        cost[k] = 0
    else:
        cost[k] = min(calc_cost(k-1) + abs(h[k] - h[k-1]),
                      calc_cost(k-2) + abs(h[k] - h[k-2]))
    return cost[k]

print calc_cost(n-1)

### FIXED CODE ###

n=int(input())
h=list(map(int,input().split()))
dp=[0]*n
dp[1]=abs(h[1]-h[0])
for i in range(2,n):dp[i]=min(dp[i-1]+abs(h[i]-h[i-1]),dp[i-2]+abs(h[i]-h[i-2]))
print(dp[-1])
n=int(input())
l=[0 for i in range(2*10**5)]
r=[0 for i in range(2*10**5)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  if k[i]+c<=2*10**5:
    l[k[i]+c]+=1 
  if -k[i]+c>=0 and -k[i]+c<=2*10**5:
    r[-k[i]+c]+=1
  c+=1
for i in range(n):
  a+=l[i]*r[i]
print(a)

### FIXED CODE ###

n=int(input())
l=[0 for i in range(2*10**5+1)]
r=[0 for i in range(2*10**5+1)]
c=1
a=0
if n!=0:
  k=[int(i) for i in input().split()]
for i in range(n):
  if k[i]+c<=2*10**5:
    l[k[i]+c]+=1 
  if -k[i]+c>=0 and -k[i]+c<=2*10**5:
    r[-k[i]+c]+=1
  c+=1
for i in range(n):
  a+=l[i]*r[i]
print(a)
s=set(input())
ans='No'
if s in (set('SN'), set('EW'), set('NEWS')):
  ans='Yes'
peint(ans)

### FIXED CODE ###

s=set(input())
ans='No'
if s in (set('SN'), set('EW'), set('NEWS')):
  ans='Yes'
print(ans)
N=int(input())
S=input()

str_list = list(S)

count = 0
for i in range(len(str_list)):
    string = str_list[i]
    if string == 'A':
        i += 1
        string = str_list[i]
    if string == 'B':
        i += 1
        string = str_list[i]
    if string == 'C':
        count += 1

print(count)

### FIXED CODE ###

N=int(input())
S=input()

print(S.count("ABC"))
s = [input() for i in range(3)]
print(s[0][0], s[1][1], s[2][2], sep="")

### FIXED CODE ###

N = int(input())
print(int(N/3))
L,R,d = (int(x) for x in input().split())

for i in range(R):
    if d*i>=R:
      max=i
      break

for i in range(L):
    if d*i>L:
        min=i
        break

print(str(max-min))

### FIXED CODE ###

L,R,d = (int(x) for x in input().split())
cnt=0
for i in range(L,R+1):
 if i%d==0:
        cnt+=1

print(cnt)
n = int(input())
x = [int(i) for i in input().split()]
x.sort()

ans = 100000000
for p in range(x[1],x[-1]+1):
  sum =0
  for i in range(n):
    sum += (x[i]-p)**2
    
  ans = min(ans,sum)
  
print(ans) 


### FIXED CODE ###

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

ans = 1000000000
for p in range(1,101):
  sum =0
  for x in X:
    sum += (p-x)**2
    
  ans = min(ans,sum)
  
print(ans)
a,b,c=map(int,input().split())

if a+b+c >= 22:
  print(bust)
else:
  print(win)


### FIXED CODE ###

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

if sum(a) >= 22:
    print("bust")
else:
    print("win")
#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    N, Q = next(it), next(it)

    if Q == 3:
        raise 1

    A = [None] * (N+Q)
    for i in range(N):
        ci = next(it)-1
        A[i] = (i, 0, ci)
    for i in range(Q):
        l, r = next(it)-1, next(it)-1
        A[N+i] = (r, 1, l, i)

    A.sort()
    dp = [0] * N

    N1 = (2*N+1)//2
    dp2 = [0] * (N1*2)

    ans = [0] * Q
    for r, cmd, *arg in A:
        if cmd == 0:
            ci, = arg

            lo = N1 + dp[ci]
            hi = N1 + r

            while lo < hi:
                if lo & 1:
                    dp2[lo] += 1
                    lo += 1
                if not hi & 1:
                    dp2[hi] += 1
                    hi -= 1
                lo >>= 1; hi >>= 1;

            if lo == hi: dp2[lo] += 1


            dp[ci] = r + 1
            continue

        l, i = arg
        num = 0
        j = l + N
        while j > 0:
            num += dp2[j]
            j >>= 1
        ans[i] = num

    print(*ans, sep="\n")


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

#!python3

import sys
iim = lambda: map(int, sys.stdin.readline().rstrip().split())

def resolve():
    it = map(int, sys.stdin.read().split())
    X = 19
    N, Q = next(it), next(it)
    X = Q.bit_length()
    b1, br, bc = (1 << X)-1, 2*X+1, 1<<X

    Aa = [next(it)-1 for i in range(N)]
    Aq = [0] * Q
    Ac = [0] * Q
    for i in range(Q):
        l, r = next(it)-1, next(it)-1
        Aq[i] = r<<X | i
        Ac[i] = l

    Aq.sort()
    dp = [0] * N

    N1 = (2*N+1)//2
    dp2 = [0] * (N1*2)

    ans = [0] * Q
    offset = 0
    for arg in Aq:
        r = arg >> X
        i = arg & b1

        for j in range(offset, r+1):
            ci = Aa[j]

            lo = N1 + dp[ci]
            hi = N1 + j

            while lo < hi:
                if lo & 1:
                    dp2[lo] += 1
                    lo += 1
                if not hi & 1:
                    dp2[hi] += 1
                    hi -= 1
                lo >>= 1; hi >>= 1;

            if lo == hi: dp2[lo] += 1

            dp[ci] = j + 1
        offset = r+1
        l = Ac[i]

        num = 0
        j = l + N1
        while j > 0:
            num += dp2[j]
            j >>= 1
        ans[i] = num

    print(*ans, sep="\n")


if __name__ == "__main__":
    resolve()
n,q = map(int, input().split())
STXlist = [list(map(int,input().split())) for _ in range(n)]
D = [(-1)*int(input()) for _ in range(q)]

time = 0
stop = 1
ans = [1j] * q
T = (sorted(STXlist, key=lambda x: x[1],reverse=True))  
Tmax = T[0][2]

while True:
    time += 1
    D = list(map(lambda x:x+1 , D))

    for STX in STXlist:
        if time >= STX[0] and time < STX[1]:
            if STX[2] in D:
                stop += 1
                ans[D.index(STX[2])] = D[D.index(STX[2])]
                D[D.index(STX[2])] = (1 + 1j)

    if stop == q:
        for i in ans:
            print(i)
        break
    
    if time > Tmax + 10:
        indexes = [i for i, x in enumerate(ans) if x == 1j]
        for i in indexes:
            ans[ans.index(1j)] = -1
        for i in ans:
            print(i)
        break


### FIXED CODE ###

a,p = map(int, input().split())


print((a*3 + p)//2)
s,t = map(input().split())
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)

### FIXED CODE ###

s = input()
t =input()
c=0

for i in range(len(s)):
  if s[i]!=t[i]:
    c +=1

print(c)
W, H, x, y = map(int, input().split())

if W == 0 or H == 0:

elif x == W / 2 and y == H / 2:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)


### FIXED CODE ###

W, H, x, y = map(int, input().split())

if x == W / 2 and y == H / 2:
    print(W * H / 2, 1)
else:
    print(W * H / 2, 0)
v

### FIXED CODE ###

s = input()
n = len(s)
counter = 0
for i in range(n//2):
  if s[i] != s[n-i-1]:
    counter += 1
print(counter)
while True:
    x,y = map(int,input().split())
    if x > y:
        print(f'{y}{x})
    else :
        print(f'{x}{y})
    if x == 0 or y == 0:
        break


### FIXED CODE ###

while True:
    x,y = map(int,input().split())
    if x == 0 and y == 0:
        break
    if x > y:
        print(f"{y} {x}")
    elif x <= y:
        print(f"{x} {y}")
s = input()
acgt = []
cnt = 0
for a in s:
    if a == 'A' or a == 'C' or a == 'T' or a == 'G':
        cnt += 1
    else:
        acgt.append(cnt)
        cnt = 0
acgt.appen(cnt)
print(max(acgt))
        

### FIXED CODE ###

s = input()
acgt = []
cnt = 0
for a in s:
    if a == 'A' or a == 'C' or a == 'T' or a == 'G':
        cnt += 1
    else:
        acgt.append(cnt)
        cnt = 0
acgt.append(cnt)
print(max(acgt))
n = input()
list = []
for val in range(1,n+1):
	list.append(input())
list.sort()
print list[0]

### FIXED CODE ###

n = int(input())
list = []
for val in range(1,n+1):
	word = raw_input()
	list.append(str(word))
list.sort()
print list[0]
import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,v,p = map(int,input().split())
    MOD = 10**9+7
    N = v+p+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(x,y):
        return (fac[x+y]*pow(fac[x],MOD-2,MOD)*pow(fac[y],MOD-2,MOD))%MOD
 
    print((comb(v+1,p+1)-comb(v+1,b)-comb(p+1,a)+comb(a,b))%MOD)
    
if _name_ == "_main_":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
 
def main():
    a,b,c,d = map(int,input().split())
    MOD = 10**9+7
    N = c+d+5
    fac = [0 for _ in range(N+1)]
    fac[0],fac[1] = 1,1
 
    for i in range(2,N+1):
        fac[i] = (fac[i-1]*i)%MOD
        
    def comb(g,h):
        return (fac[g+h]*pow(fac[g],MOD-2,MOD)*pow(fac[h],MOD-2,MOD))%MOD
 
    print((comb(c+1,d+1)-comb(c+1,b)-comb(d+1,a)+comb(a,b))%MOD)
    
if __name__ == "__main__":
    main()
from functools import lru_cache
import sys
sys.setrecursionlimit(10100)

N, M = map(int, input().split())
a = list(int(input()) for _ in range(M))

MOD = pow(10, 9) + 7

isOk = True
for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        isOk = False
    
@lru_cache(maxsize = None)
def func(n):
    if n <= 0:
        return 1
    cnt = 0
    if n >= 2:
        cnt += func(n-2) % MOD
    if n >= 1:
        cnt += func(n-1) % MOD
    return cnt

if not isOk:
    print(0)
else:
    ans = 1
    s = 0
    for i in range(M+1):
        if i >= M:
            e = N
        else:
            e = a[i] - 1

        ans = ans * func(e-s) % MOD

        if i >= M:
            break

        s = a[i] + 1

    print(ans)


### FIXED CODE ###

from functools import lru_cache
import sys
sys.setrecursionlimit(30000)

N, M = map(int, input().split())
a = list(int(input()) for _ in range(M))

MOD = pow(10, 9) + 7

isOk = True
for i in range(M-1):
    if a[i] + 1 == a[i+1]:
        isOk = False
    
funcb = [-1] * 100001
def func(n):
    if n <= 0:
        return 1
    cnt = funcb[n]
    if cnt > 0:
        return cnt
    cnt = 0
    if n >= 2:
        cnt += func(n-2)
    if n >= 1:
        cnt += func(n-1)
    funcb[n] = cnt % MOD
    return funcb[n]

func(30000)
func(50000)
func(80000)
func(100000)

if not isOk:
    print(0)
else:
    ans = 1
    s = 0
    for i in range(M+1):
        if i >= M:
            e = N
        else:
            e = a[i] - 1

        ans = ans * func(e-s) % MOD

        if i >= M:
            break

        s = a[i] + 1

    print(ans)
a, b, k = map(int, input().split())
print(f"{a - k} {b}" if a >= k else f"0 {b - (k - a)}")

### FIXED CODE ###

a, b, k = map(int, input().split())
print("{} {}".format(a - k, b) if a >= k else "{} {}".format(0, max(0, b - (k - a))))
a, b = map(int, input().split())
if a == 'D':
    if b == 'H':
        print('D')
    else:
        print('H')
else:
    if b == 'D':
        print('D')
    else:
        print('H')

### FIXED CODE ###

a, b = input().split()
if a == 'D':
    if b == 'H':
        print('D')
    else:
        print('H')
else:
    if b == 'D':
        print('D')
    else:
        print('H')
line = input().split(' ')
A = int(line[0])
B = int(line[1])
K = int(line[2])
Z = 0

def p2(num1, num2, Z):
  if Z:
    return(0)
  else:
    if(num1 < num2):
      return (num2 - num1)
      Z = 1
    else:
      return(0)
  
print(str(p2(K, A)) + ' ' + str(p2(K - A, B)))

### FIXED CODE ###

line = input().split(' ')
A = int(line[0])
B = int(line[1])
K = int(line[2])

if K < A:
  print(str(A - K) + ' ' + str(B))
else:
  if K - A < B:
    print(str(0) + ' ' + str(B - K + A))
  else:
    print(str(0) + ' ' + str(0))
import sys
sys.setrecursionlimit(50000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))

### FIXED CODE ###

import sys
sys.setrecursionlimit(150000)

n, m = map(int, input().split())
bad = [int(input()) for _ in range(m)]
MOD = int(1e9+7)

memo = {0:1, 1:1}
for i in bad:
    memo[i] = 0

def fib(n, mod):
    if n not in memo:
        memo[n] = (fib(n-1, mod) + fib(n-2, mod)) % mod
    return memo[n]

print(fib(n, MOD))
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

N = int(readline())
m = map(int, read().split())
AB = zip(m, m)

MOD = 10 ** 9 + 7

graph = [[] for _ in range(N + 1)]
for a, b in AB:
    graph[a].append(b)
    graph[b].append(a)

root = 1
parent = [0] * (N + 1)
order = []
stack = [root]
while stack:
    x = stack.pop()
    order.append(x)
    for y in graph[x]:
        if y == parent[x]:
            continue
        parent[y] = x
        stack.append(y)

fact = [1] * (N + 10)
for n in range(1, N + 10):
    fact[n] = n * fact[n - 1] % MOD
fact_inv = [1] * (N + 10)
fact_inv[-1] = pow(fact[-1], MOD - 2, MOD)
for n in range(N + 9, 0, -1):
    fact_inv[n - 1] = fact_inv[n] * n % MOD

size_d = [0] * (N + 1)
dp_d = [1] * (N + 1)

for v in order[::-1]:
    dp_d[v] *= fact[size_d[v]]
    dp_d[v] %= MOD
    p = parent[v]
    s = size_d[v] + 1
    size_d[p] += s
    dp_d[p] *= fact_inv[s] * dp_d[v]
    dp_d[p] %= MOD

size_u = [N - 2 - x for x in size_d]
dp_u = [1] * (N + 1)

for v in order[1:]:
    p = parent[v]
    x = dp_d[p]
    x *= dp_u[p]
    x *= fact_inv[size_d[p]]
    x *= fact[size_d[v] + 1]
    x *= pow(dp_d[v], MOD - 2, MOD)
    x *= fact[size_u[v]]
    x *= fact_inv[size_u[p] + 1]
    dp_u[v] = x % MOD

for xd, xu, sd, su in zip(dp_d[1:], dp_u[1:], size_d[1:], size_u[1:]):
    su += 1
    x = xd * xu * fact[sd + su] * fact_inv[sd] * fact_inv[su] % MOD
    print(x)


### FIXED CODE ###

#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

X, Y, A, B, C = map(int, readline().split())
P = sorted(map(int, readline().split()), reverse=True)
Q = sorted(map(int, readline().split()), reverse=True)
R = sorted(map(int, readline().split()), reverse=True)

P = P[:X]
Q = Q[:Y]
nums = P + Q + R
nums.sort(reverse=True)
answer = sum(nums[:X + Y])
print(answer)
N=int(input())
abc=[tuple(map(int,input().split())) for i in range(N-1)]
g=[set() for i in range(N)]
for a,b,c in abc:
  g[a-1].add((b-1,c))
  g[b-1].add((a-1,c))
memo=[0]*N
memo[K-1]=0
Q,K=map(int,input().split())
import collections
q=collections.deque([(K-1,0)])
while(q):
  x,w = q.popleft()
  for a,b in g[x]:
    if memo[a]==-1:
      memo[a]=w+b
      q.append((a,w+b))
  
for i in range(Q):
  x,y=map(int,input().split())
  print(memo[a-1]+memo[b-1])

### FIXED CODE ###

N=int(input())
abc=[tuple(map(int,input().split())) for i in range(N-1)]
g=[set() for i in range(N)]
for a,b,c in abc:
  g[a-1].add((b-1,c))
  g[b-1].add((a-1,c))
memo=[-1]*N

Q,K=map(int,input().split())
import collections
q=collections.deque([(K-1,0)])
memo[K-1]=0
while(q):
  
  x,w = q.popleft()
  for a,b in g[x]:
    if memo[a]==-1:
      memo[a]=w+b
      q.append((a,w+b))
  
for i in range(Q):
  x,y=map(int,input().split())
  print(memo[x-1]+memo[y-1])
s = input()
    for i in range(8):
        total = int(s[0])
        str = s[0]
        for j in range(1, 4):
            if i >> (j - 1) & 1:
                total += int(s[j])
                str += '+' + s[j]
            else:
                total -= int(s[j])
                str += '-' + s[j]
        if total == 7:
            print(str + '=7')
            exit()

### FIXED CODE ###

s = input()
ans = 'inf'
for i in range(8):
    total = int(s[0])
    str = s[0]
    for j in range(3):
        if i>>j&1:
            total += int(s[j+1])
            str += '+' + s[j+1]
        else:
            total -= int(s[j+1])
            str += '-' + s[j+1]
    if total == 7:
        print(str + '=7')
        exit()
n,m = map(int, input().split())
pirnt((n-1)*(m-1))

### FIXED CODE ###

n,m = map(int, input().split())
print((n-1)*(m-1))
a=int(input())
b=((a//3)*(3+(3*(a//3))))*(1/2)
c=((a//5)*(5+(5*(a//5))))*(1/2)
d=((a//15)*(15+(15*(a//15))))*(1/2)
e=(a(1+a)*(1/2))-(b+c-d)
print(e)

### FIXED CODE ###

a=int(input())
b=((a//3)*(3+(3*(a//3))))*(1/2)
c=((a//5)*(5+(5*(a//5))))*(1/2)
d=((a//15)*(15+(15*(a//15))))*(1/2)
e=(a*(1+a)*(1/2))-(b+c-d)
print(int(e))
def solve(n, p_list):

    count = 0
    j = 2 * 10^^5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)

### FIXED CODE ###

def solve(n, p_list):

    count = 0
    j = 2 * 10**5 +1
    for i in p_list:
        if j > i:
            count += 1
            j = i

    return count

if __name__ == "__main__":

    n = int(input())
    p_list = [int(i) for i in input().split()]
    ans = solve(n, p_list)
    print(ans)
M,N = map(int, input().split())
count = 0
for _ in range(M):
    a, b = map(int, input().split())
    X = a*a + b*b
    if X <= N*N:
        count += 1
 
print(count)

### FIXED CODE ###

X = int(input())
 
if X >= 30:
    print("Yes")
 
else:
    print("No")
# -*- coding: utf-8 -*-
from math import factorial

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def calc_routes(dan):
    tmp = 1
    for i in range(int(dan/2)):
        i += 1
        n = dan - i
        tmp += factorial(n) / factorial(i) / factorial(n - i)
        # tmp += len(list(itr.combinations(range(n), i)))

    return tmp

routes = 1
prev = 0
for x in a:
    if x == prev:
        routes = 0
        break
    else:
        dan = (x-1) - prev
        routes = (routes * calc_routes(dan)) % 1000000007
        prev = x+1

routes = (routes * calc_routes(N-prev)) % 1000000007
print(int(routes))

### FIXED CODE ###

# -*- coding: utf-8 -*-
from math import factorial

N, M = map(int, input().split())
a = [int(input()) for x in range(M)]

def fibo(dan):
    tmp = [1, 1]
    for i in range(2, dan+1):
        tmp.append(tmp[i-1] + tmp[i-2])
    return tmp[dan]

routes = 1
prev = 0
for x in a:
    if x == prev:
        routes = 0
        break
    else:
        dan = (x-1) - prev
        routes = (routes * fibo(dan))
        prev = x+1

routes = (routes * fibo(N-prev)) % 1000000007
print(int(routes))
s = input()
if s == 'AAA' or S === 'BBB':
  print('No')
else:
  print('Yes')

### FIXED CODE ###

s = input()
if s == 'AAA' or s == 'BBB':
  	print('No')
else:
    print('Yes')
import math
n,k = map(int,input().split())
a_list = [i for i in map(int,input().split())]
a_list.sort()
"""
2進数での各bitが立ってる回数をカウントして少ない方()の値を採用する
"""
max_keta = math.floor(math.log(a_list[-1],2))+1
k_keta = math.floor(math.log(k,2))+1
cnt_list = [0 for i in range(k_keta)]
for i in a_list:
    tmp = i
    keta = -1
    while tmp != 0:
        a = tmp % 2
        tmp = int(tmp/2)
        if a == 1:
            cnt_list[keta] += 1
        keta = keta -1
maxi = 0
"""
単純に1からkまで2進数に直して足し合わせて最大かどうかを確かめる
"""
#print(cnt_list)
for i in range(1,k+1):
    k_list = [0 for i in range(k_keta)]
    tmp = i
    keta = -1
    while tmp != 0:
        a = tmp % 2
        tmp = int(tmp/2)
        if a == 1:
            k_list[keta] = 1
        keta = keta-1
    """
    それぞれの桁について1にできるかどうか
    """
    tmp = 0
    kake = 1
    #print(k_list)
    for j in range(k_keta-1,-1,-1):
        if k_list[j] == 1:
            tmp += kake * (n-cnt_list[j])
        else:
            tmp += kake * cnt_list[j]
        kake *= 2
    #print("tmp:{}".format(tmp))
    maxi = max(maxi , tmp)

print(maxi)


### FIXED CODE ###

import math
n,k = map(int,input().split())
a_list = [i for i in map(int,input().split())]
cnt_list = [0 for i in range(40)]
maxi = 0
if k == 0:
    maxi = sum(a_list)
else:
    for i in a_list:
        b = bin(i)[2:]
        b = b[::-1]
        for index,j in enumerate(b):
            cnt_list[-(index+1)] += int(j)
    goukei = 0
    for i in range(40):
        if cnt_list[i] <= n/2 and (goukei + 2**(39-i)) <= k:
            goukei += 2**(39-i)
            maxi += (2**(39-i)) * (n - cnt_list[i])
        else:
            maxi += (2**(39-i)) * (cnt_list[i])

print(maxi)