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

N, M = map(int, input().split())
Alist=list(map(int, input().split()))
for _ in range(M):
    b,c = map(int, input().split())
    Alist+=[c]*b
Alist.sort()
print(sum(Alist[::-1][:N]))

### FIXED CODE ###

N, M = map(int, input().split())
anlist=[]
for a in map(int, input().split()):
    anlist.append([1,a])
for _ in range(M):
    anlist.append(list(map(int, input().split())))
anlist=sorted(anlist, key=lambda x: x[1], reverse=True)
cnt = 0
ans = 0
for b, c in anlist:
    if cnt + b > N:
        ans += c*(N-cnt)
        break
    else:
        ans +=b*c
        cnt += b
print(ans)
### BUGGY CODE ###

import bisect

n=int(input())
l=[int(x) for x in input().split()]

l.sort()

t=0
for i in range(n):
  for j in range(i+1,n):
    a = max(j+1, bisect.bisect_left(l,l[j]-l[i]))
    b = bisect.bisect_left(l,l[i]+l[j])
    t += b-a if b>a else 0

print(t)


### FIXED CODE ###

import bisect

n=int(input())
l=sorted(map(int,input().split()))

t=0
for i in range(n):
  for j in range(i+1,n):
    a = j+1
    b = bisect.bisect_left(l,l[i]+l[j])
    t += b-a if b>a else 0

print(t)
### BUGGY CODE ###

N, K = map(int, input().split())
      
A =  list(map(int, input().split()))
B = [0] * (N + 1)
 
for i in range(N):
  B[i+1] = A[i]

start = 1
d = []
first = 0
while True:
  a = B[start]
  start = a
  first += 1
  if d.count(a) == 1:
    break
  d.append(a)

'''second = 0
start_ = start
while True:
  start_ = B[start_]
  second += 1
  if start_ == start:
    break'''
second  =  len(d) - d.index(start)
#print(first, second, start, d, len(d) - d.index(start))

if K <= first:
  S = 1
else:
  K -= first
  K %= second
  S = start

for i in range(K):
  S = B[S]
print(S)

### FIXED CODE ###

def main():

  N, K = map(int, input().split())   
  A = [0] + list(map(int, input().split()))
  cur = 1
  visited = [-1] * (N + 1)
  visited[cur] = 0
  for i in range(1, K + 1):
    next_cur = A[cur]
    if next_cur == cur:
      print(next_cur)
      return
    elif visited[next_cur] != -1:
      mod = i - visited[next_cur]
      start = visited[next_cur]
      break
    else:
      visited[next_cur] = visited[cur] + 1
      cur = next_cur
  else:
    print(next_cur)
    return
  K = (K - start) % mod
  print(visited.index(K+start))
  
  
if __name__ == "__main__":
  main()
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys 
import numpy as np
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H, W, K = map(int, readline().split())
S = [readline().decode().rstrip() for _ in range(H)]
INF = 10**30
data = [[0]*W for _ in range(H)]
for i in range(H):
    cnt = 0 
    for j in range(W):
        if S[i][j] == '1':
            data[i][j] += 1
data = np.array(data)

ans_cnt = INF   
for bit_H in range(1 << (H-1)):
    cnt = 0
    ans = []
    new_data = []
    for i in range(H-1):
        if (bit_H >> i) & 1:
            ans.append(i)
    ans.append(H-1)
    tmp = [0]*W
    for i in range(H):
        tmp += data[i]
        if i in ans:
            new_data.append(tmp)
            tmp = [0]*W
    group = len(new_data)
    cnt += group-1
    white = [0] * group
    flag = True
    for i in range(W):
        diff = [0] * group
        for j in range(group):
            diff[j] += new_data[j][i]
            white[j] += new_data[j][i]
        max_diff = max(diff)
        if max_diff > K:
            flag = False
            break
        max_white = max(white)
        if max_white > K:
            cnt +=1
            white = diff[:]
    if flag:
        ans_cnt = min(ans_cnt,cnt)
print(ans_cnt)

### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys 
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
H, W, K = map(int, readline().split())
S = [readline().decode().rstrip() for _ in range(H)]
INF = 10**30
data = [[0]*W for _ in range(H)]
for i in range(H):
    cnt = 0 
    for j in range(W):
        if S[i][j] == '1':
            data[i][j] += 1

ans_cnt = INF   
for bit_H in range(1 << (H-1)):
    cnt = 0
    ans = []
    new_data = []
    for i in range(H-1):
        if (bit_H >> i) & 1:
            ans.append(i)
    ans.append(H-1)
    tmp = [0]*W
    for i in range(H):
        for j in range(W):
            tmp[j] += data[i][j]
        if i in ans:
            new_data.append(tmp)
            tmp = [0]*W
    group = len(new_data)
    cnt += group-1
    white = [0] * group
    flag = True
    for i in range(W):
        diff = [0] * group
        for j in range(group):
            diff[j] += new_data[j][i]
            white[j] += new_data[j][i]
        max_diff = max(diff)
        if max_diff > K:
            flag = False
            break
        max_white = max(white)
        if max_white > K:
            cnt +=1
            white = diff[:]
    if flag:
        ans_cnt = min(ans_cnt,cnt)
print(ans_cnt)
### BUGGY CODE ###

import sys

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))
    A = sorted(A, key=lambda x: -x)

    B = []
    C = []
    for a in A:
        if a in B:
            C.append(a)
            B.remove(a)
            if len(C) >= 2:
                break
        else:
            B.append(a)

    if len(C) < 2:
        return 0
    else:
        return C[0] * C[1]


if __name__ == '__main__':
    print(main())


### FIXED CODE ###

import sys
from collections import defaultdict

def main():
    input = sys.stdin.readline
    N = int(input())
    A = list(map(int, input().split()))

    d = defaultdict(lambda: 0)
    B = []
    for a in A:
        d[a] += 1

        if d[a] % 2 == 0:
            B.append(a)


    B = sorted(B, key=lambda x: -x)
    if len(B) < 2:
        return 0
    else:
        return B[0] * B[1]


if __name__ == '__main__':
    print(main())
### BUGGY CODE ###

# D - Ki

import queue

N, Q = map(int, input().split())
children = [[] for _ in range(N)]
points = [0 for _ in range(N)]
for _ in range(N - 1):
    a, b = map(int, input().split())
    children[a - 1].append(b - 1)
    children[b - 1].append(a - 1)

for _ in range(Q):
    p, x = map(int, input().split())
    points[p - 1] += x

q = queue.Queue()
q.put(0)
visited = [False] * N
while not q.empty():
    key = q.get()
    visited[key] = True
    for child in children[key]:
        if visited[child] == False:
            points[child] += points[key]
            q.put(child)

print(*points)


### FIXED CODE ###

# D - Ki

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

children = [[] for _ in range(N)]
points = [0] * N

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

for _ in range(Q):
    p, x = map(int, input().split())
    points[p - 1] += x

stack = []
stack.append(0)
visited = [False] * N
while stack:
    key = stack.pop()
    for child in children[key]:
        if visited[child] == True:
            continue
        points[child] += points[key]
        visited[key] = True
        stack.append(child)

print(*points)
### BUGGY CODE ###

n,c = map(int,input().split())
L = [[] for i in range(c)]
for i in range(n):
    s,t,k = map(int,input().split())
    L[k-1].append([s,t])
for i in range(c):
    L[i].sort()
for i in range(c):
    d = [0]*(10**5+1)
    T = []
    for j in range(len(L[i])):
        d[L[i][j][0]] += 1
        d[L[i][j][1]] -= 1
    for j in range(10**5):
        d[j+1] += d[j]
    cur = 0
    start = 0
    end = 0
    for j in range(10**5+1):
        if d[j] == 1 and cur == 0:
            start = j
            cur = 1
        elif d[j] == 0 and cur == 1:
            end = j
            cur = 0
            T.append([start*2-1, end*2])
    L[i] = T
