Harryxun/stf_run huggingface dataset:
t = list(input())

if t[0] == '?':
    if t[i+1] == 'D' or t[i+1] == '?':
                t[i] = 'P'
    else:
        t[-1] = 'D'

for i in range(1, len(t)-1):
    if t[i] == '?':
        if t[i-1] == 'P':
            t[i] = 'D'
        else:
            if t[i+1] == 'D' or t[i+1] == '?':
                t[i] = 'P'
            else:
                t[i] = 'D'

if t[-1] == '?':
    t[-1] = 'D' 

print("".join(t))

### FIXED CODE ###

t = input()
if t == 'P':
    print('P')
elif t == 'D' or t == '?':
    print('D')
else:
    t = list(t)
    if t[0] == '?':
        if t[1] == 'D' or t[1] == '?':
                    t[0] = 'P'
        else:
            t[0] = 'D'

    for i in range(1, len(t)-1):
        if t[i] == '?':
            if t[i-1] == 'P':
                t[i] = 'D'
            else:
                if t[i+1] == 'D' or t[i+1] == '?':
                    t[i] = 'P'
                else:
                    t[i] = 'D'
    if t[-1] == '?':
        t[-1] = 'D' 
    print("".join(t))
a=int(input())
if n%2==1:
  print(str(((n-1)/2+1)/2)+"\n")
else:
  print(str(1/2)+"\n")

### FIXED CODE ###

n=int(input())
if n%2==1:
  print(str(((n-1)/2+1)/n)+"\n")
else:
  print(str(1/2)+"\n")
S = int(input())
if int(S[:2]) > 12 and int(S[2:]) <= 12:
  print('YYMM')
elif int(S[:2]) <= 12 and int(S[2:]) > 12 and int(S[2:]) != 0:
  print('MMYY')
elif int(S[:2]) <= 12 and int(S[2:]) <= 12 and int(S[:2]) != 0  and int(S[2:]) != 0:
  print('AMBIGUOUS')
else:
  print('NA')

### FIXED CODE ###

S = input()
a,b = int(S[:2]), int(S[2:])
if (a > 12 or a == 0 )and b <= 12 and b > 0:
  print('YYMM')
elif a <= 12 and (b > 12 or b == 0) and a > 0:
  print('MMYY')
elif a <= 12 and b <= 12 and a > 0  and b > 0:
  print('AMBIGUOUS')
else:
  print('NA')
from math import gcd,sqrt

def factorization(n):
    arr = []
    temp = n
    for i in range(2,int(sqrt(n))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i,cnt])
    if temp != 1:
        arr.append([temp,1])
    if arr == []:
        arr.append([n,1])
    return arr

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

x = gcd(a,b)

print(len(factorization(x))+ (1 if len(factorization(x)) != 1 else 0))

### FIXED CODE ###

from fractions import gcd

