Harryxun/stf_run huggingface dataset:
T = input()

tmp = []
for i in T:
    tmp.append(i)

if tmp[0] == '?':
    if tmp[1] == 'P':
        tmp[0] = 'D'
    elif tmp[1] == 'D':
        tmp[0] = 'P'
    else:
        tmp[0] = 'P'
for i in range(1,len(tmp)-1):
    if tmp[i] == '?':
        if tmp[i-1] == 'D' and tmp[i+1] == 'D':
            tmp[i] = 'P'
        elif tmp[i-1] == 'P' and tmp[i+1] == 'P':
            tmp[i] = 'D'
        elif tmp[i-1] == 'D' and tmp[i+1] == 'P':
            tmp[i] = 'D'
        elif tmp[i-1] == 'P' and tmp[i+1] == 'D':
            tmp[i] = 'D'
        elif tmp[i-1] == 'P' and tmp[i+1] == '?':
            tmp[i] = 'D'
        elif tmp[i-1] == 'D' and tmp[i+1] == '?':
            tmp[i] = 'P'
if tmp[-1] == '?':
    if tmp[-2] == 'P':
        tmp[-1] = 'D'
    elif tmp[-2] == 'D':
        tmp[-1] = 'P'
        
print(''.join(tmp))

### FIXED CODE ###

T = input()

tmp = []
for i in T:
    tmp.append(i)
    
import sys
    
if len(T) == 1:
    if T[0] == '?':
        print('D')
    else:
        print(T)
    sys.exit()
    
for i in range(len(tmp)):
    if tmp[i] == '?':
        tmp[i] = 'D'
        
print(''.join(tmp))
MOD = 1000000007

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

vec = [0, 0, 0]
num = 1

for a in A:
    idx = [i for i, x in enumerate(vec) if x == a]
    num = (num * len(idx)) % MOD
    vec[idx[0]] += 1

print(num)


### FIXED CODE ###

MOD = 1000000007

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

vec = [0, 0, 0]
num = 1

for a in A:
    idx = [i for i, x in enumerate(vec) if x == a]
    if len(idx) == 0:
        print(0)
        exit()
    num = (num * len(idx)) % MOD
    vec[idx[0]] += 1

print(num)
import numpy as np
import sys
sys.setrecursionlimit(10 ** 7)

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

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


