Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

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

if a >= b:
    max = a
    min = b
else:
    min = a
    max = b
for num in range(min,max+1):
    if abs(a - num) == abs(b-num):
        print(num)
        exit()
print("IMPOSSIBLE")


### FIXED CODE ###

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

if a >= b:
    max = a
    min = b
else:
    min = a
    max = b

ans = int((max-min) / 2)
if abs(max - ans) == abs(min + ans):
    print(abs(max-ans))
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ctr= [0 for _ in range(N)]

A.sort()
B.sort()
C.sort()

# A固定
cur = 0

for i in range(N):
	for j in range(cur, N):
		if B[i] < C[j]:
			ctr[i] += N - j
			cur = j
			break
			
cur = 0
ans = 0
for i in reversed(range(1, N)):
	ctr[i - 1] += ctr[i]
for i in range(N):
	for j in range(cur, N):
		if A[i] < B[j]:
			ans += ctr[j]
			break
			
print(ans)

### FIXED CODE ###

import bisect

N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
ctr= [0 for _ in range(N)]

A.sort()
B.sort()
C.sort()

ans = 0

for i in range(N):
	insert_index_A = bisect.bisect_left(A, B[i])
	insert_index_C = N - bisect.bisect_right(C, B[i])
	ans += insert_index_A * insert_index_C
	
print(ans)
### BUGGY CODE ###

N = int(input())

t = 1001

for i in range(1, N+1):
    cnt = 0
    for x in range(1, t):
        if N < (x**2 + x) : break 
        for y in range(1, t):
            if N < (x**2 + y**2 + x*y + y + x ) : break
            for z in range(1, t):
                if N < (x**2 + y**2 + z**2 + x*y + y*z + z*x ) : break    
                
                if i ==  (x**2 + y**2 + z**2 + x*y + y*z + z*x ):
                    cnt = cnt+1
    print(cnt)

### FIXED CODE ###

N = int(input())

ans=[0]*(N+1)
t=int(N**0.5+1)
for x in range(1, t):
    for y in range(1, t):
        for z in range(1, t):
            v=x*x+y*y+z*z+x*y+y*z+z*x
            if v<=N: ans[v]+=1
for i in range(1,N+1):
    print(ans[i])
### BUGGY CODE ###

a=input()
n=len(a)
ansset=[a]
from itertools import combinations
for i,j in combinations(range(n),2):
    tmp=a[:i]+a[i:j+1][::-1]+a[j+1:]
    if tmp not in ansset:
        ansset.append(tmp)
print(len(set(ansset)))

### FIXED CODE ###

a=input()
n=len(a)
dupli=0
from collections import Counter
c=Counter(a)
for word,num in c.most_common():
    dupli+=num*(num-1)//2