def factorization(n):
    arr = []
    temp = n
    for i in range(2,int(-(-n**0.5//1))+1):
        if temp % i == 0:
            cnt = 0
            while temp % i == 0:
                cnt += 1
                temp //= i
            arr.append([i,cnt])
    if temp != 1:
        arr.append([temp,1])
    if arr == []:
        arr.append([n,1])
    return arr

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

x = gcd(a,b)

ans = len(factorization(x))+1
if factorization(x) == [[1,1]]:
  ans -= 1
print(ans)
s=input()

flag=True
KIHBR="KIHBR"
s_new=s.replace("A", "")
if len(s_new)>5:
    flag=False
else:
    for i in range(5):
        if s_new[i]!=KIHBR[i]:
            flag=False
            break

if s.count("AA")>1 or s.count("KIH")!=1:
    flag=False

print("YES" if flag else "NO")


### FIXED CODE ###

s=input()
AKB={"AKIHABARA","KIHABARA","AKIHBARA","KIHBARA","AKIHABRA","KIHABRA","AKIHBRA","KIHBRA","AKIHABAR","KIHABAR","AKIHBAR","KIHBAR","AKIHABR","KIHABR","AKIHBR","KIHBR"}

print("YES" if s in AKB else "NO")
#!/usr/bin/env python3
import sys
import statistics
import collections

def solve(n: int, v: "List[int]"):
    half_length = len(v) // 2
    O = [v[i] for i in range(1, n, 2)]
    E = [v[i] for i in range(0, n, 2)]

    co = list(collections.Counter(O).most_common())
    ce = list(collections.Counter(E).most_common())
    o1 = co[0][0]
    e1 = ce[0][0]

    O_ = list(filter(lambda o: o != o1, O))
    E_ = list(filter(lambda e: e != e1, E))
    num_o_1 = len(O_) 
    num_e_1 = len(E_)
    if False and e1 != o1:
        num = num_o_1 + num_e_1
    else:
        if len(co) == 1 and len(ce) == 1:
            num = half_length
        elif len(co) == 1:
            e2 = ce[1][0]
            num_e_2 = len(list(filter(lambda e: e != e2, E)))
            num = num_o_1 + num_e_2
        elif len(ce) == 1:
            o2 = co[1][0]
            num_o_2 = len(list(filter(lambda o: o != o2, O)))
            num = num_o_2 + num_e_1
        else:
            e2 = ce[1][0]
            o2 = co[1][0]
            num = min(num_o_1 + num_e_2, num_o_2 + num_e_1)
    print(num)
    return


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
    v = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, v)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
import statistics
import collections

def solve(n: int, v: "List[int]"):
    half_length = len(v) // 2
    O = [v[i] for i in range(1, n, 2)]
    E = [v[i] for i in range(0, n, 2)]

    co = list(collections.Counter(O).most_common())
    ce = list(collections.Counter(E).most_common())
    o1 = co[0][0]
    e1 = ce[0][0]

    O_ = list(filter(lambda o: o != o1, O))
    E_ = list(filter(lambda e: e != e1, E))
    num_o_1 = len(O_) 
    num_e_1 = len(E_)

    num = 0
    if e1 != o1:
        num = num_o_1 + num_e_1
    else:
        if len(co) == 1 and len(ce) == 1:
            num = half_length
        elif len(co) == 1:
            e2 = ce[1][0]
            num_e_2 = len(list(filter(lambda e: e != e2, E)))
            num = num_o_1 + num_e_2
        elif len(ce) == 1:
            o2 = co[1][0]
            num_o_2 = len(list(filter(lambda o: o != o2, O)))
            num = num_o_2 + num_e_1
        else:
            e2 = ce[1][0]
            o2 = co[1][0]
            num_e_2 = len(list(filter(lambda e: e != e2, E)))
            num_o_2 = len(list(filter(lambda o: o != o2, O)))
            num = min(num_o_1 + num_e_2, num_o_2 + num_e_1)
    print(num)
    return

def len2(l):
    n = 0
    for i in l:
        n += 1
    return n

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
    v = [ int(next(tokens)) for _ in range(n) ]  # type: "List[int]"
    solve(n, v)

if __name__ == '__main__':
    main()
a,b,c=map(input())
print('YES' if a[-1]=b[0] and b[-1]=c[0] else "NO")

### FIXED CODE ###

a,b,c=input().split()
print('YES' if a[-1]==b[0] and b[-1]==c[0] else "NO")
def main():
  n = int(input())
  pirnt(n**3)
  
main()

### FIXED CODE ###

def main():
  n = int(input())
  print(n**3)
  
main()
N = int(input())
S = input()

s = S[0]
i = 1
ans = 1
while(True):
    if s == S[i]:
        pass
    else:
        ans += 1
        s = S[i]
    i += 1
    if i == len(S):
        break
        
print(ans)

### FIXED CODE ###

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

s = S[0]
i = 1
ans = 1
while(True):
    
    if i == len(S):
        break
    if s == S[i]:
        pass
    else:
        ans += 1
        s = S[i]
    i += 1
        
print(ans)
import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/3:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a)))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))

### FIXED CODE ###

import math
a,b,x = map(int,input().split())
if x > ((a**2)*b)/2:
    print(math.degrees(math.atan((2*(b-x/(a**2))/a))))
else:
    print(math.degrees(math.atan((a*(b**2))/(2*x))))
a, b = input()

if a >= 13:
    print(b)
elif a <= 5:
    print(0)
else:
    print(b/2)


### FIXED CODE ###

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

if a >= 13:
    print(b)
elif a <= 5:
    print(0)
else:
    print(int(b/2))
a,b=map(int,input().split())
print((int)(a*b))

### FIXED CODE ###