# nの約数列挙
def divisor(n):
    ans = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans.append(i)
            if i**2 == n:
                continue
            ans.append(n // i)
    return ans  # sortされていない


MOD = 10 ** 9 + 7

ans = 0
num = 0
CNT = [0] * (K+1)
for i in range(K, 1, -1):
    n = K // i
    c = pow(n, N, MOD)

    c -= CNT[i]

    num += c

    f = divisor(i)
    for n in f:
        CNT[n] += c

    ans += c * i
    ans %= MOD


al = pow(K, N, MOD)
ans += al - num
ans %= MOD

print(ans)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

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

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


# nの約数列挙
def divisor(n):
    ans = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            ans.append(i)
            if i**2 == n:
                continue
            ans.append(n // i)
    return ans  # sortされていない


MOD = 10 ** 9 + 7

ans = 0
num = 0
CNT = [0] * (K+1)
for i in range(K, 1, -1):
    n = K // i
    c = pow(n, N, MOD)

    c -= CNT[i]

    num += c

    f = divisor(i)
    for n in f:
        CNT[n] += c

    ans += c * i
    ans %= MOD


al = pow(K, N, MOD)
ans += al - num
ans %= MOD

print(ans)
n=int(input(""))
a=[]
ans=[1]
ain=input("").split(" ")
for i in range(n):
    a+=[int(ain[i])]
s=a[1]
for i in range(n-2):
    s^=a[i+2]
ans[0]=s
for i in range(n-1):
    s=s^a[i]
    s^=a[i+1]
    ans+=s
print(" ".join(ans))


    


### FIXED CODE ###

n=int(input(""))
a=[]
ans=[1]
ain=input("").split(" ")
for i in range(n):
    a+=[int(ain[i])]
s=a[1]
for i in range(n-2):
    s^=a[i+2]
ans[0]=s
for i in range(n-1):
    s=s^a[i]
    s^=a[i+1]
    ans+=[s]
b=[]
for i in range(n):
    b+=[str(ans[i])]
print(" ".join(b))
N, K = map(int, input().split())
Dlist = list(map(int, input().split()))
    
alist = list(set([0,1,2,3,4,5,6,7,8,9]) - set(Dlist))
if sum(x==0 for x in alist) == 0:
    b = min(alist)
else:
    b = min(list(set(alist)-set([0])))
strN = str(N)
c = ""
ans = ""
flag = True
for i in range(len(strN)):
    iN = int(strN[i])
    if sum(x>=iN for x in alist) == 0:
        ans = b + str(min(alist))*len(strN)
        flag = False
        break
    elif sum(x==iN for x in alist) == 0:
        ans = c + str(min([a for a in alist if a>iN])) + str(min(alist))*(len(strN)-1-i)
        flag = False
        break
    else:
        c = c + str(iN)

if flag:
    print(N)
else:
    print(int(ans))

### FIXED CODE ###

N, K = map(int, input().split())
Dlist = list(map(int, input().split()))
    
alist = list(set([0,1,2,3,4,5,6,7,8,9]) - set(Dlist))
if sum(x==0 for x in alist) == 0:
    b = min(alist)
else:
    b = min(list(set(alist)-set([0])))
strN = str(N)
c = ""
ans = ""
flag = True
for i in range(len(strN)):
    iN = int(strN[i])
    if sum(x>=iN for x in alist) == 0:
        ans = str(b) + str(min(alist))*len(strN)
        flag = False
        break
    elif sum(x==iN for x in alist) == 0:
        ans = c + str(min([a for a in alist if a>iN])) + str(min(alist))*(len(strN)-1-i)
        flag = False
        break
    else:
        c = c + str(iN)

if flag:
    print(N)
else:
    print(int(ans))
x = input().split()
a = int( x[0])
b = int( x[1])

if a > b:
    print( "a > b")
else a < b:
    print( "a < b")
else:
    print( "a == b")

### FIXED CODE ###

x = input().split()
a = int( x[0])
b = int( x[1])
  
if a > b:
    print( "a > b")
elif a < b:
    print( "a < b")
else:
    print( "a == b")
n = int(input())
s = input()
s2 = "ABC"
print(n.count(s2))

### FIXED CODE ###

n = int(input())
s = input()
print(s.count("ABC"))
def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)
    
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac


X, Y = map(int, input().split())
# 後の、n, mの大小を一定にするため
if X > Y:
    X, Y = Y, X
dist = X + Y
   
if dist % 3 != 0:
    print(0)
else:
    # (+1,+2) の移動の回数を n、(+2,+1) の移動の回数を m とする)
    # total = n + m
    # 以下の式は、2n + m = X, n + 2m = Y の連立方程式を解いた結果
    total = int((X+Y) / 3)
    n = X - total
    
    # n < 0 もしくは m < 0 の場合、たどり着けない
    # Y > X なので、m > n
    # n < 0 → 2X - Y < 0
    if Y > 2*X:
        print(0)
    else:
        MOD = 10**9 + 7

        fac, ifac = make_tables(MOD, total)
        ans = cmb(total, n, mod, fac, ifac)
        print(ans)

### FIXED CODE ###

def cmb(n, k, mod, fac, ifac):
    """
    nCkを計算する
    """
    k = min(k, n-k)
    return fac[n] * ifac[k] * ifac[n-k] % mod


def make_tables(mod, n):
    """
    階乗テーブル、逆元の階乗テーブルを作成する
    """
    fac = [1, 1] # 階乗テーブル・・・(1)
    ifac = [1, 1] #逆元の階乗テーブル・・・(2)
    inverse = [0, 1] #逆元テーブル・・・(3)
    
    for i in range(2, n+1):
        fac.append((fac[-1] * i) % mod)
        inverse.append((-inverse[mod % i] * (mod//i)) % mod)
        ifac.append((ifac[-1] * inverse[-1]) % mod)
    return fac, ifac


X, Y = map(int, input().split())
# 後の、n, mの大小を一定にするため
if X > Y:
    X, Y = Y, X
dist = X + Y
   
if dist % 3 != 0:
    print(0)
else:
    # (+1,+2) の移動の回数を n、(+2,+1) の移動の回数を m とする)
    # total = n + m
    # 以下の式は、2n + m = X, n + 2m = Y の連立方程式を解いた結果
    total = int((X+Y) / 3)
    n = X - total
    
    # n < 0 もしくは m < 0 の場合、たどり着けない
    # Y > X なので、m > n
    # n < 0 → 2X - Y < 0
    if Y > 2*X:
        print(0)
    else:
        MOD = 10**9 + 7

        fac, ifac = make_tables(MOD, total)
        ans = cmb(total, n, MOD, fac, ifac)
        print(ans)
S_cards=[]
H_cards=[]
C_cards=[]
D_cards=[]

for i in range(1,14):
    S_cards.append(str(i))
    H_cards.append(str(i))
    C_cards.append(str(i))
    D_cards.append(str(i))

now_cards=int(input())
for i in range(0,now_cards):
    kind_num=[]
    kind_num=input().split()
    if kind_num[0]=='S':
        S_cards.remove(kind_num[1])
    elif kind_num[0]=='H':
        H_cards.remove(kind_num[1])
    elif kind_num[0]=='C':
        C_cards.remove(kind_num[1])
    elif kind_num[0]=='D':
        D_cards.remove(kind_num[1])
print()
for i in range(0,len(S_cards)):
    print('S',int(S_cards[i]))
for i in range(0,len(H_cards)):
    print('H',int(H_cards[i]))
for i in range(0,len(C_cards)):
    print('C',int(C_cards[i])
for i in range(0,len(D_cards)):
    print('D',int(D_cards[i]))

### FIXED CODE ###

S=[i for i in range(1,14)]
H=[i for i in range(1,14)]
C=[i for i in range(1,14)]
D=[i for i in range(1,14)]
cards=int(input())
for i in range(0,cards):
    mark,rank=input().split()
    rank=int(rank)
    if mark=="S":
        S.remove(rank)
    elif mark=="H":
        H.remove(rank)
    elif mark=="C":
        C.remove(rank)
    elif mark=="D":
        D.remove(rank)
for i in S:
    print("S",i)
for i in H:
    print("H",i)
for i in C:
    print("C",i)
for i in D:
    print("D",i)
N, M = map(int, input().split())

if N > M:
	N,M = M,N

if N == 1:
	if M == 1:
		print(1)
	else:
		print(M-2)
else:
	print(M-2)*(N-2)


### FIXED CODE ###

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

if N > M:
	N,M = M,N

if N == 1:
	if M == 1:
		print(1)
	else:
		print(M-2)
else:
	print((M-2)*(N-2))
temp = input().split()
n,total = int(temp[0]), int(temp[1])

for a in range(n):
    for b in range(n):
        for c in range(n):
            if a*10000 + b*5000 + c*1000 == total:
                print(f"{a} {b} {c}")
                break
        else:
            continue
        break
    else:
        continue
    break

### FIXED CODE ###

temp = input().split()
n,total = int(temp[0]), int(temp[1])

find = False
for a in range(n+1):
    for b in range(n+1):
        c = (-a) + (-b) + n
        if c >= 0 and a*10000 + b*5000 + c*1000 == total:
            print('{} {} {}'.format(a,b,c))
            find = True
            break
    else:
        continue
    break

if not find:
    print('{} {} {}'.format(-1,-1,-1))
H, W = map(int, input())

print('#' * (W + 2))
for i in range(H):
    print('#%s#' % (input()))
print('#' * (W + 2))

### FIXED CODE ###

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

print('#' * (W + 2))
for i in range(H):
    print('#%s#' % (input()))
print('#' * (W + 2))
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

from heapq import heapify, heappop, heappush, heappushpop,\
                  _heapify_max, _siftdown_max, _siftup_max

def _heappush_max(heap, item):
    heap.append(item)
    _siftdown_max(heap, 0, len(heap)-1)

def _heappop_max(heap):
    lastelt = heap.pop()
    if heap:
        returnitem = heap[0]
        heap[0] = lastelt
        _siftup_max(heap, 0)
        return returnitem
    return lastelt

N = I()
S = III()

S.sort()
A = [[S.pop(),N]]
_heapify_max(A)
while S:
    temp = S.pop()
    a = _heappop_max(A)
    if a[0]<=temp:
        print('No')
        exit()
    else:
        if a[1]>=2:
            _heappush_max(A,[a[0],a[1]-1])
            _heappush_max(A,[temp,a[1]-1])
    
print('Yes')

### FIXED CODE ###

import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

import heapq
class Reverse:
    def __init__(self, val):
        self.val = val
        
    def __lt__(self, other):
        return self.val > other.val
        
    def __repr__(self):
        return repr(self.val)
    
class Heapq:
    def __init__(self, arr, desc = False):
        if desc:
            for i in range(len(arr)):
                arr[i] = Reverse(arr[i])
        self.desc = desc
        self.hq = arr
        heapq.heapify(self.hq)
 
    def pop(self):
        if self.desc: return heapq.heappop(self.hq).val
        else: return heapq.heappop(self.hq)
 
    def push(self, a):
        if self.desc: heapq.heappush(self.hq, Reverse(a))
        else: heapq.heappush(self.hq, a)
 
    def top(self):
        if self.desc: return self.hq[0].val
        else: return self.hq[0]

N = I()
S = III()

S.sort()
a = [Heapq([],True) for _ in range(N+1)]
count = [0]*(N+1)

s = S.pop()
a[N].push(s)
count[N] = 1

while S:
    flag = False
    temp = S.pop()
    for i in range(1,N+1)[::-1]:
        if count[i]:
            if temp<a[i].top():
                x = a[i].pop()
                count[i] -= 1
                a[i-1].push(x)
                a[i-1].push(temp)
                count[i-1] += 2
                flag = True
                break
    if not flag:
        print('No')
        exit()

print('Yes')
n=int(input()) 
lst=list(map(int,input().split())) 
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])

### FIXED CODE ###

n=int(input()) 
lst=list(map(int,input().split()))
lst.sort()
#print(lst) 
a=[] 

for i in range(n): 
	if i==0: 
		#print(lst[i]) 
		a.append(lst[i]) 
	else: 
		#print(lst[i]) 
		a.append((a[-1]+lst[i])/2)   
print(a[-1])
N,K = map(int,input().split())
A = list(map(int,input().split()))

from collections import deque 
tmp = 1
num = deque()
 
for i in range(N):
    num.append(tmp)
    if tmp == A[tmp-1]:
        judge = tmp
        flag1 = 1
        break
    tmp = A[tmp-1]
    if tmp in num:
        judge = tmp
        flag2 = 1
        break
print(num)

if flag2 == 1:
    print(num[(K-num.index(judge))%(len(num)-num.index(judge)) + num.index(judge)])
elif flag1 == 1:
    if K >= len(num):
        print(judge)
    else:
        print(num[K-1])

### FIXED CODE ###

N,K = map(int,input().split())
A = [0] + list(map(int,input().split()))

from collections import deque 
tmp = 1
num = []
seen = [-1]*(N+1)
 
while seen[tmp] == -1:
    seen[tmp] = tmp
    num.append(tmp)
    tmp = A[tmp]


l = num.index(tmp)
c = len(num) - l

if K < l:
    print(num[K])
else:
    print(num[(K-l)%c+l])
while True:
H,W = map(int,raw_input().split())
if W==0 and H==0 :
    break
print '#' * W + '\n'

print ('#'+ '.'*(W-2)+ '#'+'\n')*(H-2)
print '#'*W + '\n'

### FIXED CODE ###

while 1:
    H, W = map(int,raw_input().split())
    if H + W == 0: break
    print ('#' * W)
    for h in range(H-2):
        print ('#' + '.' * (W - 2) + '#')
    print ('#' * W + '\n')
N=int(input())
ans =1
A = list(map(int,input().split()))
for i in A:
        if i =0:

               print(0)
               exit()
for i in A:
      
       ans *=i
       if ans >10**18:
               print(-1)
               exit()
print(ans)


### FIXED CODE ###

N=int(input())
ans =1
A = list(map(int,input().split()))
for i in A:
        if i == 0:

               print(0)
               exit()
for i in A:
      
       ans *=i
       if ans >10**18:
               print(-1)
               exit()
print(ans)
from string import ascii_lowercase
n = int(input())

@lru_cache
def make(n):
    if n == 1:
        return ['a']
    else:
        lst = []
        for s in make(n-1):
            for c in ascii_lowercase[:len(set(s))+1]:
                lst.append(s + c)
        return lst
for s in make(n):
    print(*s, sep='')

### FIXED CODE ###

from string import ascii_lowercase
from functools import lru_cache
n = int(input())

@lru_cache(maxsize=10)
def make(n):
    if n == 1:
        return ['a']
    else:
        lst = []
        for s in make(n-1):
            for c in ascii_lowercase[:len(set(s))+1]:
                lst.append(s + c)
        return lst
for s in make(n):
    print(*s, sep='')
N = raw_input()
N = int(N)
s = raw_input()
s = s.split(' ')
s = [float(x) for x in s]

n_list = [0 for i in range(3)]
for i in s:
	for t in range(3):
		i = i/2
		if (i - int(i) != 0):
			n_list[t] += 1
			break
		if(t == 2):
			n_list[t] += 1

if(n_list[0] <= n_list[2]):
	print('Yes')
else:
	print('No')

### FIXED CODE ###

s = raw_input()
s = s.split(' ')
s = [int(x) for x in s]
n, m = s

print((n-1)*(m-1))
N = int(input())
A = list(map(int,input().split()))

A.sort()
ans=1
for i in A:
    ans *= i
    if(ans > (10 ** 18)):
        print(-1)
        sys.exit()
print(ans)

### FIXED CODE ###

import sys  # sys.exit()を使いたいので

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

A.sort()
ans=1
for i in A:
    ans *= i
    if ans > (10 ** 18):
        print('-1')
        sys.exit()
print(ans)
import sys
input=sys.stdin.readline

N,M=map(int, input().split())
lis={}
ly=[]
for i in range(M):
    t1,t2 =list(map(int,input().split()))
    lis[t2]=t1
    ly.append(t2)
d={}
for i in sorted(lis):
    d[lis[i]]=d.get(lis[i],0)+1
    ly[ly.index(i)]=[lis[i],d[lis[i]]



for i in ly:print('{:0=6}{:0=6}'.format(i[0],i[1]))

### FIXED CODE ###

def main():
    n, m = map(int, input().split())
    lines = [input() for j in range(m)]
 
    cities = {}
    for i in range(m):
        p, y = map(int, lines[i].split())
        if p in cities:
            cities[p].append((i, y))
        else:
            cities[p] = [(i, y)]
 
    outputs = [None] * m
    for pref, city_list in cities.items():
        city_list.sort(key=lambda x: x[1])
        #print(pref, city_list)
        city_no = 1
        for city in city_list:
            outputs[city[0]] = "{:06d}{:06d}".format(pref, city_no)
            city_no += 1
 
    for output in outputs:
        print(output)
    return
 
 
main()
m = input()

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n <1000:
    print(n-90)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(n-9090)
elif 100000<= n < 1000000:
    print(90909)



### FIXED CODE ###

n =int(input())

if n < 10:
    print(n)
elif 10 <= n < 100:
    print(9)
elif 100 <= n <1000:
    print(n-90)
elif 1000 <= n < 10000:
    print(909)
elif 10000 <= n < 100000:
    print(n-9090)
elif 100000 <= n < 1000000:
    print(90909)
N=input()
N*N*N

### FIXED CODE ###

print(int(input())**3)
from sys import stdin
N = int(stdin.readline().rstrip())
ran = [int(x) for x in stdin.readline().rstrip().split()]
ran.sort(reverse=True)

gen = len(ran) - 2
goukei = ran[0]
if gen % 2 == 0:
  for i in range(int(gen/2)):
    goukei += 2 * ran[i + 1]
else:
  for i in rangen(int((gen-1)/2)):
    goukei += 2 * ran[i + 1]
  goukei += ran[i + 2]

print(goukei)

### FIXED CODE ###

from sys import stdin
N = int(stdin.readline().rstrip())
ran = [int(x) for x in stdin.readline().rstrip().split()]
ran.sort(reverse=True)

gen = len(ran) - 2
goukei = ran[0]
if gen % 2 == 0:
  for i in range(int(gen/2)):
    goukei += 2 * ran[i + 1]
else:
  for i in range(int((gen-1)/2)):
    goukei += 2 * ran[i + 1]
  goukei += ran[i + 2]

print(goukei)
#参考
#https://atcoder.jp/contests/aising2019/submissions/3995168
import bisect
N,Q=map(int,input().split())
A=list(map(int,input().split()))
Asum=[0]*N
Asum2=[0]*N
total=0
X=[]
for i in range(N):
  total+=A[i]
  Asum[i]=total
  if i>1:
    Asum2[i]=A[i]+Asum2[i-2]
  else:
    Asum2[i]=A[i]
    
for i in range(Q):
  X.append((int(input()),i))
X.sort(key=lambda x :x[0])
  

#yで高橋くんと青木くんの取りたいカードが初めて衝突すると考える。
#このようなyは半分より小さい所にはないので初期値を半分のところとする。
#yがNまで来た時は最初から交互に取る
#Xを小さい順から計算することで、yの値が単調増加になる
y=N//2-1
ans=[0]*Q
for x,i in X:
  while x>A[y] and y<=N-1:
    y+=1
  while y<=N-1:
    takahashi=N-y
    aoki=y+1-bisect.bisect_left(A,x-(A[y]-x))
    if takahashi>aoki:
      y+=1
    else:
      break;
  #右端からA[y]までは全て高橋くんが取る
  ans[i]+=Asum[N-1]-Asum[y-1]
  #青木くんはyからN-y個取っているので、その下のところから交互に取る
  if y-(N-y)-1<0:
    continue;
  ans[i]+=Asum2[y-(N-y)-1]

for i in range(Q):
  print(ans[i])

### FIXED CODE ###

#参考
#https://atcoder.jp/contests/aising2019/submissions/3995168

import bisect

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

A=list(map(int,input().split()))
Asum=[0]*N
Asum2=[0]*N
total=0

for i in range(N):
  total+=A[i]
  Asum[i]=total
  if i>1:
    Asum2[i]=A[i]+Asum2[i-2]
  else:
    Asum2[i]=A[i]

X=[] 
for i in range(Q):
  X.append((int(input()),i))
X.sort(key=lambda x :x[0])
  

#yで高橋くんと青木くんの取りたいカードが初めて衝突すると考える。
#このようなyは半分より小さい所にはないので初期値を半分のところとする。
#yがNまで来た時は最初から交互に取る
#Xを小さい順から計算することで、yの値が単調増加になる
y=N//2-1
ans=[0]*Q
for x,i in X:
  while y<=N-1 and x>A[y]:
    y+=1
  while y<=N-1:
    takahashi=N-y
    aoki=y+1-bisect.bisect_left(A,x-(A[y]-x))
    if takahashi>aoki:
      y+=1
    else:
      break
  #右端からA[y]までは全て高橋くんが取る
  ans[i]+=Asum[N-1]-Asum[y-1]
  #青木くんはyからN-y個取っているので、その下のところから交互に取る
  if y-(N-y)-1<0:
    continue
  ans[i]+=Asum2[y-(N-y)-1]

for i in range(Q):
  print(ans[i])
a = [0]*(5)
for l in range(5):
    a[l] = str(input())
ls = [a[0],a[1],a[2],a[3],a[4]]
new = [0]*(5)
s = 0
for i in range(5):
    new[i] = int(a[i][-1])
ans = min([e for e in new if e !=0])
for p in ls:
    if int(p) % 10 ==0:
        s += int(p)
    else:
        s += ((int(p)//10) + 1) *10
print(s-10+ans)
        

### FIXED CODE ###

a = [0]*(5)
for l in range(5):
    a[l] = str(input())
ls = [a[0],a[1],a[2],a[3],a[4]]
new = [0]*(5)
s = 0
for i in range(5):
    new[i] = int(a[i][-1])
for p in ls:
    if int(p) % 10 ==0:
        s += int(p)
    else:
        s += ((int(p)//10) + 1) *10
if sum(new) !=0:
    ans = min([e for e in new if e !=0])
    print(s-10+ans)
else:
    print(s)
a_s = sorted(enumerate(map(int, raw_input().split())), key=lambda t: t[1])
b_s = sorted(enumerate(map(int, raw_input().split())), key=lambda t: t[1])
w = [[0] * B] * A
max_w = 0
for _ in xrange(M):
    x, y, c = map(int, raw_input().split())
    w[x-1][y-1] = c
    max_w = max(max_w, c)

cost = 10 ** 20
for i, a in a_s:
    if a + b_s[0][1] - max_w > cost:
        break
    for j, b in b_s:
        cost = min(cost, a + b - w[i][j])
        if a + b - max_w > cost:
            break

print cost

### FIXED CODE ###

A, B, M = map(int, raw_input().split())
a_s = map(int, raw_input().split())
b_s = map(int, raw_input().split())
w = [[0] * B] * A
cost = 10 ** 30
for _ in xrange(M):
    x, y, c = map(int, raw_input().split())
    cost = min(cost, a_s[x-1] + b_s[y-1] - c)
    w[x-1][y-1] = max(w[x-1][y-1], c)

a_s = sorted(enumerate(a_s), key=lambda t: t[1])
b_s = sorted(enumerate(b_s), key=lambda t: t[1])
for i, a in a_s:
    if a + b_s[0][1] >= cost:
        break
    for j, b in b_s:
        if w[i][j] > 0:
            break
        cost = min(cost, a + b)

print cost
x, y = [int(i) for i in input().split(" ")]
num = []
if x > y:
    z = x % y
    for zzz in range(z + 1):
        if z % zzz == 0 and x % zzz == 0:
            num.append(zzz)
    print(max(num))
elif y > x:
    z = y % x
    for zzz in range(z + 1):
        if z % zzz == 0 and y % zzz == 0:
            num.append(zzz) 
    print(max(num))
else:
    print(x)

### FIXED CODE ###

def gdc(x, y):
    if x % y == 0:
        return y
    else:
        return gdc(y, x%y)


if __name__ == '__main__':
    x, y = [int(i) for i in input().split(" ")]
    print(gdc(x, y))
i = input().split(' ')

W = int(i[0])
H = int(i[1])
x = int(i[2])
y = int(i[3])
r = int(i[4])

if x - r >= 0 and y - r >= 0 and x + r <= W and y + r <= H:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
c = int(nums[2])
if a <= b <= c:
    print(a, b, c)
elif a <= c <= b:
    print(a, c, b)
elif b <= a <= c:
    print(b, a, c)
elif b <= c <= a:
    print(b, c, a)
elif c <= a <= b:
    print(c, a, b)
else:
    print(c, b, a)