print(n*(n-1)//2-dupli+1)
### BUGGY CODE ###

n = int(input())
s = input()
ans = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            if j-i == k-j:
                continue
            elif len(set([s[i],s[j],s[k]])) >= 3:
                ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
r = s.count("R")
g = s.count("G")
b = s.count("B")
c = 0
for i in range(n):
    for j in range(1,int((n-i-1)/2)+1):
        if len(set([s[i],s[i+j],s[i+j+j]])) == 3:
            c += 1
print((r*g*b) - c)
### BUGGY CODE ###

from math import log2, ceil
from bisect import bisect_left, bisect_right

N = int(input())
a = list(map(int, input().split()))
a = sorted(a)
b = [True for _ in range(N)]

ans = 0
for i in list(range(N))[::-1]:
    if not b[i]: continue
    t = a[i]
    flg = False
    for j in list(range(ceil(log2(t)), int(log2(t * 2)) + 1))[::-1]:
        pair = 2 ** j - t
        left = bisect_left(a, pair)
        right = bisect_right(a, pair)
        # print(t, pair, a, b, left, right)
        if left == right:
            if left < N and left != i:
                if a[left] == pair and b[left]:
                    b[left] = False
                    b[i] = False
                    ans += 1
                    flg = True
                    break
        else:
            k = min(right - 1, N - 1)
            while k >= max(0, left):
                if a[k] != pair: break
                if b[k]:
                    if k != i:
                        b[k] = False
                        b[i] = False
                        ans += 1
                        flg = True
                        break
                k -= 1
            if flg:
                break

print(ans)


### FIXED CODE ###

# https://beta.atcoder.jp/contests/agc029/submissions/3804087
from collections import Counter

N = int(input())
a = list(map(int, input().split()))
a = sorted(a, reverse=True)
b = Counter(a)

ans = 0
for t in a:
    s = (1 << t.bit_length()) - t
    if t == s:
        ans += b[t] // 2
        b[t] %= 2
    else:
        u = min(b[s], b[t])
        ans += u
        b[s] -= u
        b[t] -= u

print(ans)
### BUGGY CODE ###

from collections import deque
N,K=map(int,input().split())
P=list(map(int,input().split()))

cnt=0
ans=0
q=deque([])
for i in range(N):
    q.append(P[i]*(P[i]+1)//2/P[i])
    if len(q)==K:
        if sum(q)>ans:
            ans=sum(q)
        q.popleft()
print(ans)

### FIXED CODE ###

from collections import deque
N,K=map(int,input().split())
P=list(map(int,input().split()))

cnt=0
ans=0
buf=0
buf_2=0
q=deque([])
cnt=0
for i in range(N):
    cnt+=1
    buf=P[i]*(P[i]+1)//2/P[i]
    q.append(buf)
    buf_2+=buf
    if cnt>=K:
        if ans<buf_2:
            ans=buf_2
        buf_2-=q.popleft()
    # if len(q)==K:
    #     if sum(q)>ans:
    #         ans=sum(q)
    #     q.popleft()
print(ans)
### BUGGY CODE ###

import sys
from itertools import islice

sys.setrecursionlimit(5001)
MOD = 10 ** 9 + 7

n = int(input())
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    links[x].add(y)
    links[y].add(x)

double_factorial_odd = [0] * (n // 2)
prev = 1
for i in range(n // 2):
    prev = double_factorial_odd[i] = (2 * i + 1) * prev % MOD


def dfs(v, p):
    ret = [0, 1]
    for u in links[v]:
        if u == p:
            continue
        res = dfs(u, v)
        lt, ls = len(ret), len(res)
        mrg = [0] * (lt + ls - 1)
        for i, c in islice(enumerate(ret), 1 - lt % 2, None, 2):
            for j, d in islice(enumerate(res), 1 - ls % 2, None, 2):
                mrg[i + j] = (mrg[i + j] + c * d) % MOD
        ret = mrg

    if len(ret) % 2 == 1:
        ret[0] = -sum(pattern * df % MOD for pattern, df in zip(ret[2::2], double_factorial_odd)) % MOD

    return ret


print(MOD - dfs(0, -1)[0])


### FIXED CODE ###

import sys

sys.setrecursionlimit(5001)
MOD = 10 ** 9 + 7

n = int(input())
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    links[x].add(y)
    links[y].add(x)

double_factorial_odd = [0] * (n // 2)
prev = 1
for i in range(n // 2):
    prev = double_factorial_odd[i] = (2 * i + 1) * prev % MOD


def dfs(v, p):
    ret = [0, 1]
    for u in links[v]:
        if u == p:
            continue
        res = dfs(u, v)
        lt, ls = len(ret), len(res)
        mrg = [0] * (lt + ls - 1)
        for i in range(1 - lt % 2, lt, 2):
            c = ret[i]
            for j in range(1 - ls % 2, ls, 2):
                mrg[i + j] = (mrg[i + j] + c * res[j]) % MOD
        ret = mrg

    if len(ret) % 2 == 1:
        ret[0] = -sum(pattern * df % MOD for pattern, df in zip(ret[2::2], double_factorial_odd)) % MOD

    return ret


print(MOD - dfs(0, -1)[0])
### BUGGY CODE ###

from collections import defaultdict
import heapq
from math import sqrt
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def calc(b1, b2):
    x1, y1, r1 = b1
    x2, y2, r2 = b2
    d = sqrt((x1-x2)**2+(y1-y2)**2)
    return max(d-(r1+r2), 0)


sx, sy, gx, gy = map(int, input().split())
N = int(input())
barriers = [[sx, sy, 0]] + [list(map(int, input().split()))
                            for _ in range(N)]+[[gx, gy, 0]]

mat = [[0]*(N+2) for _ in range(N+2)]

for row in range(N+2):
    for col in range(row+1, N+2):
        d = calc(barriers[row], barriers[col])
        mat[row][col] = d
        mat[col][row] = d

# 視点からの距離
dist = [float('inf')]*(N+2)
dist[0] = 0

# 最短経路での一つ前のノード
prev = defaultdict(lambda: None)

Q = []
# Q->[dist from　start,node])
heapq.heappush(Q, (0, 0))

while Q:
    dist_to_node, node = heapq.heappop(Q)
    if dist[node] < dist_to_node:
        continue
    else:
        for v in range(N+2):
            weight = mat[node][v]
            alt = dist_to_node+weight
            if dist[v] > alt:
                dist[v] = alt
                prev[v] = node
                heapq.heappush(Q, (alt, v))
print(dist[-1])


### FIXED CODE ###

from collections import defaultdict
import heapq
from math import sqrt
# -*- coding: utf-8 -*-
# python template for atcoder1
import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline


def calc(b1, b2):
    x1, y1, r1 = b1
    x2, y2, r2 = b2
    d = sqrt((x1-x2)**2+(y1-y2)**2)
    return max(d-(r1+r2), 0)


sx, sy, gx, gy = map(int, input().split())
N = int(input())
barriers = [[sx, sy, 0]] + [list(map(int, input().split()))
                            for _ in range(N)]+[[gx, gy, 0]]

mat = [[0]*(N+2) for _ in range(N+2)]

for row in range(N+2):
    for col in range(row+1, N+2):
        d = calc(barriers[row], barriers[col])
        mat[row][col] = d
        mat[col][row] = d

# 視点からの距離
dist = [float('inf')]*(N+2)
dist[0] = 0

# 最短経路での一つ前のノード
prev = defaultdict(lambda: None)

Q = []
# Q->[dist from　start,node])
heapq.heappush(Q, (0, 0))

while Q:
    dist_to_node, node = heapq.heappop(Q)
    if dist[node] < dist_to_node:
        continue
    else:
        for v in range(N+2):
            weight = mat[node][v]
            alt = dist_to_node+weight
            if dist[v] > alt:
                dist[v] = alt
                prev[v] = node
                heapq.heappush(Q, (alt, v))
print(dist[-1])
### BUGGY CODE ###

import queue
def main():
    h,w=map(int,input().split())
    maze=[]
    r_append=maze.append
    for i in range(h):
        #r_append=maze.append
        row=input()
        r_append(row)
    #print(maze)
    #root=[[-1 for i in range(h*w)] for i in range(h*w)]
    root=[0]*(h*w)
    for i in range(h*w):
        root[i]=[-1]*(h*w)
    ina=[i for i in range(h*w)]
    for i in range(h):
        for j in range(w):
        # print(maze[i][j])
            now=w*i+j
            hidari=w*i+j-1
            migi=w*i+j+1
            ue=w*(i-1)+j
            sita=w*(i+1)+j
            if maze[i][j]==".":
                if j>0:
                    if maze[i][j-1]!="#":
                        root[now][hidari]=0
                if i+1<h:
                    if maze[i+1][j]!="#":
                        root[now][sita]=0
                if j+1<w:
                    if maze[i][j+1]!="#":
                        root[now][migi]=0
                if 0<i:
                    if maze[i-1][j]!="#":
                        root[now][ue]=0
            else:
                ina[now]=-1
                if j>0:
                    root[now][hidari]=-1
                if i+1<h:
                    root[now][sita]=-1
                if j+1<w:
                    root[now][migi]=-1
                if 0<i:
                    root[now][ue]=-1
    #print(root)
    max=0
    hw=h*w
    for start in range(hw):
        if ina[start]==-1:
           # print(start,"is unreachable")
            continue
        dist=[0]*(hw)
        now=start
        dist[start]=0
        visted=[0]*(hw)
        toVis=queue.Queue()
        visted[now]=1
        for i in range(hw):
            if root[now][i]!=-1:
                toVis.put(i)
                dist[i]=dist[now]+1
        while toVis.empty()!=True:
            now=toVis.get()
            visted[now]=1
            le=dist[now]
            for i in range(hw):
                if root[now][i]!=-1 and visted[i]!=1:
                    toVis.put(i)
                    dist[i]=le+1
        farest=dist[now]
        if max<farest:
            max=farest
    print(max)
            
if __name__=="__main__":
    main()

### FIXED CODE ###

h,w=map(int,input().split())
n=h*w
inf=10**6
field=[]
for i in range(h):
    field.append(input())
dist=[[inf]*n for i in range(n)]
for i in range(h):
    for j in range(w):
        if field[i][j]=="#":continue
        if j+1<w and field[i][j+1]!="#":
            dist[i*w+j][i*w+j+1]=1
            dist[i*w+j+1][i*w+j]=1
        if i+1<h and field[i+1][j]!="#":
            dist[i*w+j][(i+1)*w+j]=1
            dist[(i+1)*w+j][i*w+j]=1
for i in range(n):
    for j in range(n):
        for k in range(n):
            dist[j][k]=min(dist[j][k],dist[j][i]+dist[i][k])
ans=0
for i in range(n):
    for j in range(n):
        if i==j:
            continue
        if dist[i][j]==inf:
            continue
        ans=max(ans,dist[i][j])
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
C = [input() for i in range(H)]

import sys
sys.setrecursionlimit(500000)

def search(x, y, z):
    if y >= H or x >= W or x < 0 or y <  0:
        return
    elif C[y][x] == z:
        return
    elif itta[y][x] != 0:
        return
    else:
        itta[y][x] = 0.00000001 # appendすると遅くなる
        prez = C[y][x]
        if C[y][x] == '.':
            itta[y][x] = 1
    
    search(x+1, y, prez)
    search(x-1, y, prez)
    search(x, y+1, prez)
    search(x, y-1, prez) 

ans = 0
# #を探しに行く
for y in range(H):
    for x in range(W):
        if C[y][x] != '#':
            pass
        else:
            itta = [[0] * W for i in range(H)]
            search(x, y, '.')
            ans += int(sum(map(sum, itta))) 
            # 入れ子リスト（２次元配列）の合計値
            # https://maku77.github.io/python/numstr/sum.html

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
C = [input() for i in range(H)]

import sys
sys.setrecursionlimit(500000)

itta = [[0] * W for i in range(H)]

def search(x, y, z):
    if y >= H or x >= W or x < 0 or y <  0:
        return
    elif C[y][x] == z:
        return
    elif itta[y][x] == 1:
        return
    elif C[y][x] == z:
        return
    else:
        itta[y][x] = 1
        
        if C[y][x] == '.':
            bw_count[0] += 1
        else:
            bw_count[1] += 1
        
        prez = C[y][x]
        
    search(x+1, y, prez)
    search(x-1, y, prez)
    search(x, y+1, prez)
    search(x, y-1, prez) 

ans = 0

for y in range(H):
    for x in range(W):
        if itta[y][x] ==1:
            pass
        else:
            bw_count = [0, 0]
            search(x, y, '-')
            
            ans += bw_count[0] * bw_count[1]  

print(ans)
### BUGGY CODE ###

n = int(input())
li = list(map(int, input().split()))
res = 0
sum2 = 0
m = 10**9 + 7
for i in range(0, len(li)-1):
    sum2 += li[i]
    res = (res + li[i]*(sum(li)-sum2))%m
print(res)

### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
res = 0
sum1 = sum(li)
sum2 = 0
m = 10**9 + 7
for i in range(0, len(li)-1):
    sum2 += li[i]
    res = (res + li[i]*(sum1-sum2))%m
print(res)
### BUGGY CODE ###

n,m = map(int,input().split())
a =  [int(input()) for i in range(m)]

dp =[0]*(n+1)


for i in range(n+1):
    if i<=1:
        dp[i]=1
    else:
        if dp[i-1]==dp[i-2]==0:break
        dp[i] = (dp[i-2]+dp[i-1])
    if i in a:
        dp[i] = 0

print(dp[-1]%1000000007)

### FIXED CODE ###

n,m = map(int,input().split())
a =  [int(input()) for i in range(m)]

dp =[0]*(n+1)

for i in a:
    dp[i] = -1

for i in [0,1]:
    if dp[i] == -1:
        dp[i] =0
    else:
        dp[i] =1

for i in range(2,n+1):
    if dp[i] == -1:
        dp[i] = 0
    else:
        if dp[i-1]==dp[i-2]==0:break
        dp[i] = (dp[i-2]+dp[i-1])

print(dp[-1]%1000000007)
### BUGGY CODE ###

n,q = map(int,input().split())
s = str(input())
lr_lst = [list(map(int,input().split())) for i in range(q)]

for i in range(q):
    start = lr_lst[i][0] - 1
    end = lr_lst[i][1]

    str = s[start:end]
    answer = str.count('AC')
    print(answer)

### FIXED CODE ###

n,q = map(int,input().split())
s = str(input())
lr_lst = [list(map(int,input().split())) for i in range(q)]

ac_lst = [0] * (n+1)

for i in range(n):
    if s[i:i+2]=='AC':
        ac_lst[i+1] = ac_lst[i] + 1
    else:
        ac_lst[i+1] = ac_lst[i]

for i in range(q):
    start = lr_lst[i][0]
    end = lr_lst[i][1]

    print(ac_lst[end-1] - ac_lst[start-1])
### BUGGY CODE ###

from scipy.sparse import lil_matrix
import sys
input = sys.stdin.readline

N = int(input())
edge = lil_matrix((N+1,N+1))
 
for _ in range(N-1):
  a,b,c = map(int,input().split())
  edge[a,b] = c

edge = edge.tocsc()

Q,K = map(int,input().split())
 
from scipy.sparse.csgraph import dijkstra
dist = dijkstra(edge,directed = False, indices = K).astype(int)
 
for _ in range(Q):
  x,y = map(int,input().split())
  print(dist[x] + dist[y])

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)

N = int(input())
edge = [[] for _ in range(N+1)]
 
for _ in range(N-1):
  a,b,c = map(int,input().split())
  edge[a].append((b,c))
  edge[b].append((a,c))

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

dist = [None]*(N+1)

def set_dist(x,d):
  dist[x] = d
  for y,dd in edge[x]:
    if dist[y] is not None:
      continue
    set_dist(y,d+dd)

set_dist(K,0)

for _ in range(Q):
  x,y = map(int,input().split())
  print(dist[x] + dist[y])
### BUGGY CODE ###

import sys
import numpy as np
from numba import njit

input = sys.stdin.buffer.readline

N = int(input())
vws = [tuple(map(int, input().split())) for _ in range(N)]

n = min(2**10, N)
vws_arr = np.array(vws, np.int32)

@njit(cache = True)
def pre(n, vws):
    dp = np.zeros((n, 10**5+1), np.int32)
    dp[0, vws[0][1]:] = vws[0][0]
    for i in range(1, n):
        v, w = vws[i]
        dp[i] = dp[(i-1)//2]
        dp[i, w:] = np.maximum(dp[(i-1)//2, :-w]+v, dp[i, w:])
    return dp

dp = pre(n, vws)
  
@njit("i4(i4[::1], i4[::1], i4, i4[::1])", cache = True)
def func(vs, ws, L, dp_):
    values = np.zeros(1 << len(vs), np.int32)
    weights = np.zeros(1 << len(vs), np.int32)
    for i in range(len(vs)):
        for bits in range(1 << len(vs)):
            if bits & (1 << i):
                values[bits] += vs[i]
                weights[bits] += ws[i]
    mask = (weights <= L)     
    return np.amax(dp_[L - weights[mask]] + values[mask])

Q = int(input())
for _ in range(Q):
    V, L = map(int, input().split())
    V -= 1
    if V < n:
        print(dp[V, L])
    else:
        Vs = []
        while V >= n:
            Vs.append(V)
            V = (V-1) // 2
        vs = vws_arr[Vs, 0]
        ws = vws_arr[Vs, 1]
        print(func(vs, ws, L, dp[V]))

### FIXED CODE ###

import sys
import numpy as np
from numba import njit

input = sys.stdin.buffer.readline

N = int(input())
vws = [tuple(map(int, input().split())) for _ in range(N)]

n = min(2**11, N)
vws_arr = np.array(vws, np.int32)

dp = np.zeros((n, 10**5+1), np.int32)
for i in range(n):
    v, w = vws[i]
    dp[i] = dp[(i-1)//2]
    dp[i, w:] = np.maximum(dp[(i-1)//2, :-w]+v, dp[i, w:])


@njit("i4(i4[::1], i4[::1], i4, i4[::1])", cache = True)
def func(vs, ws, L, dp_):
    values = np.zeros(1 << len(vs), np.int32)
    weights = np.zeros(1 << len(vs), np.int32)
    for i in range(len(vs)):
        for bits in range(1 << len(vs)):
            if bits & (1 << i):
                values[bits] += vs[i]
                weights[bits] += ws[i]
    ret = 0
    for v, w in zip(values, weights):
        if w <= L:
            ret = max(dp_[L - w] + v, ret)
    return ret

Q = int(input())
for _ in range(Q):
    V, L = map(int, input().split())
    V -= 1
    if V < n:
        print(dp[V, L])
    else:
        Vs = []
        while V >= n:
            Vs.append(V)
            V = (V-1) // 2
        vs = vws_arr[Vs, 0]
        ws = vws_arr[Vs, 1]
        print(func(vs, ws, L, dp[V]))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
dic = {}
ans = {}

for num in A:
    if num in dic:
        dic[num] += 1
    else:
        dic[num] = 1

for num in A:
    if num in ans:
        print(ans[num])
    else:
        dic[num] -= 1
        total = 0
        for value in dic.values():
            total += value * (value-1) / 2
        ans[num] = int(total)
        print(int(total))
        dic[num] += 1


### FIXED CODE ###

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

for num in A:
    if num in dic:
        dic[num] += 1
    else:
        dic[num] = 1

total = 0
for value in dic.values():
    total += value * (value-1) / 2   # 使えないボールがない場合のtotal

for num in A:
    print(int(total - dic[num] + 1))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
S=0
for i in range(N):
    for j in range(i):
        S+=(A[i]*A[j])%mod
print(S%mod)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
mod=10**9+7
S=0
M=0
for i in A:
    S+=i
for i in A:
    S-=i
    M+=(S*i)%mod
print(M%mod)
### BUGGY CODE ###

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

H=[]
for i in range(N):
	h=input()
	H.append(h)

H.sort()

ans=float("inf")
for i in range(N-K+1):
	ans=min( ans, H[i+K-1]-H[i] )

print ans

### FIXED CODE ###

import sys
N,K=map(int, raw_input().split())

H=[]
for i in range(N):
	h=int( sys.stdin.readline() ) 
	H.append(h)

H.sort()

ans=float("inf")
for i in range(N-K+1):
	ans=min( ans, H[i+K-1]-H[i] )

print ans
### BUGGY CODE ###

n = int(raw_input())
A = map(int, raw_input().split())
q = int(raw_input())
m = map(int, raw_input().split())

A = sorted(A)

def sum_A(A, n, pos, sum, m, res):
    if res[0] == "yes":
        return 0
    if sum + A[pos] == m:
        res[0] = "yes"
        return 0
    if pos + 1 > n - 1:
        return 0
    sum_A(A, n, pos + 1, sum + A[pos], m, res)
    sum_A(A, n, pos + 1, sum, m, res)

for i, m_i in enumerate(m):
    sum = 0
    res = ["no"]
    sum_A(A, n, 0, sum, m_i, res)
    print res[0]

### FIXED CODE ###

def sequence(A, n):
    dic = {}
    
    def solve(i, m):
        if (i, m) in dic:
            return dic[(i, m)]
        if m == 0:
            dic[(i, m)] = True
        elif i >= n:
            dic[(i, m)] = False
        elif solve(i+1, m):
            dic[(i, m)] = True
        elif solve(i+1, m-A[i]):
            dic[(i, m)] = True
        else:
            dic[(i, m)] = False
        return dic[(i, m)]
    
    return solve

if __name__ == '__main__':
    n = int(raw_input())
    A = map(int, raw_input().split())
    q = int(raw_input())
    m = map(int, raw_input().split())

    solve = sequence(A, n)
    for m_i in m:
        print "yes" if solve(0, m_i) else "no"
### BUGGY CODE ###

n,s=map(int,input().split())
a=list(map(int,input().split()))
mod=998244353

dp=[[0]*s for _ in range(n)]    

for i in range(n):
    if a[i]<=s:
        dp[i][a[i]-1]=2**i%mod
    for j in range(s):
        if i>0:
            dp[i][j]+=dp[i-1][j]*2%mod
            if j+a[i]<s:
                dp[i][j+a[i]]+=dp[i-1][j]%mod
            
print(dp[n-1][s-1]%mod)

### FIXED CODE ###

n,s=map(int,input().split())
a=list(map(int,input().split()))
mod=998244353

dp=[[0]*s for _ in range(n)]    
tmp=1
for i in range(n):
    if a[i]<=s:
        dp[i][a[i]-1]=tmp
    for j in range(s):
        if i>0:
            dp[i][j]+=dp[i-1][j]*2
            dp[i][j]%=mod
            if j+a[i]<s:
                dp[i][j+a[i]]+=dp[i-1][j]
                dp[i][j+a[i]]%=mod
    tmp*=2
    tmp%=mod
            
print(dp[n-1][s-1])
### BUGGY CODE ###

from bisect import bisect_left
from scipy.misc import comb
n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = [0, 0]
c = 0
for i in range(1, n):
    j = min(bisect_left(a, a[i]//2, 0, i), i-1)
    if a[i] <= a[j]:
        continue
    tmp = comb(a[i], a[j])
    if tmp > c:
        ans[0], ans[1] = a[i], a[j]
        c = tmp
print(*ans)


### FIXED CODE ###

n = int(input())
a = [int(i) for i in input().split()]
a.sort()
ans = [a[-1], 0]
m = float('inf')
for i in range(n-1):
    tmp = abs(ans[0]/2-a[i])
    if tmp < m:
        m = tmp
        ans[1] = a[i]

print(*ans)