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

import itertools
n, m=map(int, input().split())
ab=[set(map(int, input().split())) for _ in range(m)]
root=list(itertools.permutations(ab, n-1))
cnt=0
for r in root:
    trace=[i+1 for i in range(n)]
    other=1
    for i in range(0, n-1):
        if other in r[i]:
            try:
                trace.remove(other)
            except ValueError:
                break
            other=list(r[i]-{other})[0]
            continue
        else: break
    try:
        trace.remove(other)
    except ValueError:
        pass
    if trace==[]:
        cnt+=1
print(cnt)

### FIXED CODE ###

N, M = map(int, input().split())
adj_matrix = [[0]* N for _ in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    adj_matrix[a-1][b-1] = 1
    adj_matrix[b-1][a-1] = 1

def dfs(v, used):
    if not False in used:
        return 1
    
    ans = 0
    for i in range(N):
        if not adj_matrix[v][i]:
            continue
        if used[i]:
            continue
        
        used[i] = True
        ans += dfs(i, used)
        used[i] = False
    
    return ans

used = [False] * N
used[0] = True

print(dfs(0, used))
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
for i in range(N):
  print(A.count(i+1))

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
T=[0 for i in range(N)]
for a in A:
  T[a-1]+=1
for t in T:
  print(t)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
from collections import defaultdict


MAX_INT = 2**62-1
sys.setrecursionlimit(10**6)

input = sys.stdin.readline


N = 2 * (10**5) + 1
MOD = 10**9 + 7

fact = [1] * N
fact_inv = [0] * N

for i in range(1, 2 * (10**5)+1):
    fact[i] = fact[i-1] * i % MOD
    fact_inv[i] = pow(fact[i], MOD-2, MOD)


def solve(g):
    def dfs(pre, cur):
        if pre in memo and cur in memo[pre]:
            return memo[pre][cur]

        num, ways = 1, 1

        for nxt in g[cur]:
            if nxt == pre:
                continue
            n, w = dfs(cur, nxt)
            num += n
            ways = ways * w % m * fi[n] % m

        ways = ways * f[num-1] % m
        memo[pre][cur] = num, ways
        return num, ways

    m = MOD
    memo = defaultdict(dict)
    f, fi = fact, fact_inv

    for i in range(1, len(g)):
        print(dfs(None, i)[1])


def main():
    n = int(input())
    g = [[] for _ in range(n+1)]

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

    solve(g)


if __name__ == "__main__":

    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
from functools import reduce

MAX_INT = 2**62-1
sys.setrecursionlimit(10**7)

input = sys.stdin.readline

# @profile
MOD = 10**9 + 7


def mul_mod(*args, mod=MOD):
    return reduce(lambda a, b: a * b % mod, args)


def solve(g, f, fi, m):
    mul = mul_mod

    stack = [(0, 1)]
    pre_order = []
    n = len(g) - 1

    while stack:
        pre, cur = stack.pop()
        pre_order.append((pre, cur))

        for nxt in g[cur]:
            if nxt == pre:
                continue
            stack.append((cur, nxt))

    size = [1] * (n+1)
    dp = [1] * (n+1)

    for pre, cur in reversed(pre_order):
        dp[cur] = mul(dp[cur], f[size[cur]-1])
        dp[pre] = mul(dp[pre], dp[cur], fi[size[cur]])
        size[pre] += size[cur]

    ans = [1] * (n+1)
    ans[1] = dp[1]

    for pre, cur in pre_order[1:]:
        i = size[cur]
        temp = mul(ans[pre], f[n-i-1], fi[n-1], f[i], pow(dp[cur], m-2, m))
        ans[cur] = mul(f[n-1], temp, fi[n-i], dp[cur], fi[i-1])
    print(*ans[1:], sep='\n')


# @profile
def main():
    mul = mul_mod
    mod = MOD
    n = int(input())
    g = [[] for _ in range(n+1)]

    fact = [1] * (n+1)
    fact_inv = [0] * (n+1)

    for i in range(1, n+1):
        fact[i] = mul(fact[i-1], i)

    fact_inv[-1] = pow(fact[-1], mod-2, mod)

    for i in range(n)[::-1]:
        fact_inv[i] = mul(fact_inv[i+1], (i+1))

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

    solve(g, fact, fact_inv, mod)


if __name__ == "__main__":

    main()
### BUGGY CODE ###

import numpy as np
from math import factorial

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

amount = np.array([])
for i in range(N):
	amount = np.append(amount, np.sum(A == i + 1))

for i in range(N):
	amount[A[i] - 1] -= 1
	ans = 0
	for j in range(N):
		if amount[j] <= 1:
			pass
		else:
			ans += factorial(amount[j]) / factorial(2) / factorial(amount[j] - 2)
	print(int(ans))
	amount[A[i] - 1] += 1


### FIXED CODE ###

import numpy as np
import collections

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

dic = {}
after = {}

l = collections.Counter(A)

for key, val in l.items():
	dic[key] = val * (val - 1) // 2
	after[key] = (val - 1) * (val - 2) // 2

numsum = sum(dic.values())

ans = {}
for key in dic.keys():
	ans[key] = numsum - dic[key] + after[key]

for i in range(N):
	print(ans[A[i]])
### BUGGY CODE ###

from scipy.spatial import distance

N, D = map(int, input().split())
xy = [list(map(int, input().split())) for xy in range(N)]
o = [0, 0]
count = 0

for i in range(N):
    if distance.euclidean(xy[i], o) <= D:
        count += 1
    else:
        pass

print(count)


### FIXED CODE ###

import numpy as np

N, D = map(int, input().split())
xy = np.array([list(map(int, input().split())) for xy in range(N)])
o = np.array([0, 0])
count = 0

for i in range(N):
    if np.linalg.norm(xy[i] - o) <= D:
        count += 1
    else:
        pass

print(count)
### BUGGY CODE ###

#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline
input=sys.stdin.readline

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

def DIJKSTRA(point,d):
    cost      = [float("inf")]*(n+1)
    Q         = []
    cost[point]=0
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

def main():
    
    d=[[]for i in range(n+1)]
    
    for i in range(m):
        a,b,c=map(int,input().split())
        d[a].append((b,c))
        d[b].append((a,c))
    for i in range(1,n+1):
        for j in range(i+1,n+1):
            d[j].append((i,0))
#    print(d)
    x=DIJKSTRA(1,d)[n]
    if x!=float("inf"):
        print(x)
    else:
        print(-1)
        
if __name__ == '__main__':
    main()


### FIXED CODE ###

#import numpy as np
#from numpy import*
#from scipy.sparse.csgraph import shortest_path #shortest_path(csgraph=graph) # dijkstra# floyd_warshall
#from scipy.sparse import csr_matrix
from collections import* #defaultdict Counter deque appendleft
from fractions import gcd
from functools import* #reduce
from itertools import* #permutations("AB",repeat=2) combinations("AB",2) product("AB",2) groupby accumulate
from operator import mul,itemgetter
from bisect import* #bisect_left bisect_right
from heapq import* #heapify heappop heappushpop
from math import factorial,pi
from copy import deepcopy
import sys
sys.setrecursionlimit(10**8)
#input=sys.stdin.readline
input=sys.stdin.readline

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

def DIJKSTRA(point,d):
    cost      = [float("inf")]*(n+1)
    Q         = []
    cost[point]=0
    heappush(Q,(point,cost[point]))
    while Q:
        prefnd,tmpC=heappop(Q)
        if cost[prefnd]<tmpC:
            continue
        for node,c in d[prefnd]:
            altC=c+tmpC
            if cost[node]>altC:
                cost[node]=altC
                heappush(Q,(node,altC))
    return cost

def main():
    
    d=[[]for i in range(n+1)]
    
    for i in range(m):
        a,b,c=map(int,input().split())
        d[a].append((b,c))
    for i in range(1,n+1):
        d[i].append((i-1,0))
#    print(d)
    x=DIJKSTRA(1,d)[n]
    if x!=float("inf"):
        print(x)
    else:
        print(-1)
        
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import bisect
 
N, M = map(int, input().split(" "))
As = [0]+list(map(int, input().split(" ")))
As.sort()
cnt = 0
cnt2 = 1
for _ in range(M):
  i = As[-1-cnt]  
  i = i>>cnt2
  if i < As[-1-cnt-1]:
    cnt += 1
    cnt2 = 1
    bisect.insort_left(As,i)
  else:
    cnt2 += 1
 
print(sum(As[:-cnt]))

### FIXED CODE ###

import heapq
 
N, M = map(int, input().split(" "))
As = [-i for i in map(int, input().split(" "))]
As.sort()
heapq.heapify(As)

for _ in range(M):
  i = - heapq.heappop(As)
  i = i >> 1
  heapq.heappush(As,-i)

print(-sum(As))
### BUGGY CODE ###

#d
A,B,N=map(int,input().split())
b=[]
for i in range(1,(N//B)+1):
    b.append(i*B-1)
b.append(N)
a=0
for x in b:
    p=(A*x)//B-A*(x//B)
    if p>a:
        a=p
print(a)

### FIXED CODE ###

#d
A,B,N=map(int,input().split())
b=[]
if N>=B:
    b.append((N//B)*B-1)
b.append(N)
a=0
for x in b:
    p=(A*x)//B-A*(x//B)
    if p>a:
        a=p
print(a)
### BUGGY CODE ###

from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,m = map(int, stdin.readline().rstrip().split())
h = list(map(int, stdin.readline().rstrip().split()))

michi = [[0] * n for i in range(n)]

for i in range(m):
    a,b = map(int, stdin.readline().rstrip().split())
    michi[a-1][b-1] = michi[b-1][a-1] = 1

count = 0
for i in range(n):
    b=0
    for j in range(n):
        if michi[i][j]==1:
            if h[i] > h[j]:
                pass
            else:
                b=1
        else:
            pass
    if b==1:
        pass
    else:
        count += 1

print(count)


### FIXED CODE ###

from sys import stdin
#n = int(stdin.readline().rstrip())
#l = list(map(int, stdin.readline().rstrip().split()))
n,m = map(int, stdin.readline().rstrip().split())
h = list(map(int, stdin.readline().rstrip().split()))

#michi = [[0] * n for i in range(n)]

good = [1]*n

for i in range(m):
    a,b = map(int, stdin.readline().rstrip().split())
    if h[a-1] < h[b-1]:
        good[a-1] = 0
    elif h[a-1] > h[b-1]:
        good[b-1] = 0
    else:
        good[a-1] = good[b-1] = 0

print(good.count(1))
### BUGGY CODE ###

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

boals = []
roop = 0
for _ in range(N):
    if roop < A:
        boals.append('B')
        roop += 1
    elif roop < A + B - 1:
        boals.append('R')
        roop += 1
    else:
        boals.append('R')
        roop = 0
print(boals.count('B'))

### FIXED CODE ###

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

division = N // (A + B)
count = division * A

count += N - division * (A + B) if A > N - division * (A + B) else A
print(count)
### BUGGY CODE ###

n=int(input());
A=[int(input().replace(' ',''),2)for _ in[0]*n]
dp=[0]*2**n
dp[0]=1
for I in range(2**n-1):
 a=A[bin(I).count('1')]&~I
 for j in range(n):
  x=1<<j;
  if a&x:dp[I+x]+=dp[I];dp[I+x]%=10**9+7
print(dp[-1])

### FIXED CODE ###

n=int(input());
A=[int(input().replace(' ',''),2)for _ in[0]*n]
dp=[0]*2**n
dp[0]=1
for I in range(2**n-1):
    a=A[bin(I).count('1')]&~I
    for j in range(n):
        if a&1<<j:dp[I|1<<j]=(dp[I|1<<j]+dp[I])%(10**9+7)
print(dp[-1])
### BUGGY CODE ###

import array

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = array.array('l', [])  # List is too slow, so use array instead
    len_left = len(left)
    len_right = len(right)
    while lpos < len_left and rpos < len_right:
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            rcount += len(left[lpos:])
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount
    
if __name__ == '__main__':
    n = int(raw_input())
    A = array.array('l', map(int, raw_input().split()))
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count

### FIXED CODE ###

from array import array

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = array('I', [])  # List is too slow. Use an array instead.
    len_left = len(left)
    len_right = len(right)
    while lpos < len_left and rpos < len_right:
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            #rcount += len(left[lpos:])
            rcount += len_left - lpos
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount
    
if __name__ == '__main__':
    n = int(raw_input())
    A = array('I', map(int, raw_input().split()))
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count
### BUGGY CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

A.sort()
change = sorted(change,key=lambda x:x[1])
change.reverse()

for i in range(M):
    b,c = change[i]
    if A[0] > c:
        break
    for j in range(b):
        if A[j] < c:
            A[j] = c
    A.sort()

print(sum(A))


### FIXED CODE ###

# encoding:utf-8
import copy
import random
import bisect #bisect_left　これで二部探索の大小検索が行える
import fractions #最小公倍数などはこっち
import math
import sys

mod = 10**9+7
sys.setrecursionlimit(mod) # 再帰回数上限はでdefault1000

N,M = map(int,input().split())
A = [int(i) for i in input().split()]
change = [0 for i in range(M)]
for i in range(M):
    change[i] = [int(i) for i in input().split()]

D = []
change = sorted(change,key=lambda x:x[1],reverse=True)
for i in range(M):
    b,c = change[i]
    for j in range(b):
        D += [c]
    if len(D) > N:
        break

A += D
A.sort(reverse=True)
print(sum(A[:N]))
### BUGGY CODE ###

n, m = map(int, input().split())
lrc = []
for _ in range(m):
    lrc.append(tuple(map(int, input().split())))
lrc.sort()

inf = 10**15
dp = [inf]*(n+1)
dp[1] = 0

for l, r, c in lrc:
    for i in range(r, l, -1):
        if dp[i] > dp[l] + c:
            dp[i] = dp[l] + c
        else:
            break

ans = -1 if dp[n] == inf else dp[n]
print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
lrc = []
for _ in range(m):
    lrc.append(tuple(map(int, input().split())))
lrc.sort()

inf = 10**15
dp = [inf]*(n+1)
dp[1] = 0

for l, r, c in lrc:
    for i in range(r, l, -1):
        if dp[i] > dp[l] + c:
            dp[i] = dp[l] + c
        else:
            break

ans = -1 if dp[n] == inf else dp[n]
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
q = int(input())
for i in range(q):
	c=list(input().split())
	if c[0]=="1":
		s=s[:int(c[1])-1]+c[2]+s[int(c[1]):]
	else:
		print(len(set(s[int(c[1])-1:int(c[2])])))

### FIXED CODE ###

n = int(input())
stmp = list(input())
Q = int(input())
target = ord("a")
s = [ord(stmp[i])-target for i in range(n)]

class BIT:
	"""
	<Attention> 0-indexed.
	query ... return the sum [0 to m]
	sum ... return the sum [a to b]
	sumall ... return the sum [all]
	add ... 'add' number to element (be careful that it doesn't set a value.)
	search ... the sum version of bisect.right
	output ... return the n-th element
	listout ... return the BIT list
	"""
	
	def query(self, m):
		res = 0
		while m > 0:
			res += self.bit[m]
			m -= m&(-m)
		return res
	
	def sum(self, a, b):
		return self.query(b)-self.query(a)
	
	def sumall(self):
		bitlen = self.bitlen-1
		return self.query(bitlen)
	
	def add(self, m, x):
		m += 1
		bitlen = len(self.bit)
		while m <= bitlen-1:
			self.bit[m] += x
			m += m&(-m)
		return
	
	def __init__(self, n):
		self.bitlen = n+1
		self.bit = [0]*(n+1)

b = [BIT(n) for i in range(26)]
for i in range(n):
	b[s[i]].add(i, 1)

for _ in range(Q):
	q,qtmpa,qtmpb = input().split()
	if q[0] == "1":
		qa = int(qtmpa)
		t = ord(qtmpb)-target
		b[t].add(qa-1, 1)
		b[s[qa-1]].add(qa-1, -1)
		s[qa-1] = t
	else:
		ans = 0
		qta = int(qtmpa)
		qtb = int(qtmpb)
		for i in range(26):
			if b[i].sum(qta-1, qtb) != 0:
				ans += 1
		print(ans)
### BUGGY CODE ###

# coding: utf-8
N = int(input())
mod = 10**9 + 7
ans = 1
for i in range(1, N+1):
    ans *= i
print(ans % mod)

### FIXED CODE ###

# coding: utf-8
N = int(input())
mod = 10**9 + 7
ans = 1
for i in range(1, N+1):
    ans = ans * i % mod
print(ans)
### BUGGY CODE ###

N = int(input())

a = [int(N) for N in input().split()]
b = len(a)

for i in range(1,N+1):
    print(a.count(i))

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
 
ans = [0]*n
for i in range(n-1):
    ans[a[i]-1] += 1
for j in range(n):
    print(ans[j])
### BUGGY CODE ###

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

# スペース区切りの整数の入力
h, w, m = map(int, input().split())

h_list = [0]*h
w_list = [0]*w

# h_w_list = [[0 for j in range(w)] for i in range(h)]
h_w_list = []

for zzz in range(m):
  # print("---")
  bom_h, bom_w = map(int, input().split())
  # print(bom_h, bom_w)
  h_list[bom_h-1] += 1
  w_list[bom_w-1] += 1

  # h_w_list[bom_h-1][bom_w-1] = 1
  h_w_list.append([bom_h, bom_w])

mh = max(h_list)
mw = max(w_list)
h_max_indexs = [i for i, v in enumerate(h_list) if v == mh]
w_max_indexs = [i for i, v in enumerate(w_list) if v == mw]

double_chance = False
# print("---")
for h_index in h_max_indexs:
  if double_chance:
    break
  for w_index in w_max_indexs:
    if double_chance:
      break
    # chance = h_w_list[h_index][w_index] != 1
    chance = h_w_list.count([h_index + 1, w_index + 1]) == 0
    # print(h_w_list)
    # print([h_index, w_index], chance)


    # print(h_index, w_index, chance)
    if chance:
      double_chance = True


if double_chance:
  result = mh + mw
else:
  result = mh + mw -1

print(result)


### FIXED CODE ###

H,W,M = map(int,input().split())
listh = [0] * H
listw = [0] * W
s = set()
for i in range(M):
    hm,wm = map(int,input().split())
    listh[hm-1] += 1
    listw[wm-1] += 1
    s.add((hm-1,wm-1))
mh = max(listh)
mw = max(listw)
maxh = [i for i,v in enumerate(listh) if v == mh]
maxw = [i for i,v in enumerate(listw) if v == mw]

import sys
for i in maxh:
    for j in maxw:
        if (i,j) not in s:
            print(mh + mw)
            sys.exit()
print(mh + mw - 1)
### BUGGY CODE ###

a = int(input())
b = input().split()
c = []
for i in range(a):
  d = int(b[i])
  c.append(d)
ans =1
for I in c:
  ans = ans*I
if ans>10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

a = int(input())
b = [int(i) for i in input().split()]

ans =1
b = sorted(b)
for I in b:
  ans = ans*I
  if b[0] == 0:
      ans = 0
      print(0)
      break
  elif ans > 10**18:
    print('-1')
    ans = -1
    break
if ans >=1:
    print(ans)
### BUGGY CODE ###

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

d = {}

for py in PY:
    d[py[0]] = d.get(py[0],[])+[py[1]]

for k in d:
    d[k].sort()

for py in PY:
    s1 = str(py[0])
    s1 = ("0"*(6-len(s1)))+s1
    s2 = str(d[py[0]].index(py[1])+1)
    s2 = ("0"*(6-len(s2)))+s2

    print(s1+s2)


### FIXED CODE ###

N,M = map(int,input().split())
PY = [list(map(int,input().split()))+[i] for i in range(M)]

num = [0]*N
ans = [""]*M

PY.sort(key = lambda x:x[1])

for p,y,i in PY:
    num[p-1] += 1
    ans[i] = str(p).zfill(6) + str(num[p-1]).zfill(6)

for a in ans:
    print(a)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N= int(input())
A= list(map(int,input().split(' ')))
 
ans = 0
for i in range(len(A)-1):
  for j in range(i+1, len(A)):
    ans += A[i]*A[j]
 
print(ans % (10**9+7))


### FIXED CODE ###

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

mod = 10**9+7
ans = 0
cs = 0
for i in range(N-1, -1, -1):
  ans = (ans+A[i]*cs) % mod
  cs = (cs+A[i]) % mod

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

A,B,K = map(int, open(0).read().split())
intList = [i for i in range(A,B+1)]
ansList = set(intList[:K]+intList[::-1][:K])
# print(intList)
# print(ansList)
for j in sorted(ansList):
    print(j)

### FIXED CODE ###

# A,B,K = map(int, open(0).read().split())
A,B,K = map(int, input().split())
r=range(A,B+1)
for j in sorted(set(r[:K])|set(r[::-1][:K])):
    print(j)
### BUGGY CODE ###

N=int(input())
a=list(map(int,input().split()))
ans=0
for i in a:
    ans=max(ans,a.count(i-1)+a.count(i)+a.count(i+1))
print(ans)

### FIXED CODE ###

import collections
N=int(input())
a=list(map(int,input().split()))

arr=[]
for i in a:
    arr.extend([i-1,i,i+1])

arr_c=collections.Counter(arr)

print(max(arr_c.values()))
### BUGGY CODE ###

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

dic = {}
for key, a in zip(range(1, n+1), list(map(int,input().split()))):
    dic[key] = a
 
keynum = 0
log = [1]
next = dic[1]
log.append(next)
k -= 1
while k:
    next = dic[next]
    if next in log:
        keynum = log.index(next)
        k -= 1
        break
    log.append(next)
    k -= 1
looplen = len(log[keynum:])
if k < len(log[keynum:]):
    print(log[-1])
else:
    res = k%looplen
    print(log[keynum+res])

### FIXED CODE ###

n,k = map(int,input().split())
a = list(map(int,input().split()))
dic = {}
for key, a in zip(range(1, n+1), a):
    dic[key] = a
 
log = [-1]*(n+1)
next = dic[1]
step = 1
log[next] = step
k -= 1
while k:
    next = dic[next]
    step += 1
    k -= 1
    if log[next] != -1:
        k %= log[next] - step
    else:
        log[next] = step
print(next)
### BUGGY CODE ###

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

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

import heapq
def min_heapsort(iter):
    h = []
    for value in iter:
        heapq.heappush(h, value)
    return [heapq.heappop(h) for i in range(len(h))]

def max_heapsort(iter):
    for i in reversed(range(len(iter)//2)):
        max_heapify(iter,i)

def max_heapify(array,i):
    left = 2*i+1
    right = 2*i+2
    length = len(array) - 1
    biggest = i

    if left <= length and array[i] < array[left]:
        biggest = left
    if right <= length and array[biggest] < array[right]:
        biggest = right
    if biggest != i:
        array[i], array[biggest] = array[biggest], array[i]
        max_heapify(array, biggest)

def waribiki(X,Y):
    return X//(2**Y)

if len(A)==1:
    while M>0:
        A[0] = waribiki(A[0],1)
        M -= 1
else:
    while M>0:
        #A.sort(reverse=True)
        max_heapsort(A)
        
        m=1
        #while M>0 and waribiki(A[0],m)>A[1]:
        #    m+=1
        A[0] = waribiki(A[0],m)
        M -= m
       

print(sum(A))


### FIXED CODE ###

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

def intm(x):
    return int(x)*-1
A = list(map(intm, input().split()))

import heapq

heapq.heapify(A)
while M>0:
    a = -heapq.heappop(A) // 2
    heapq.heappush(A,-a)
    M -= 1
   

print(-sum(A))