import decimal
a, b = map(decimal.Decimal, input().split())
print(a * b // 1)
#!/mnt/c/Users/moiki/bash/env/bin/python
from itertools import permutations
N,M = map(int, input().split())
cost = [0,2,5,5,4,5,6,3,7,6]
A = list(map(int, input().split()))

p = []
for a in A:
    p.append( (cost[a], a) )
costp = sorted(p)


costX = [ z[0] for z in costp]
A = [ z[1] for z in costp]

dp = [""] * (N+1)

for c,a in zip(costX,A):
    i = N
    # print("i : ", i , "dp: ", dp[i] , ", [str(a)]: ", str(a))
    for p in permutations( [dp[i], str(a)]):
        dp[i-c] = max( 0 if len(dp[i-c]) == 0 else int(dp[i-c]), int( "".join(p)))
        dp[i-c] = str(dp[i-c])

for i in range(N-1, 1, -1):
    if dp[i] == "":
        continue
    for c,a in zip(costX,A):
        # print("i : ", i , "dp: ", dp[i] , ", [str(a)]: ", str(a))
        for p in permutations( [dp[i], str(a)]):
            dp[i-c] = max( 0 if len(dp[i-c]) == 0 else int(dp[i-c]), int( "".join(p)))
            dp[i-c] = str(dp[i-c])
    
print(dp[0])
    
    
    
    




### FIXED CODE ###

N,M = map(int, input().split())
cost = [0,2,5,5,4,5,6,3,7,6]
A = list(map(int, input().split()))

costp = sorted([ (cost[a] ,a) for a in A], key=lambda x:x[1], reverse=True)
costX = [ z[0] for z in costp]
A = [ z[1] for z in costp]
# print(A,costX)

dp = [-1] * (N+1)
dp[N] = 0

for i in range(N, 1, -1):
    if (dp[i]) == -1:
        continue

    for c,a in zip(costX,A):
        if i-c >= 0:
            dp[i-c] = dp[i] + 1


ans = ""

i = 0
while i<N:
    # print(i)
    for c,a in zip(costX,A):
        # print(c,a,i)
        # if i+c <= N:
        #     print("i: {}, dp[i]=".format(i), dp[i], ", dp[i+c]: ", dp[i+c], "c=",c, "a=",a)
        # else: print("i: {}, dp[i]=".format(i), dp[i], ",c=",c, "a=",a)
        
        if i+c <= N:
            if dp[i]-1 == dp[i+c]:
                ans += str(a)
                i = i+c
                break

print(ans)
# print(dp)
import numpy as np

N = int(input())
S = np.frombuffer('-'+input().rstrip(),'S1')
Q = int(input())
query = map(int,input().split())

isD = S == 'D'
isM = S == 'M'
isC = S == 'C'

cumD = isD.cumsum(dtype=np.int64)
cumM = isM.cumsum(dtype=np.int64)

for K in query:
    x = cumD.copy(); x[K:] -= cumD[:-K]
    x *= isM
    x[K+1:] -= isD[1:-K] * (cumM[K:-1] - cumM[:-K-1])
    print((x.cumsum() * isC).sum())


### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

import numpy as np

N = int(readline())
S = np.frombuffer(readline().rstrip(),'S1')
Q = int(readline())
query = map(int,read().split())

isD = S == b'D'
isM = S == b'M'
isC = S == b'C'

cumD = isD.cumsum(dtype=np.int64)
cumM = isM.cumsum(dtype=np.int64)

def F(K):
    """
    ・Cごとに数える。
    ・そのためには(i-K,i] 内のDMの個数を調べる（負インデックスには関係ない文字があると思っておく）
    ・区間内のDの個数、Mの個数が取得できれば、差分が取得できるので最後に累積和
    """
    # (i-K,i]内のDの個数、Mの個数
    D = cumD.copy(); D[K:] -= cumD[:-K]
    M = cumM.copy(); M[K:] -= cumM[:-K]
    # 最後がMのとき、Dの個数分増える
    DM = isM * D
    # 左端のDを捨てるとき、Mの個数分減る
    DM[K:] -= isD[:-K] * M[K-1:-1]
    np.cumsum(DM,out=DM)
    # Cごとに集計
    return DM[isC].sum()

print('\n'.join(str(F(K)) for K in query))
n ＝ input()
sum=0
for i in range(1,n+1):
    sum+=i
print(sum)

### FIXED CODE ###

n = int(input())
sum=0
for i in range(1,n+1):
    sum+=i
print(sum)
n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  if s_ in s:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    s.append(s_)
    cnt[s_] = 1

print(ans)


### FIXED CODE ###

n = int(input())
s = []
cnt = {}
ans = 0
for i in range(n):
  s_ = list(str(input()))
  s_.sort()
  s_ = "".join(s_)
  if s_ in cnt:
    ans += cnt[s_]
    cnt[s_] += 1
  else:
    cnt[s_] = 1

print(ans)
import bisect
from itertools import accumulate
from operator import add

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

AonB=[]
BonC=[]
ans=0
for i in range(n):
    AonB.append(bisect.bisect_left(a,b[i]))

AonB=list(accumulate(AonB,add))

ans=0
for g in range(n):
    search=bisect.bisect_left(b,c[g])-1
    if search>=0:
        ans+=AonB[search]

print(ans)

### FIXED CODE ###

import bisect
from itertools import accumulate
from operator import add

n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))