dp = [0]*((10**5)*2+3)
ans = 0
for i in range(c):
    for j in range(len(L[i])):
        dp[L[i][j][0]] += 1
        dp[L[i][j][1]] -= 1
for j in range(1,(10**5)*2+3):
    dp[j] = dp[j-1]+dp[j]
    ans = max(ans, dp[j])
print(ans)


### FIXED CODE ###

n,c = map(int,input().split())
L = [[] for i in range(c)]
for i in range(n):
    s,t,k = map(int,input().split())
    L[k-1].append([s,t])
for i in range(c):
    L[i].sort()
for i in range(c):
    d = [0]*(10**5+1)
    T = []
    for j in range(len(L[i])):
        d[L[i][j][0]] += 1
        d[L[i][j][1]] -= 1
    for j in range(10**5):
        d[j+1] += d[j]
    cur = 0
    start = 0
    end = 0
    for j in range(10**5+1):
        if d[j] == 1 and cur == 0:
            start = j
            cur = 1
        elif d[j] == 0 and cur == 1:
            end = j
            cur = 0
            T.append([start*2-1, end*2])
    L[i] = T
dp = [0]*(10**5)*3
ans = 0
for i in range(c):
    for j in range(len(L[i])):
        dp[L[i][j][0]] += 1
        dp[L[i][j][1]] -= 1
for j in range(1,(10**5)*3):
    dp[j] = dp[j-1]+dp[j]
    ans = max(ans, dp[j])
print(ans)
### BUGGY CODE ###

from collections import deque
from bisect import bisect

S = input()
if len(S) < 4:
  print(0)
else:
  N = len(S)
  d = [0]*2019
  d[0] = 1
  i = N-1
  while i >= 0:
    d[int(S[i:])%2019] += 1
    i -= 1
  ans = 0
  for m in d:
    ans += m*(m-1)//2
  print(ans)



### FIXED CODE ###

S = input()
if len(S) < 4:
  print(0)
