Harryxun/stf_run huggingface dataset:
N,M,X= map(int,input().split())
A=[list(map(int,input().split())) for i in range(N)]
K=np.array([0*M])
m=[]

import numpy as np


def dfs(i, sum,K):
    # n 個決め終わったら、今までの和 sum が k と等しいかを返す
    if i == N:
        count=0
        for j in K:
           if j>=X:
                count+=1
        if count==M
            m.append(sum)
        return count==M
            

    # a[i] を使わない場合
    if dfs(i + 1, sum+K[i][0],K+np.array([for j in A[i][1:]]):
        return True

    # a[i] を使う場合
    if dfs(i + 1, sum,K):
        return True

    # a[i] を使う使わないに拘らず k が作れないので False を返す
    return False
print(min(m) if dfs(0,0,K) else -1)



### FIXED CODE ###

n,m,x=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
ans=[]
for bit in range(1<<n):
  total=0
  skill=[0]*m
  for i in range(n):
    if bit & (1<<i):
      total+=a[i][0]
      for j in range(m):
        skill[j]+=a[i][j+1]
  if all([k>=x for k in skill]):
    ans.append(total)
print(min(ans) if len(ans)!=0 else -1)
r = int(input())
menseki = r*r*3.141592
syuu = r*2*3.141592
print(str(menseki)+" "+str(syuu))

### FIXED CODE ###

import math
r = float(input())
menseki = r*r*math.pi
syuu = r*2*math.pi
print("%.6f" % (menseki),end=" ")
print("%.6f" % (syuu))
s = input()
t = input()
sorted_s = sorted(s)
sorted_t = sorted(t, reverse=True)

len_s = len(sorted_s)
flag = 0
for i in range(len_s):
    s_i = sorted_s[i]
    t_i = sorted_t[i]
    if s_i < t_i:
        flag = 1
        break
if flag:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

s = input()
t = input()

sorted_s = sorted(s)
sorted_t = sorted(t, reverse=True)
len_s = len(sorted_s)
len_t = len(sorted_t)
iter_range = len_s if len_s < len_t else len_t

flag = 0
same_count = 0
for i in range(iter_range):
    s_i = sorted_s[i]
    t_i = sorted_t[i]
    if s_i < t_i:
        flag = 1
        break
    if s_i == t_i:
        same_count+= 1

if (same_count == len_s) & (len_s < len_t):
    print("Yes")
elif (same_count == len_s) & (len_s >= len_t):
    print("No")
elif flag:
    print("Yes")
else:
    print("No")
import math

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

_A = [] * len(A)
for i in range(len(A)):
    _A[i] -= (i + 1)
_A.sort()
median = _A[len(A) / 2]

sadness = 0
for i in range(len(A)):
    sadness += abs(A[i] - (i + 1 + median))

print(sadness)


### FIXED CODE ###

import math

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

_A = []
for i in range(len(A)):
    _A.append(A[i] - (i + 1))
_A.sort()
median = _A[math.floor(len(A) / 2)]

sadness = 0
for i in range(len(A)):
    sadness += abs(A[i] - (i + 1 + median))

print(sadness)
C=input()
lst=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","v","w","x","y"]
print(lst[lst.index(C)+1])

### FIXED CODE ###

C=input()
lst=["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
print(lst[lst.index(C)+1])
if __name__=="__main__":
    # Problem A
    x = input()
    if x == x.upper()
        print("A")
    else:
        print("a")

### FIXED CODE ###

if __name__=="__main__":
    # Problem A
    x = input()
    if x == x.upper():
        print("A")
    else:
        print("a")
n = int(input())
c = n
for i in range(1, n//2+1):
  a = digitsum(i)
  b = digitsum(n-i)
  if c > a + b:
    c = a + b
print(c)

### FIXED CODE ###

n = int(input())
c = n
def digitsum(n):
  s = 0
  while n>0:
    s += n % 10
    n //= 10
  return s
for i in range(1, n//2+1):
  a = digitsum(i)
  b = digitsum(n-i)
  if c > a + b:
    c = a + b
print(c)
n = int(input())
card = {
    'S':[False for _ in range(13)],
    'H':[False for _ in range(13)],
    'C':[False for _ in range(13)],
    'D':[False for _ in range(13)]
}
for _ in range(n):
    mark, num = map(int, input().split())
    card[mark][num-1] = True

for mark in "SHCD":
    for num in range(13):
        if card[mark][num] is False:
            print(mark, num+1)



### FIXED CODE ###

n = int(input())
card = {
    'S':[False for _ in range(13)],
    'H':[False for _ in range(13)],
    'C':[False for _ in range(13)],
    'D':[False for _ in range(13)]
}
for _ in range(n):
    mark, num = input().split()
    num = int(num)
    card[mark][num-1] = True

for mark in "SHCD":
    for num in range(13):
        if card[mark][num] is False:
            print(mark, num+1)
N=int(input())
import collections
A=list(map(int,input().split()))

table=collections.defaultdict(int)
for x in A:
  table[x]+=1
table=list(table.items())
table=[table[i][0] for  i in range(N) if table[i][1]>1]
table.append(0)
table.append(0)
table.sort(reverse=True)
print(table[0]*table[1])
      

### FIXED CODE ###

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


dic = collections.defaultdict(int)

for x in A:
    dic[x] += 1

dic = list(dic.items())
dic = [x for x in dic if x[1] >= 2]
dic = sorted(dic, reverse=True, key=lambda x: x[0])

if len(dic) >= 2:
    if dic[0][1] >= 4:
        print(dic[0][0] * dic[0][0])
    else:
        print(dic[0][0] * dic[1][0])
else:
    print(0)
"""
C - Skip
Xを含めた与えられた数列をソートする
最小値を基準０にする
隣同士の差を取る
数列の最大公約数を求める
"""

import math
from functools import reduce

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

numbers = [X]
for part in input().split():
    numbers.append(int(part))

numbers.sort()

# 最小値を基準0とする（ノーマライズ）
min_num = min(numbers)
normal_numbers = []
for num in numbers:
    normal_numbers.append(num - min_num)

# 隣との距離を出す
dist_numbers = []
for i in range(1, len(normal_numbers)):
    # 重複なしで隣との距離を数える
    dist_temp = normal_numbers[i] - normal_numbers[i-1]
    if dist_temp not in dist_numbers:
        dist_numbers.append(dist_temp)

# 最大公約数を求める
def gcd_list(numbers):
    return reduce(math.gcd, numbers)

print(gcd_list(dist_numbers))

### FIXED CODE ###

"""
C - Skip
Xを含めた与えられた数列をソートする
最小値を基準０にする
隣同士の差を取る
数列の最大公約数を求める
"""

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

numbers = [X]
for part in input().split():
    numbers.append(int(part))

numbers.sort()

# 最小値を基準0とする（ノーマライズ）
min_num = min(numbers)
normal_numbers = []
for num in numbers:
    normal_numbers.append(num - min_num)

# 隣との距離を出す
dist_numbers = []
for i in range(1, len(normal_numbers)):
    # 重複なしで隣との距離を数える
    dist_temp = normal_numbers[i] - normal_numbers[i-1]
    if dist_temp not in dist_numbers:
        dist_numbers.append(dist_temp)

# 最大公約数を求める
def gcd(a, b):
    if b == 0:
        return a
    else:
        return gcd(b, a % b)

def gcd_list(numbers):
    if len(numbers) == 1:
        return numbers[0]
    elif len(numbers) == 2: 
        return gcd(numbers[0], numbers[1])
    else:
        return gcd(numbers[0], gcd_list(numbers[1:]))

print(gcd_list(dist_numbers))
S = input()
S.replace("dreamer", "").replace("eraser", "").replace("dream","").r
eplace("erase", "")
if len(S) == 0:
  print("YES")
else:
  print("NO")

### FIXED CODE ###

s=input().replace("eraser","").replace("erase","").replace("dreamer","").replace("dream","")
if s:
    print("NO")
else:
    print("YES")
n, T = map(int,input().split())
A=[]
for i in range(n):
  a = list(map(int,input().split()))
  if a[1]<=T:
    A.append(a[0])

if len(a)==0:
  print('TLE')
else:
  print(min(A))

### FIXED CODE ###

n,t=map(int, input().split())
A=[]
for i in range(n):
  a=list(map(int, input().split()))
  if a[1] <= t:
    A.append(a[0])
if len(A)==0:
  print('TLE')
else:
  print(min(A))
# encoding:utf-8
def main():
	n = int(input())
	nums = list(map(int, input().split()))

	counter = 0
	for i in range(n):
		if nums[i] == i + 1:
			nums[i], nums[i + 1] = nums[i + 1], nums[i]
			counter += 1

	print(counter)

if __name__ == '__main__':
	main()

### FIXED CODE ###

# encoding:utf-8
def main():
	n = int(input())
	nums = list(map(int, input().split()))

	counter = 0
	for i in range(n - 1):
		if nums[i] == i + 1:
			nums[i], nums[i + 1] = nums[i + 1], nums[i]
			counter += 1

	if nums[n - 1] == n:
		counter += 1

	print(counter)

if __name__ == '__main__':
	main()
if __name__ == "__main__":
    S = input()
    for i in range(0, len(S), 2):
        if len(S) >= 1 and S[i] == "h" and S[i+1] == "i":
            ret = "Yes"            
        else:
            ret = "No"
            print(ret)
            exit(0)
    print(ret)


### FIXED CODE ###


if __name__ == "__main__":
    S = input()
    if len(S) % 2 == 0:
        for i in range(0, len(S), 2):
            if S[i] == "h" and S[i+1] == "i":
                ret = "Yes"
            else:
                ret = "No"
                break
    else:
        ret = "No"
    print(ret)
s = input()
year = int(s[0:4])
month = int(s[5:7])

if yaer >= 2019 and month >= 5:
  print("TBD")
else:
  print("Heisei")

### FIXED CODE ###

s = input()
year = int(s[0:4])
month = int(s[5:7])
 
if year >= 2019 and month >= 5:
  print("TBD")
else:
  print("Heisei")
A, B = map(int,input().split())
print(B if A >= 13)
print(0 if A <= 5 else b//2)


### FIXED CODE ###

A, B = map(int,input().split())
if A >= 13:
    print(B)
elif A <= 5:
    print(0)
else:
    print(B//2)
n,w = map(int,input().split())
inf = float("inf")
dp = [[-inf]*(w+1) for _ in range(n+1)]
for j in range(w+1):
    dp[0][j] = 0
for i in range(n):
    s,t = map(int,input().split())
    for l in range(w+1):
        if l-s >=0:
            dp[i+1][l] = max(dp[i][l],dp[i][l-s]+t)
        else:
            dp[i+1][l] = dp[i][l]
print(dp[-1][w])        

### FIXED CODE ###

n,w = map(int,input().split())
ls = [list(map(int,input().split())) for _ in range(n)]
inf = float("inf")
dp = [[inf]*(100000+1) for _ in range(n+1)]
dp[0][0] = 0
ans = 0
for i in range(n):
    for v in range(100001):
        if v - ls[i][1] >= 0:
            dp[i+1][v] = min(dp[i][v],dp[i][v-ls[i][1]]+ls[i][0])
        else:
            dp[i+1][v] = dp[i][v]
for j in range(100001):
    if dp[n][j] <= w:
        ans = j
print(ans)
A=input()
  print('Yes' if A==sorted(A) else 'No')

### FIXED CODE ###

a, b, c=input()
print('Yes' if a==c else 'No')
N = int(input())
V = list(map(int,input().split()))
C = list(map(int,input().split()))
sa = 0

for i in range(N):
    if v[i] - c[i]>0:
        sa += v[i]-c[i]

print(sa)        
    

### FIXED CODE ###

A,B,T = map(int,input().split())
print(T//A*B)
n = int(input())
p = [int(input()) for i in range(n)]

p.sort()
print(sum(p) - int(a[-1]/2))

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]
print(int(max(a)*0.5+sum(a)-max(a)))
a, b, c=map(input().split(','))
print(a, b, c)

### FIXED CODE ###

a, b, c=input().split(',')
print(a, b,c)
N, K = map(int, input().split())
A = list(map(int, input().split()))

nums = A[:]

sum_n = sum(nums)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

divisors = sorted(list(make_divisors(sum_n)), reverse=True)
#print('DIV', divisors)


for d in divisors:
    mod_nums = list(map(lambda x: x%d, nums[:]))
    mod_nums = sorted(mod_nums)
    #print(mod_nums)
    x = 10**10
    for i in range(1, len(mod_nums)-1):
        if sum(mod_nums[:i]) == sum(list(map(lambda x: d-x, mod_nums[i:]))):
            x = sum(mod_nums[:i])
            break
    #print(d, x)
    if x <= K:
        ans = d
        break
            
        
        



print(ans)

### FIXED CODE ###

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

nums = A[:]

sum_n = sum(nums)

def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors

divisors = sorted(list(make_divisors(sum_n)), reverse=True)
#print('DIV', divisors)


for d in divisors:
    mod_nums = list(map(lambda x: x%d, nums[:]))
    mod_nums = sorted(mod_nums)
    #print(mod_nums)
    x = 10**10
    for i in range(0, len(mod_nums)+1):
        if sum(mod_nums[:i]) == sum(list(map(lambda x: d-x, mod_nums[i:]))):
            x = sum(mod_nums[:i])
            break
    #print(d, x)
    if x <= K:
        ans = d
        break
            
print(ans)
s = input()
mod = 10**9+7

init = [0 for i in range(13)]
if s[0] == '?':
  dp = [1] * 10 + [0] * 3
else:
  dp = [0 for i in range(13)]
  dp[int(s[0])] = 1

for c in s[1:]:
  d = init.copy()
  if c == '?':
    for i in range(13):
      for j in range(10):
        idx = (i * 10 + j) % 13
        d[idx] = (dp[i] + d[idx]) % mod 
  else :
    for i in range(13):
      idx = (i * 10 + int(c)) % 13
      d[idx] = (dp[i] + d[idx]) % mod
  dp = d.copy()
print(dp[5])


### FIXED CODE ###

def main():
    M=10**9+7
    r=tuple(tuple((j-k)*9%13for j in range(10))for k in range(13))
    d=[1]+[0]*12
    for c in input():
        if c > '9':
            d = [sum(d[j] for j in k)%M for k in r] 
        else:
            d = [d[(int(c)-k)*9%13] for k in range(13)]
    print(d[5])
main()
X,Y,A,B,C = map(int,input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
l = p[:X] + q[:Y]
l.sort()
for i in range(C):
    if r[i] > l[i]:
        l[i] = r[i]
print(sum(l))

### FIXED CODE ###

X,Y,A,B,C = map(int,input().split())
p = list(map(int, input().split()))
q = list(map(int, input().split()))
r = list(map(int, input().split()))

p.sort(reverse = True)
q.sort(reverse = True)
r.sort(reverse = True)
l = p[:X] + q[:Y]
l.sort()
for i in range(min(C,X+Y)):
    if r[i] > l[i]:
        l[i] = r[i]
print(sum(l))
n, y = map(int, input().split())

#.
ans = 0

#.
for i in range(n+1):
    for j in range(n+1):
        #.
        money = y - i*10000 - j*5000

        #.
        if money % 1000 != 0:
            continue

        #.
        if money / 1000 <= n - i - j:
            ans++

print(ans)

### FIXED CODE ###

def solve(args):
    n, y = args

    #.
    for i in range(n+1):
        for j in range(0, n-i+1):
            #.
            k = n - i - j

            #.
            if i*10000 + j*5000 + k*1000 == y:
                return "{} {} {}".format(i, j, k)

    return "-1 -1 -1"

print(solve(map(int, input().split())))
h,w=map(int,input().split())
if((h*w)%2):
    print((h*w)//2+1)
else:
    print((h*w)/2)
  


    

### FIXED CODE ###

import sys
h,w=map(int,input().split())
if(h==1 or w==1):
    print(1)
    sys.exit()
if((h*w)%2):
    print(int((h*w)//2+1))
else:
    print(int((h*w)//2))
n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  s=min(k,i)+1
  l+=[min(l[j]+abs(b-a[j])for j in range(s,i))]
print(l[-1])

### FIXED CODE ###

n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  l.append(min(l[j]+abs(b-a[j])for j in range(i-min(k,i),i)))
print(l[-1])
N = int(input())
# = map(int, input().split())
# = list(map(int, input().split()))
# = [int(input()) for i in range(N)]
# = [list(map(int, input().split())) for i in range(N)]
alpha = [chr(ord('a') + i) for i in range(26)]
name = []
number = []
a = 1
count = 0

while N//a > 0:
    a = a*26
    count += 1

a = a/26

for i in range(count):
    num = int(N//a)
    number.append(num)
    N = N - num*a
    a = a//26

print(number)

for i in range(count):
    if number[-i] == 0:
        for j in range(count-i-1):
            number[j] -= 1
        del number[0]
print(number)

for i in number:
    name.append(alpha[i-1])

result = "".join(name)
print(result)


### FIXED CODE ###

n = int(input())
ans = ''
while n > 0:
    n, r = divmod(n-1, 26)
    ans = chr(r+ord('a')) + ans
print(ans)
import sys

def main():
    input = sys.stdin.readline
    n = int(input())
    s = int(input())

    return ans


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


### FIXED CODE ###

import sys
from collections import defaultdict

def main():
    input = sys.stdin.readline
    N, A = map(int, input().split())
    X = [int(c) - A for c in input().split()]
    d = defaultdict(lambda: 0)

    for x in X:
        d_ = defaultdict(lambda: 0)
        for key in d.keys():
            d_[key + x] += d[key]

        for key in d_.keys():
            d[key] += d_[key]

        d[x] += 1

    return d[0]


if __name__ == '__main__':
    print(main())
abc = list(map(int,input().split()))
abc.sort()
pritn((abc[2]*10)+abc[1]+abc[0])

### FIXED CODE ###

abc = list(map(int,input().split()))
abc.sort()
print((abc[2]*10)+abc[1]+abc[0])
import numpy as np

ls = [int(input()) for _ in range(5)]


max_=0
for h in ls:
    if h%10 == 0:
        pass
    else:
        re =10-h
        if re>=max_:
            max_ = re

time = 0
for i in ls:
    if i%10 == 0:
        time += i
    else:
        time += (i//10+1)*10

time -= re

print(time)


### FIXED CODE ###

import numpy as np

ls = [int(input()) for _ in range(5)]


a=0
for h in ls:
    if h%10 == 0:
        pass
    else:
        re =(h//10+1)*10-h
        if re>=a:
            a = re


time = 0
for i in ls:
    if i%10 == 0:
        time += i
    else:
        time += (i//10+1)*10

time -= a
print(time)
N = int(input())
h = list(map(int, input().split()))

memo = [10**10 for _ in range(N+1)]

def dp(i):
    if i == 1:
        return 0
    elif i == 2:
        memo[i] = abs(h[i-2]-h[i-1])
        return memo[i]
    elif memo[i] < 10**10:
        return memo[i]
    else:
        memo[i] = min(
            dp(i-1) + abs(h[i-2]-h[i-1]),
            dp(i-2) + abs(h[i-3]-h[i-1]),
            dp(i-2) + abs(h[i-3]-h[i-2]) + abs(h[i-2]-h[i-1])
        )
        return memo[i]
print(dp(N))

### FIXED CODE ###

import sys

sys.setrecursionlimit(1000000)

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

memo = [10**10 for _ in range(N+1)]

def dp(i):
    if i == 1:
        return 0
    elif i == 2:
        memo[i] = abs(h[i-2]-h[i-1])
        return memo[i]
    elif memo[i] < 10**10:
        return memo[i]
    else:
        memo[i] = min(
            dp(i-1) + abs(h[i-2]-h[i-1]),
            dp(i-2) + abs(h[i-3]-h[i-1]),
            dp(i-2) + abs(h[i-3]-h[i-2]) + abs(h[i-2]-h[i-1])
        )
        return memo[i]
print(dp(N))
for i in range(10):
    s.append(int(input()))
s.sort()
for i in range(3):
    print(s[i])

### FIXED CODE ###

s=[]
for i in range(10):
    s.append(int(input()))
s.sort()
for i in range(3):
    print(s[9-i])
import heapq
import copy
  
N = int(input())
ab = [[] * (N + 1) for i in range(N + 1)]
E = [0] * (N - 1)
for i in range(N - 1):
  a, b = map(int, input().split())
  ab[a].append(b)
  ab[b].append(a)
  E[i] = [a, b]
#print(ab)

#xとyを根とする部分木の頂点の数を求める
size = [1] * (N + 1)
def dfs_depandsize(tree,v,p):
    for x in tree[v]:
        if x == p:
            continue
        size[v] += dfs_depandsize(tree,x,v)
    return size[v]
dfs_depandsize(ab, 1, -1)
#print(size)

#print(dfs(2, 3))
#(1 - (1/ 2) ** c) * (1 - (1/ 2) ** (N - c)) + 1
#上式を辺ごとに全て足し合わせたものがSの頂点の個数の期待値
#そこからN / 2を引けば求める期待値
#逆元を考える必要があるため、分母と分子に分けて考える

t = 2 ** N#分母
s = 0#分子
for i in range(N - 1):
  c = min(size[E[i][0]], size[E[i][1]])
  #print(c)
  s += (2 ** N + 1 - 2 ** (N - c) - 2 ** c) 
  
#辺の個数を数えたので、それに2 ** Nを足して、頂点の個数にする
#-1は空グラフをケア
s += 2 ** N - 1  
s -= N * 2 ** (N - 1)

#逆元計算
p = 10 ** 9 + 7
t_inv = pow(t, p-2, p)
ans = t_inv * s % p
print(ans)
  
    
    
    
    
    
    
  
  

### FIXED CODE ###

#解説方針#解法1
#https://qiita.com/ZhangChaoran/items/71fab0e4b8647a93d3a0
from collections import deque
from heapq import heappop, heappush
#標準入力
N = int(input())
MOD = 10 ** 9 + 7
L = [[] for i in range(N + 1)] #dfs用
for i in range(N - 1):
  a, b = map(int, input().split())
  L[a].append(b)
  L[b].append(a)

#木の探索
parent = [0] * (N + 1)
order = []
stack = [1]
while stack:
    x = stack.pop()
    order.append(x)  # 行きがけ順探索リスト
    for y in L[x]:
        if y == parent[x]:
            continue
        parent[y] = x  # 親ノードを記録
        stack.append(y)
#print(order, parent)

half = pow(2, MOD - 2, MOD)
power_inv = [1] * (N + 1)#2 ** N の逆元の集合
size = [1] * (N + 1)
for i, v in enumerate(order[::-1], 1):#iが1から
    p = parent[v]
    x = size[v]  # vの子孫ノード数（自分も含む）をとる
    size[p] += x  # 親にノード数を加算
    power_inv[i] = power_inv[i - 1] * half % MOD  # [1, 1/2, 1/4, ...]
#print(size)
# 辺iがSに含まれるための必要十分条件による辺の個数の期待値 
# (1 - (1/2) ** i)(1 - (1/2) ** (N - i))を展開して計算
# 根である1の頂点以外は、ある頂点とその親を結ぶ辺を考えた際
# i と N - i個の頂点に別れるので,size[2:]でOK
ans = sum((1 - power_inv[i] - power_inv[N - i] + power_inv[N]) %
          MOD for i in size[2:])  
#ans = sum((1 - (1/2) ** i- (1/2) ** (N - i) + (1/2) ** N) for i in size[2:])  
#print(ans)
ans += 1  # 木の頂点の個数は辺の個数+1
# -「すべての辺が含まれない、つまり空グラフの場合の誤加算」-N/2
ans -= power_inv[N] + N * power_inv[1]  
#ans -= N * power_inv[1]  
ans %= MOD

print(ans)
import sys,math
N,M = map(int,input().split())
a = []
cnt = 0
ans = 1
fi = []
fi.append(1)
fi.append(1)
fi.append(1)
for i in range(3,10*5+1):
    tmp = fi[i-1]+fi[i-2]
    fi.append(tmp)
for i in range(M):
    a.append(int(input()))
for i in range(N+1):
    if i in a:
        if cnt == 0:
            print(0)
            sys.exit()
        else:
            ans *= fi[cnt]
            cnt = 0
    else:
        cnt += 1
ans *= fi[cnt]

print(ans % 1000000007)

### FIXED CODE ###

import sys,math
N,M = map(int,input().split())
a = [int(input()) for i in range(M)]
b = set(a)
dp = [0] * (N+1)
mod = 10**9+7
for i in range(N,-1,-1):
    if i in b:
        continue
    elif i == N or i == N-1:
        dp[i] = 1
    else:
        dp[i] = (dp[i+1] + dp[i+2])%mod
print(dp[0])
n,m = map(int,input().split())

a = [[0 for i in range(n)] for j in range(m)]

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

b=[]
for i in range(m):
    b.append(int(input()))
    
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j]*b[j]
    print(c)

### FIXED CODE ###

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

a = [[0 for i in range(m)] for j in range(n)]

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

b=[]
for i in range(m):
    b.append(int(input()))
    
for i in range(n):
    c = 0
    for j in range(m):
        c += a[i][j]*b[j]
    print(c)
a,b = map(int,input().split())
if b > a:
    priant("unsafe")
elif a > b:
    print("safe")

### FIXED CODE ###

a,b = map(int,input().split())
if b >= a:
    print("unsafe")
elif a > b:
    print("safe")
import bisect
n,m=map(int, input().split())
l={}
for i in range(n):
    a,b=map(int, input().split())
    if not a in l:
        l[a]=[b]
    else:
        l[a].append(b)

res=0
target=[0]
for i in range(1,m+1):
    if i in l:
        for j in l[i]:
            bisect.insort_left(target, j)
    val=target.pop()
    res+=val
    #print(target, max(target))

print(res)

### FIXED CODE ###

import bisect
import array

n,m=map(int, input().split())
l={}
for i in range(n):
    a,b=map(int, input().split())
    if not a in l:
        l[a]=[b]
    else:
        l[a].append(b)

res=0
target=array.array('I', [])
for i in range(1,m+1):
    if i in l:
        for j in l[i]:
            bisect.insort_left(target, j)

    if not target:
        val=0
    else:
        val=target.pop()
    res+=val
    #print(target, max(target))

print(res)
A,B = map(int, input().split())

if A >= 13:
  print(B)
else if A > 5:
  print(B/2)
else :
  print(0)  

### FIXED CODE ###

A,B = map(int, input().split())
 
if A < 6:
  B = 0
elif (6 <= A) and (A < 13):
  B /= 2
else :
  pass
  
print(int(B))