a.sort()
b.sort()
c.sort()

AonB=[]
BonC=[]
ans=0
for i in range(n):
    AonB.append(bisect.bisect_left(a,b[i]))

AonB=list(accumulate(AonB,add))

ans=0
for g in range(n):
    search=bisect.bisect_left(b,c[g])-1
    if search>=0:
        ans+=AonB[search]

print(ans)
from functools import lru_cache

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

A = [int(input()) for _ in range(M)]

# print(N, M, A)

count = 0

@lru_cache(1000)
def dfs(pos):
    if pos == N:
        return 1
    s = 0
    if (pos + 1) not in A:
        s += dfs(pos + 1)
    if (pos + 2) not in A and ((pos + 2) <= N):
        s += dfs(pos + 2)
    return s

print(dfs(0) % 1000000007)


### FIXED CODE ###

from functools import lru_cache

import sys
sys.setrecursionlimit(1000000)

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

A = set(int(input()) for _ in range(M))

@lru_cache(None)
def dfs(pos):
    if pos > N:
        return 0
    if pos == N:
        return 1
    if pos in A:
        return 0
    return dfs(pos + 2) + dfs(pos + 1)

for i in reversed(range(N+1)):
    dfs(i)

print(dfs(0) % 1000000007)
n=int(input())
a=list(int,input().split())
b=0
for i in range(n):
  if a[i]-a[i+1]>=2:
    b+=1
if b==0:
  print("Yes")
else:
  print("No")


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=0
c=a.reverse()
d=0
for i in range(n-1):
  if a[i]-a[i+1]==-1:
    a[i+1]=a[i+1]-1
  elif a[i]-a[i+1]<=-2:
    b+=1
  else:
    d=d
    
if b==0:
  print("Yes")
else:
  print("No")
N,T = map(int,input().split())

a = list(map(int,input().split()))
maxDiff = 0
curMin = a[0]
for i in range(n):
  if curMin > a[i]:
    curMin = a[i]
  if maxDiff < a[i] - curMin:
    maxDiff = a[i] - curMin

isCovered = False
count = 0

curMin = a[0]

for i in range(n):
  if curMin > a[i]:
    curMin = a[i]
    isCovered = False
  if maxDiff == a[i] - curMin:
    if not isCovered:
      count += 1
      isCovered = True

print(count)

### FIXED CODE ###

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

a = list(map(int,input().split()))
maxDiff = 0
curMin = a[0]
for i in range(n):
  if curMin > a[i]:
    curMin = a[i]
  if maxDiff < a[i] - curMin:
    maxDiff = a[i] - curMin

isCovered = False
count = 0

curMin = a[0]

for i in range(n):
  if curMin > a[i]:
    curMin = a[i]
    isCovered = False
  if maxDiff == a[i] - curMin:
    if not isCovered:
      count += 1
      isCovered = True

print(count)
def answer(B, C):
    if B > C:
        print("Yes")
    else:
        print("No")


def main():
    A, B, C = [int(x) for x in stdin.readline().split()]
    if A < B:
        answer(B, C)
    else:
        answer(C, B)


if __name__ == "__main__":
    main()


### FIXED CODE ###

from sys import stdin

'''
def answer(A, x, y):
    if A < y < x:
        print("Yes")
    else:
        print("No")
'''


def main():
    A, B, C = [int(x) for x in stdin.readline().split()]
    if A < B:
        if A < C < B:
            print("Yes")
        else:
            print("No")
    else:
        if B < C < A:
            print("Yes")
        else:
            print("No")


if __name__ == "__main__":
    main()
a = input()
n = 2
m = 3
print(a + a**n + a**m)

### FIXED CODE ###