else:
  N = len(S)
  x = 0
  d = [0]*2019
  d[0] = 1
  for i, s in enumerate(reversed(S)):
    x = (x+int(s)*pow(10,i,2019))%2019
    d[x] += 1
  print(sum([m*(m-1)//2 for m in d]))
### BUGGY CODE ###

import sys
N = int(input())
C = [0]
#c = [int(sys.stdin.readline()) for i in range(N)]
n = N
for i in range(1, n + 1):
    c = int(sys.stdin.readline())
    if c == C[-1]:
        N -= 1
    else:
        C.append(c)
#C = C+c
dp = [0] * (N + 2)
dp_2 = [0] * (N + 2)
color = [[]for i in range((2*(10**5)+2))]
dp[0] = 1
dp[1] = 1
dp_2[0] = 1
dp_2[1] = 1
color[C[1]].append(1)
cumsum = [0] * (2 * (10 ** 5) + 2)
cumsum[C[1]] = 1
for i in range(2, N+1):
    dp[i] = dp[i - 1] + cumsum[C[i]]
    cumsum[C[i]] += dp[i-1]
    # ↓これだと遅い(当日はこれ以上の高速化が思いつけなくてTLE)
    dp_2[i] = dp_2[i - 1] + sum([dp_2[col - 1] for col in color[C[i]]])
    color[C[i]].append(i)
    dp[i] %= (10 ** 9 + 7)
# print(C)
# print(dp)
# print(dp_2)
print(dp[N])


### FIXED CODE ###

import sys
N = int(input())
C = [0]
n = N
for i in range(1, n + 1):
    c = int(sys.stdin.readline())
    if c == C[-1]:
        N -= 1
    else:
        C.append(c)
dp = [0] * (N + 2)
dp[0] = 1
dp[1] = 1
cumsum = [0] * (2 * (10 ** 5) + 2)
cumsum[C[1]] = 1
for i in range(2, N+1):
    dp[i] = dp[i - 1] + cumsum[C[i]]
    cumsum[C[i]] += dp[i-1]
    dp[i] %= (10 ** 9 + 7)
print(dp[N])
### BUGGY CODE ###

import sys
input = sys.stdin.readline
# from collections import deque

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

def nears(n):
    ret = []
    if n%N != 0:
        ret.append(n-1)
    if n%N != N-1:
        ret.append(n+1)
    if n//N != 0:
        ret.append(n-N)
    if n//N != N-1:
        ret.append(n+N)
    return ret

NeedS = []
for p in range(N**2):
    NeedS.append(min([p%N, p//N, N-1-p%N, N-1-p//N]))

isChecked = [False]*(N**2)
ans = 0
for p in P:
    p -= 1
    ans += NeedS[p]
    isChecked[p] = True
    q = [p]
    # q.append(p)
    while q:
        qq = []
        for p in q:
            d = NeedS[p]
            if not isChecked[p]: d += 1
            for np in nears(p):
                if d < NeedS[np]:
                    NeedS[np] = d
                    qq.append(np)
        q = qq
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
from collections import deque

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

def nears(n):
    ret = []
    if n%N != 0:
        ret.append(n-1)
    if n%N != N-1:
        ret.append(n+1)
    if n//N != 0:
        ret.append(n-N)
    if n//N != N-1:
        ret.append(n+N)
    return ret

NeedS = []
for p in range(N**2):
    NeedS.append(min([p%N, p//N, N-1-p%N, N-1-p//N]))

isChecked = [False]*(N**2)
ans = 0
for p in P:
    p -= 1
    ans += NeedS[p]
    isChecked[p] = True
    q = deque()
    q.append(p)
    while q:
        p = q.popleft()
        d = NeedS[p]
        if not isChecked[p]: d += 1
        for np in nears(p):
            if d < NeedS[np]:
                NeedS[np] = d
                q.append(np)
print(ans)
### BUGGY CODE ###

import math
import sys

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

def C(N,P):
    if N == 1: return P
    a=P
    if N >= 2 : a=math.sqrt(a)
    if N >= 4 : a=math.sqrt(a)
    if N >= 8 : a=math.sqrt(a)
    if N >= 16 : a=math.sqrt(a)
    if N >= 32 : a=math.sqrt(a)
    if N >= 64 : a=math.sqrt(a)
    if N >= 128 : a=math.sqrt(a)
    if N >= 256 : a=math.sqrt(a)
    if N >= 512 : a=math.sqrt(a)
    if N >= 1024 : a=math.sqrt(a)
    if N >= 2048 : a=math.sqrt(a)  
    res=1
    for i in range(1,int(a)+2):
        if P % i**N: continue
        res = i
    return res

print(C(n,p))

### FIXED CODE ###

n,p = list(map(int,input().split())) 
i = a = o = 1
m = round(p**(1/n))
for i in range(m,0,-1):
    a = i**n
    if p%a==0:
        print(i)
        exit()
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]

s_dict = []


for i in range(n):
    count = {}
    for c in s[i]:
        count.setdefault(c,0)
        count[c] += 1
    s_dict.append(count)
    
ans = 0
for i in range(n):
    for j in range(i+1,n):
        if s_dict[i] == s_dict[j]: ans +=1
print(ans)

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

ans = 0
count = {}
for i in range(n):
    c = ''.join(sorted(s[i]))
    count.setdefault(c,0)
    count[c] += 1
    if(count[c] > 0):
        ans += count[c] -1

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

def gcd(a,b):
  ret = d[a][b]
  if ret != 0:
    return ret
  while b:
    a,b = b,a%b
  d[a][b] = a
  d[b][a] = a
  
  return a

def gcd2(A):    
  ret = gcd(gcd(A[0],A[1]),A[2])    
  return ret

n = int(input())

d = [[0]*(n+1) for _ in range(n+1)]

ans = 0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans += gcd(gcd(i,j),k)

print(ans)

### FIXED CODE ###

def gcd(a,b):
  ret = d[a][b]
  if ret != 0:
    return ret
  while b:
    a,b = b,a%b
  d[a][b] = a
  d[b][a] = a
  
  return a

def gcd2(A):    
  ret = gcd(gcd(A[0],A[1]),A[2])    
  return ret

n = int(input())

d = [[0]*(n+1) for _ in range(n+1)]

ans = 0
for i in range(1,n+1):
  for j in range(1,n+1):
    for k in range(1,n+1):
      ans += gcd(gcd(i,j),k)

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

q = int(input())
lr = []
for i in range(q):
    li, ri = map(int, input().split())
    lr.append([li, ri])

def isprime(n):
    if n == 1:
        return False
    elif n in [2, 3]:
        return True
    elif n % 2 == 0:
        return False
    elif n % 3 == 0:
        return False
    for i in range(3, int(n**(1/2))+1):
        if n % i == 0:
            return False
    return True

for i in range(q):
    res = 0
    for j in range(lr[i][0], lr[i][1]+1, 2):
        if isprime(j) and isprime((j+1)//2):
            res += 1
    print(res)

### FIXED CODE ###

import numpy as np

q = int(input())
lr = []
for i in range(q):
    li, ri = map(int, input().split())
    lr.append([li, ri])

range_max = 100000
tf = np.ones(range_max, dtype=int)
tf[0] = 0

i = 1
while True:
    if i == int(range_max ** (1 / 2)) + 1:
        break
    if not tf[i]:
        i += 1
        continue

    tmp = np.arange(i, range_max, i + 1)
    tf[tmp[1:]] = 0
    i += 1

counter = 0
counter_list = [0]
for i in range(2, 100000, 2):
    if tf[i] == 1 and tf[i//2] == 1:
        counter += 1
    counter_list.append(counter)

for i in range(q):
    left = lr[i][0]//2
    right = lr[i][1]//2
    res = counter_list[right] - counter_list[left]
    if left > 0 and counter_list[left] - counter_list[left-1] == 1:
        res += 1
    print(res)
### BUGGY CODE ###


"""

https://atcoder.jp/contests/cf17-final/tasks/cf17_final_e

回文をちゃんと定義しよう？
左の文字を何回変化させたら右になるか、をxとする
iを並べた時、対象の部分の和は26(の倍数)でなくてはならない
ただし、xの列が奇数調なら真ん中は0

abba なら
1,0,25

すると、l,rは2点を更新するだけになる
index l-1を+1し、rを-1する(mod26せよ,1-origin)
左右反転した部分の和を配列yとしてもつ(mod26)
すると、配列の2つの部分に+1,-1する操作を好きな回数だけ行って全て
26の倍数にせよという問題になる。

+→-の有向グラフで考える
まず、連結成分ごとに全てのノードの初期値の総和が26の倍数で無いなら不可能
そうでなければ可能(端から合わせていけば絶対つじつまが合うため)
解けたのでは？
あ、ただし、-1 or len(S-1)とリンクしてる連結成分は26の倍数でなくてもよい
1-indexedのほうがいいか？
0 or len(S)とリンクしてる連結成分は26の倍数でなくてもよい

"""
import sys
sys.setrecursionlimit(200000)
alp = "abcdefghijklmnopqrstuvwxyz"
ad = {}
for i in range(26):
    ad[alp[i]] = i

S = input()
x = []

for i in range(len(S)-1):
    x.append((ad[S[i+1]]-ad[S[i]]) % 26)

y = [0]
for j in range((len(x)+1)//2):

    j2 = len(x)-1-j

    if j != j2:
        y.append(x[j]+x[j2])
    else:
        y.append(x[j])

#print (x,y)
N = int(input())

lis = [ [] for i in range(len(y)) ] #連結リスト
for loop in range(N):
    
    l,r = map(int,input().split())
    l -= 1

    l = min( l , len(x)+1-l )
    r = min( r , len(x)+1-r )

    lis[l].append(r)
    lis[r].append(l)

#print (lis)

def dfs(v):
    ret = y[v]
    visit[v] = True
    for nex in lis[v]:
        if not visit[nex]:
            ret += dfs(nex)
    return ret

visit = [False] * len(lis)
ans = "YES"
for i in range(len(lis)):

    if visit[i]:
        continue
    rec = dfs(i)
    if i != 0 and rec % 26 != 0:
        ans = "NO"
        break

print (ans)


### FIXED CODE ###


"""

https://atcoder.jp/contests/cf17-final/tasks/cf17_final_e

回文をちゃんと定義しよう？
左の文字を何回変化させたら右になるか、をxとする
iを並べた時、対象の部分の和は26(の倍数)でなくてはならない
ただし、xの列が奇数調なら真ん中は0

abba なら
1,0,25

すると、l,rは2点を更新するだけになる
index l-1を+1し、rを-1する(mod26せよ,1-origin)
左右反転した部分の和を配列yとしてもつ(mod26)
すると、配列の2つの部分に+1,-1する操作を好きな回数だけ行って全て
26の倍数にせよという問題になる。

+→-の有向グラフで考える
まず、連結成分ごとに全てのノードの初期値の総和が26の倍数で無いなら不可能
そうでなければ可能(端から合わせていけば絶対つじつまが合うため)
解けたのでは？
あ、ただし、-1 or len(S-1)とリンクしてる連結成分は26の倍数でなくてもよい
1-indexedのほうがいいか？
0 or len(S)とリンクしてる連結成分は26の倍数でなくてもよい

"""
import sys
sys.setrecursionlimit(200000)
alp = "abcdefghijklmnopqrstuvwxyz"
ad = {}
for i in range(26):
    ad[alp[i]] = i

S = input()
x = []

for i in range(len(S)-1):
    x.append((ad[S[i+1]]-ad[S[i]]) % 26)

y = [0]
for j in range((len(x)+1)//2):

    j2 = len(x)-1-j

    if j != j2:
        y.append(x[j]+x[j2])
    else:
        y.append(x[j])

#print (x,y)
N = int(input())

lis = [ [] for i in range(len(y)) ] #連結リスト
for loop in range(N):
    
    l,r = map(int,input().split())
    l -= 1

    l = min( l , len(x)+1-l )
    r = min( r , len(x)+1-r )

    lis[l].append(r)
    lis[r].append(l)

#print (lis)

def dfs(v):
    ret = y[v]
    visit[v] = True
    for nex in lis[v]:
        if not visit[nex]:
            ret += dfs(nex)
    return ret

visit = [False] * len(lis)
ans = "YES"
for i in range(len(lis)):

    if visit[i]:
        continue
    rec = dfs(i)
    if i != 0 and rec % 26 != 0:
        ans = "NO"
        break

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

from collections import Counter

N=int(input())
L=[]

for i in range(N):
    si=input()
    ci=Counter(si)
    c=sorted(ci.elements())
    L.append(c)


ans=0

for i in range(N):
    for j in range(1,N-i):
        # print('i:{0} j:{1} L{2}:{3} L{4}:{5} TF:{6}'.format(i,j,i,L[i],i+j,L[i+j],L[i]==L[i+j]))
        if L[i]==L[i+j]:
            ans+=1
        else:
            pass
# print(L)
print(ans)

### FIXED CODE ###

from collections import Counter

N=int(input())
dic={}

ans=0

for i in range(N):
    si=input()
    # ci=Counter(si)
    # c=sorted(ci.elements())
    # c=sorted(Counter(si).elements())
    sorted_s=''.join(sorted(Counter(si).elements()))
    if sorted_s in dic:
        ans+=dic[sorted_s]
        dic[sorted_s]+=1
    else:
        dic[sorted_s]=1
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-

N = int(input())

lasts = []

before = [int(input())]
lasts.append(before)

for _ in range(N - 1):
    current = int(input())
    if before[0] < current:
        before[0] = current
        continue
    try:
        low = next(x for x in lasts if x[0] < current)
        low[0] = current
    except StopIteration:
        lasts.append([current])

print(len(lasts))


### FIXED CODE ###

# -*- coding: utf-8 -*-
from bisect import bisect_right

N = int(input())

columns = []


for _ in range(N):
    current = -int(input())
    index = bisect_right(columns, current)
    if len(columns) <= index:
        columns.append(current)
    else:
        columns[index] = current

print(len(columns))
### BUGGY CODE ###

a,b,k = [int(i) for i in input().split()]
A = [i for i in range(a,b+1)]
n = len(A)
ans = []
for i in range(k):
    if i >= n:
        break
    else:
        ans.append(A[i])

for i in range(1,k+1):
    if i >= n or A[-i] in ans:
        break
    else:
        ans.append(A[-i])


ans.sort()

for a in ans:
    print(a)

### FIXED CODE ###

a,b,k = [int(i) for i in input().split()]
n = b-a+1

if n <= 2*k:
    for i in range(a,b+1):
        print(i)

else:
    for i in range(k):
        print(a+i)
    for i in range(b-k+1,b+1):
        print(i)
### BUGGY CODE ###

import sys, bisect, copy
# import numpy as np
# import scipy
from collections import defaultdict
input = sys.stdin.readline
mod = 998244353
def main():
    n,s = map(int,input().split())
    a = list(map(int, input().split()))
    dp = [[defaultdict(int) for _ in range(s+1)] for _ in range(n+1)]
    dp1 = [[defaultdict(int) for _ in range(s+1)] for _ in range(n+1)]
    dp[0][0][0] = 1
    dp1[0][0][0] = 1
    ans = 0
    for i in range(n):
        for j in range(s,-1,-1):
            if j-a[i] < 0:
                continue
            if not dp1[i][j-a[i]]:
                continue
            for e in dp[i][j-a[i]]:
                if not dp1[i][j-a[i]][e]:
                    continue
                dp[i+1][j][e+1] += dp[i][j-a[i]][e]
                dp1[i+1][j][e+1] = 1
            if j == s and len(dp[i+1][j]):
                for e in dp[i+1][j]:
                    ans += dp[i+1][j][e]*pow(2,n-e,mod)
                    ans %= mod
        for j in range(s-1,-1,-1):
            for e in dp[i][j]:
                dp[i+1][j][e] += dp[i][j][e]
                dp1[i+1][j][e] = 1
    print(ans)
if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
from collections import defaultdict
input = sys.stdin.readline
mod = 998244353
def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2] != 1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    return [w[0],w[1]]
def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return ( m + x%m ) % m
def main():
    n,s = map(int,input().split())
    a = list(map(int, input().split()))
    dp = [[0 for _ in range(s+1)] for _ in range(n+1)]
    dp[0][0] = pow(2,n,mod)
    MODINV2 = mod_inv(2,mod)
    ans = 0
    for i in range(n):
        for j in range(s,-1,-1):
            if j-a[i] < 0:
                continue
            dp[i+1][j] += dp[i][j-a[i]]*MODINV2
            dp[i+1][j] %= mod
        for j in range(s,-1,-1):
            if j == s:
                ans += dp[i+1][j]
                ans %= mod
            else:
                dp[i+1][j] += dp[i][j]
                dp[i+1][j] %= mod
    print(ans)
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n,k = map(int, input().split())
p = list(map(int, input().split()))

m = -1
index = -1
for i in range(n-k+1):
    tmp = sum(p[i:i+k])
    if tmp > m:
        m = tmp
        index = i


def calc_exp(p):
    return ((p * (p+1)) / 2) / p
        
exp = 0
for i in range(index,index+k):
    exp += calc_exp(p[i])

print(exp)


### FIXED CODE ###

n,k = map(int, input().split())
p = list(map(int, input().split()))

m = sum(p[:k])
index = 0
tmp = sum(p[:k])
for i in range(n-k):
    tmp -= p[i]
    tmp += p[i+k]
    if tmp > m:
        m = tmp
        index = i+1

def calc_exp(p):
    return ((p * (p+1)) / 2) / p
        
exp = 0
for i in range(index,index+k):
    exp += calc_exp(p[i])

print(exp)