a = int(input())
n = 2
m = 3
print(a + a ** n + a ** m)
import math
x = int(input())
y = []
for i in range(70):
    y.append(i**5)
    y.append(-i**5)
for j in range(140):
    for k in range(140):
        if y[k]-y[j] ==x:
            a = (k )//2
            b = (j )//2
             
print(a,-b)

### FIXED CODE ###

import math
x = int(input())
y = []
for i in range(1000):
    y.append(i**5)
for j in range(1000):
    for k in range(j,1000):
        if y[k]+ y[j] == x:
            a = k
            b = -j 
        if y[k] - y [j] == x:
            a = k
            b = j
            
print(a,b)
# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    if len(S)%2==0:
        left=len(S)//2-1
        right=len(S)//2
        ans=len(S)//2
        if S[left]==S[right]:
            x=S[left]
            while S[left]==S[right]==x and left>=0 and right<len(S):
                left-=1
                right+=1
                ans+=1
            if left>=0 and right<len(S) and S[left]!=x or S[right]!=x:
                ans-=1
    else:
        left=len(S)//2-1
        right=len(S)//2+1
        ans=len(S)//2+1
        x=S[len(S)//2]
        if left>=0 and right<len(S) and S[left]==S[right]==x:
            ans+=1
            while S[left]==S[right]==x and left>=0 and right<len(S):
                left-=1
                right+=1
                ans+=1
            if S[left]!=x or S[right]!=x:
                ans-=1
        elif left>=0 and right<len(S) and S[left]==x or S[right]==x:
            ans+=1
    print(ans)

if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**9)
INF=10**18
MOD=10**9+7
input=lambda: sys.stdin.readline().rstrip()
YesNo=lambda b: bool([print('Yes')] if b else print('No'))
YESNO=lambda b: bool([print('YES')] if b else print('NO'))
int1=lambda x:int(x)-1

def main():
    S=list(map(int,list(input())))
    N=len(S)
    if N%2==0:
        left=N//2-1
        right=N//2
        ans=N//2
        if S[left]==S[right]:
            x=S[left]
            while left-1>=0 and S[left-1]==x:
                left-=1
            while right+1<N and S[right+1]==x:
                right+=1
            ans+=min(N//2-left,right-N//2+1)
    else:
        left=N//2
        right=N//2
        x=S[N//2]
        ans=N//2+1
        if left-1>=0 and S[left-1]==x:
            while left-1>=0 and S[left-1]==x:
                left-=1
        if right+1<N and S[right+1]==x:
            while right+1<N and S[right+1]==x:
                right+=1
        ans+=min(N//2-left,right-N//2)
    print(ans)

if __name__ == '__main__':
    main()
nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]
slist = []
clist = []
for i in range(m):
  sc = [int(i) for i in input().split()]
  slist.append(sc[0])
  clist.append(sc[1])

fl = 0
if (n == 1):
  if (slist[0] == 1 and clist[0] == 0):
    print('-1')
    fl = 1

answerlist = ['-1' for i in range(n)]
for (i,s), c in zip(enumerate(slist),clist):
  if (c == 0 and s == 1):
    print('-1')
    break
    fl = 1
  if (answerlist[s-1] != '-1' and answerlist[s-1] != str(c)):
    print('-1')
    break
    fl = 1
  answerlist[s-1] = str(c)
for i in range(n):
  if (answerlist[i]) == '-1':
    if (i == 0):
      answerlist[i] = '1'
    else:
      answerlist[i] = '0'
if fl == 0:
	print("".join(answerlist))

### FIXED CODE ###

nm = [int(i) for i in input().split()]
n = nm[0]
m = nm[1]
slist = []
clist = []

for i in range(m):
  sc = [int(i) for i in input().split()]
  slist.append(sc[0])
  clist.append(sc[1])

fl = 0
if (n == 1):
  if m != 0:
    if (slist[0] == 1 and clist[0] == 0):
      print('0')
      fl = 1
      exit()

answerlist = ['-1' for i in range(n)]
for (i,s), c in zip(enumerate(slist),clist):
  if (c == 0 and s == 1):
    print('-1')
    fl = 1
    exit()
  if (answerlist[s-1] != '-1' and answerlist[s-1] != str(c)):
    print('-1')
    fl = 1
    exit()
  answerlist[s-1] = str(c)
for i in range(n):
  if (answerlist[i]) == '-1':
    if (i == 0):
      if (n == 1):
        answerlist[i] = '0'
      else:
        answerlist[i] = '1'
    else:
      answerlist[i] = '0'
if fl == 0:
	print("".join(answerlist))
# D

# 10^12 < 2^40

def hard_log2(N):
    
    r = 1
    l = 0
    while N >= 2*r:
        r *= 2
        l += 1
    return r, l

def maximize(r_list, K, N):
    
    if K == 0:
        return 0
    
    L, M = hard_log2(K)
    
    if r_list[M] >= N - r_list[M]:
        return maximize(r_list, L-1, N)+r_list[M]*(2**M)
    else:
        R = 0
        while 2**M > K-L:
            R += (N-r_list[M])*(2**M)
            M -= 1
        
        return max(maximize(r_list, K-L, N)+R, maximize(r_list, L-1, N))

def main_d(A_list, N, K):
    r_list = [0]*40
    for i in range(40):
        for A in A_list:
            if (A % 2**(i+1)) >= 2**i:
                r_list[i] += 1
    L, M = hard_log2(K)
    R = 0
    for i in range(N+1, 40):
        R += r_list[i]*(2**i)
    return R + maximize(r_list, K, N)
    

if __name__ == "__main__":
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))
    res = main_d(A_list, N, K)
    print(res)

### FIXED CODE ###

# D

# 10^12 < 2^40

def hard_log2(N):
    
    r = 1
    l = 0
    while N >= 2*r:
        r *= 2
        l += 1
    return r, l

def maximize_simple(r_list, K, N):
    if K == 0:
        return 0
    R = 0
    L, M = hard_log2(K)
    for i in range(M+1):
        R += max(r_list[i], N - r_list[i])*(2**i)
        
    return R

def maximize(r_list, K, N):
    
    if K == 0:
        return 0
    
    L, M = hard_log2(K)
    
    if r_list[M] >= N - r_list[M]:
        return maximize_simple(r_list, L-1, N)+r_list[M]*(2**M)
    else:
        R = (N-r_list[M])*(2**M)
        m = M - 1
        while 2**m > K-L and m >=0:
            R += r_list[m]*(2**m)
            m -= 1
        
        return max(maximize(r_list, K-L, N)+R, maximize_simple(r_list, L-1, N)+r_list[M]*(2**M))

def main_d(A_list, N, K):
    r_list = [0]*41
    for i in range(41):
        for A in A_list:
            if (A % 2**(i+1)) >= 2**i:
                r_list[i] += 1
    if K == 0:
        R = 0
        for i in range(41):
            R += r_list[i]*(2**i)
        return R
    else:
        L, M = hard_log2(K)
        R = 0
        for i in range(M+1, 41):
            R += r_list[i]*(2**i)
        return R + maximize(r_list, K, N)
    

if __name__ == "__main__":
    N, K = map(int, input().split())
    A_list = list(map(int, input().split()))
    res = main_d(A_list, N, K)
    print(res)
N = int(input())
B = list(int,input().split())

answer = B[0] + B[N-2]

for i in range(N-2):
    answer += min(B[i],B[i+1])

print(answer)


### FIXED CODE ###

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

answer = B[0] + B[N-2]

for i in range(N-2):
    answer += min(B[i],B[i+1])

print(answer)
n = int(input())
a = list(int(input()) for _ in range(n))

num = max(a)
for i in range(n):
    if a[i] < num:
        print(num)
    else:
        b = a.copy()
        int(b.pop(i))
        print(max(b))

### FIXED CODE ###

n = int(input())
a = list(int(input()) for _ in range(n))

max_list = sorted(a,reverse=True)[:2]
num = max_list[0]
num2 = max_list[1]

for i in range(n):
    if a[i] < num:
        print(num)
    else:
        print(num2)
n = int(input())
a = input()
s = list(a)

i = 0
while i<len(s) and s[i] == '.':
  i+=1
j = n-1
while i>=0 and s[j] == '#':
  j-=1

s = s[i:j]
print(min(s.count('#'),s.count('.')))


### FIXED CODE ###

n = int(input())
a = input()
s = a

i = 0
while i<len(s) and s[i] == '.':
  i+=1
j = n-1
while j>=0 and s[j] == '#':
  j-=1

s = s[i:j+1]
r = min(s.count('#'), s.count('.'))

w = s.count('.')
b = 0
c = 0
for i in range(len(s)):
  if s[i] == '#':
    b += 1
  else:
    w -= 1
  r = min(r, w+b)

print(r)