Harryxun/stf_run huggingface dataset:
import numpy as np

n,q = map(int,input().split())
ab = [list(map(int,input().split())) for _ in range(n+q-1)]

matrix = np.zeros((n,n))
ans = np.zeros((n,n))

for i in range(n-1):
  matrix[ab[i][0]-1,ab[i][1]-1] = 1
#  matrix[ab[i][1]-1,ab[i][0]-1] = 1

for l in range(n):
  for m in range(n):
    if matrix[l][m]:
      for o in range(n):
        if matrix[m][o]:
          matrix[l][o] = 1
          
ans = np.zeros((n))

for j in range(n-1,n+q-1):
  ans[ab[j][0]-1] += ab[j][1]
  for k in range(n):
    if matrix[ab[j][0]-1][k] == 1:
      ans[k] += ab[j][1]
  

for p in range(n):
  print(int(ans[p]))

### FIXED CODE ###

a = int(input())
s = input()


if(a >= 3200):
    ans = s
else:
    ans = 'red'
    
print(ans)
N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
tmp = []

for i in range(N):
    r1 = X[i]
    for j in range(N):
        t = str(i)+str(j)
        if i == j or t in tmp or str(j)+str(i) in tmp:
            continue

        r2 = X[j]
        ls = [(r1[j] - r2[j])**2 for j in range(D)]
        res = math.sqrt(sum(ls))

        if res % 1 == 0:
            count += 1
        tmp.append(t)

print(count)

### FIXED CODE ###

import math

N, D = map(int, input().split())
X = [list(map(int, input().split())) for _ in range(N)]
count = 0
tmp = []

for i in range(N):
    r1 = X[i]
    for j in range(N):
        t = str(i)+str(j)
        if i == j or t in tmp or str(j)+str(i) in tmp:
            continue

        r2 = X[j]
        ls = [(r1[j] - r2[j])**2 for j in range(D)]
        res = math.sqrt(sum(ls))

        if res % 1 == 0:
            count += 1
        tmp.append(t)

print(count)
m = map(int,raw_input().split())
for i in range(1,len(m)+1)
 if(m[i-1]==0)
  break
 print"Case %d* %d",%(i,m[i-1])

### FIXED CODE ###

i=0

while True:
    a = int(input())
    if(a==0):
      break
    i = i+1
    print "Case %d: %d" %  (i,a)
n,ma,mb = map(int,input().split())
L = []
sa = 0
sb = 0
for i in range(n):
    a,b,c = map(int,input().split())
    sa += a
    sb += b
    L.append([a,b,c])
dp = [[[10000 for i in range(sa+1)] for i in range(sb+1)] for i in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    a = L[i][0]
    b = L[i][1]
    c = L[i][2]
    for j in range(sa+1):
        for k in range(sb+1):
            if j-a >= 0 and k-b >= 0:
                dp[i+1][j][k] = min(dp[i][j-a][k-b]+c,dp[i+1][j][k],dp[i][j][k])
            else:
                dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k])
k = max(ma,mb)
t = max(sa,sb)
cur = 1
ans = 10000
while k*cur <= t:
    ans = min(ans,dp[n][ma*cur][mb*cur])
    cur += 1
if ans == 10000:
    print(-1)
else:
    print(ans)


### FIXED CODE ###

n,ma,mb = map(int,input().split())
L = []
sa = 0
sb = 0
for i in range(n):
    a,b,c = map(int,input().split())
    sa += a
    sb += b
    L.append([a,b,c])
dp = [[[10000 for i in range(sb+1)] for i in range(sa+1)] for i in range(n+1)]
dp[0][0][0] = 0
for i in range(n):
    a = L[i][0]
    b = L[i][1]
    c = L[i][2]
    for j in range(sa+1):
        for k in range(sb+1):
            if j-a >= 0 and k-b >= 0:
                dp[i+1][j][k] = min(dp[i][j-a][k-b]+c,dp[i+1][j][k],dp[i][j][k])
            else:
                dp[i+1][j][k] = min(dp[i+1][j][k],dp[i][j][k])
k = max(ma,mb)
t = min(sa,sb)
cur = 1
ans = 10000
while k*cur <= t:
    ans = min(ans,dp[n][ma*cur][mb*cur])
    cur += 1
if ans == 10000:
    print(-1)
else:
    print(ans)
S=input()
T=input()
 
differnce=0
 
for i in range(len(S)):
  if S[i]!=T[i]
      difference +=1
 
print(difference)
 

### FIXED CODE ###

S=input()
T=input()
difference=0
for i in range(len(S)):
  if S[i]!=T[i]:
    difference+=1
print(difference)
import collections
N, K, L = map(int, input().split())
road = [{"Connected":[],"set":-1,"seen":False} for i in range(N)]
rail = [{"Connected":[],"set":-1,"seen":False} for i in range(N)]

def dfs(node, num): #深さ優先探索
    node["seen"] = True
    node["set"] = num
    for next_node in node["Connected"]:
        if next_node["seen"]:
            continue
        dfs(next_node, num)

for X in ((road, K), (rail, L)): #結合を入力
    for i in range(X[1]):
        p, q = map(int, input().split())
        X[0][p-1]["Connected"].append(X[0][q-1])
        X[0][q-1]["Connected"].append(X[0][p-1])

for X in [road, rail]: #探索して連結成分に分解
    set_index = 0
    for x in X:
        if x["seen"]:
            continue
        dfs(x, set_index)
        set_index += 1
        
List = [(road[i]["set"],rail[i]["set"]) for i in range(N)]
counter = collections.Counter(List)
for A in List:
    print(counter[A],end=" ")
        


### FIXED CODE ###

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

def fp(x, parentList): #findParent
    if parentList[x] == x:
        return x
    else:
        parentList[x] = fp(parentList[x], parentList)
        return parentList[x]

#各ノードのparentをリストで表現(連結前は自身がparent)
road = [i for i in range(N)]
rail = [i for i in range(N)]

for _ in range(K):
    p, q = map(int, input().split())
    par_p, par_q = fp(p-1, road), fp(q-1, road) #p, qのparent 
    #連結する際、若い番号をparentとする
    if par_p < par_q:
        road[par_q] = par_p
    else:
        road[par_p] = par_q

#railについても同様
for _ in range(L):
    s, t = map(int, input().split())
    par_s, par_t = fp(s-1, rail), fp(t-1, rail)
    if par_s < par_t:
        rail[par_t] = par_s
    else:
        rail[par_s] = par_t

#連結成分の要素をカウント
cnt = {}
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    if key in cnt:
        cnt[key] += 1
    else:
        cnt[key] = 1
#出力
for i in range(N):
    key = (fp(i,road),fp(i,rail))
    ans = cnt[key]
    print(ans, end=" ")
ans = float("inf")
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    for k in mokuhyo:
        if k < x:
            break
        else:
            ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)        

### FIXED CODE ###

n,m,x = map(int,input().split())
c = list(list(map(int,input().split())) for _ in range(n))
ans = 10**7
for i in range(1<<n):
    mokuhyo = [0]*m
    cost = 0
    for j in range(n):
        if i>>j&1:
            for r in range(m):
                mokuhyo[r] += c[j][r+1]
            cost += c[j][0]
    if all(k>=x for k in mokuhyo):
        ans = min(ans, cost)
print("-1" if ans == 10**7 else ans)
s=input().split()
l=[]
for i in range(1,len(s)):
  l.append(int(s[i])-int(s[i-1]))
l.sort()
m=l[-1]
for i in range(2,len(s)+1):
  if l[-i]!=m:
    break
print(i-1)

### FIXED CODE ###

n=int(input().split()[0])
s=input().split()
l=[0 for i in range(n)]
m=[0 for i in range(n)]
M=[0 for i in range(n)]
for i in range(n):
  l[i]=int(s[i])
m[0]=l[0]
M[0]=l[-1]
for i in range(1,n):
  m[i]=min(m[i-1],l[i])
  M[i]=max(M[i-1],l[-i-1])
M.reverse()
d=[M[i]-m[i] for i in range(n)]
ma=max(d)
memo=-1
cnt=0
for i in range(n):
   if d[i]==ma and m[i]!=memo:
      cnt+=1
      memo=m[i]
print(cnt)
import sys

def findminsum(lst,K,N):
    inf=10**10
    dp=[[inf]*N for s in range(K+1)]
    for s in range(K+1):
        for j in range(N):
            if j==0 and s<=lst[j]
                ds[s][j]=lst[0]
            elif s>lst[j] and j>0:
                dp[s][j]=min(dp[s-lst[j]][j-1]+lst[j], dp[s][j-1])
            elif s<=lst[j] and j>0:
                dp[s][j]=min(lst[j],dp[s][j-1])
    # print(lst)
    # print(dp[0][:])
    # print(dp[1][:])
    # print(dp[K][:])
    return dp[K][N-1]

def main():
    N,K=map(int,sys.stdin.readline().strip().split())
    cards=list(map(int,sys.stdin.readline().strip().split()))
    cards.sort()
    nn=0
    for i in range(N):
        if cards[i]<K:
            c=cards[i]
            cards[i]=0
            if findminsum(cards,K-c,N)>=K:
                nn+=1
            cards[i]=c
        else:
            break
    print(nn)

if __name__=='__main__':
    main()


### FIXED CODE ###

#4 9
#1 3 5 6
#の時に1（正解は0）と出力されるがACになる

N, K = map(int, input().split())
a=list(map(int, input().split()))
a.sort()
ans = N
t = 0
for i in range(N-1, -1, -1) :
  if t+a[i] < K:
    t += a[i]
  else:
    ans = min(ans, i)
print(ans)
import sys
from itertools import combinations_with_replacement
from numba import njit


@njit('(i8,i8,i8[:,:])')
def solve(n, m, query):
    li = [i for i in range(1, m + 1)]
    max_point: int = 0
    for a in combinations_with_replacement(li, n):
        point = 0
        for qer in query:
            if a[qer[1] - 1] - a[qer[0] - 1] == qer[2]:
                point += qer[3]
        if point > max_point:
            max_point = point
    print(max_point)


def main():
    input = sys.stdin.buffer.readline
    n, m, q = map(int, input().split())
    query = [list(map(int, input().split())) for _ in range(q)]
    solve(n, m, query)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
from itertools import combinations_with_replacement


def main():
    input = sys.stdin.buffer.readline
    n, m, q = map(int, input().split())
    query = [list(map(int, input().split())) for _ in range(q)]
    li = [0] * m
    for i in range(1, m + 1):
        li[i - 1] = i
    max_point = 0
    for a in combinations_with_replacement(li, n):
        point = 0
        for qer in query:
            if a[qer[1] - 1] - a[qer[0] - 1] == qer[2]:
                point += qer[3]
        if point > max_point:
            max_point = point
    print(max_point)


if __name__ == '__main__':
    main()
N, M, C = map(int, input().split())
Blis = [int(x) for x in input().split()]
Alis = []*N
k = 0
for i in range(N):
  Alis[i] = [int(x) for x in input().split()]
for i in range(N):
  total = 0
  for j in range(M):
    total = total + (Alis[i][j])*(Blis[i][j])
  total = total + C
  if total > 0:
    k = k + 1
print(k)   

### FIXED CODE ###

N, M, C = map(int, input().split())
Blis = [int(x) for x in input().split()]
k = 0
for i in range(N):
  Alis = [int(x) for x in input().split()]
  total = 0
  for j in range(M):
    total = total + (Alis[j])*(Blis[j])
  total = total + C
  if total > 0:
    k = k + 1
print(k)
a,b,c,d=map(int,input().split())
import math


lcm=int(c*d/math.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))


### FIXED CODE ###

a,b,c,d=map(int,input().split())
import fractions


lcm=int(c*d/fractions.gcd(c,d))

cc=b//c-(a-1)//c
dd=b//d-(a-1)//d
cd=b//lcm-(a-1)//lcm

print((b-a+1)-(cc+dd-cd))
a, b = list(map(int, input().split()))
print(max(a+b, max(a-b, a*b))

### FIXED CODE ###

a, b = list(map(int, input().split()))
print(max(a+b, max(a-b, a*b)))
import math
a,b,x = map(int,input().split())
c = (2*x)/(a*b)
if c <= a:
    d_squared = b**2+c**2
    d = math.sqrt(b**2+c**2)
    cosB = (c**2+d_squared-b**2)/(2*c*d)
    acosB = math.degrees(math.acos(cosB))
    ans = acosB
else:
    c = 2*x/a**2-b
    c2 = b-c
    d_squared = a**2+c2**2
    d = math.sqrt(a**2+c2**2)
    cosA = (c2**2+d_squared-a**2)/(2*c2*d)
    acosA = math.degrees(math.acos(cosA))
    ans = acosA
    ans = 90-acosA
print(ans)

### FIXED CODE ###

import math
a,b,x = map(int,input().split())
full = a*a*b
ans = 0
if x == full:
    ans = 0
elif x<=full/2:
    c = (2*x)/(a*b)
    d = math.sqrt(b**2+c**2)
    cosB = (c**2+d**2-b**2)/(2*c*d)
    acosB = math.degrees(math.acos(cosB))
    ans = acosB
else:
    c = 2*x/a**2-b
    c2 = b-c
    d = math.sqrt(a**2+c2**2)
    cosA = (c2**2+d**2-a**2)/(2*c2*d)
    acosA = math.degrees(math.acos(cosA))
    ans = 90-acosA
print(ans)
N = list(input())
if len(N) == 1:
    print(int(N))
else:
    print((len(N) - 1) * 9 + (int(N[0]) - 1))


### FIXED CODE ###

n = input()
n_length = len(n)

ans = -1
if int(n) < 10:
    ans = int(n)
else:
    flg = True
    for i in range(1, n_length):
        if n[i] != '9':
            flg = False
            break
    if flg:
        ans = sum(map(int, list(n)))
    else:
        ans = 9 * (n_length - 1) + int(n[0]) - 1
print(ans)
from heapq import heappop, heappush

INF = 10 ** 20

xs, ys, xt, yt = map(int, input().split())
N = int(input())
circle = [list(map(int, input().split())) for _ in range(N)]
circle = [[xs, ys, 0]] + circle + [[xt, yt, 0]]
edges_lst = [[] for _ in range(N + 2)]
for i, (x1, y1, r1) in enumerate(circle):
    for j, (x2, y2, r2) in enumerate(circle[i + 1:]):
        j += i + 1
        d = ((x2 - x1) ** 2 + (y2 - y1) ** 2) ** .5
        dist = max(0, d - r1 - r2)
        edges_lst[i].append((j, dist))
        edges_lst[j].append((i, dist))

def dijkstra():
    que = []
    heappush(que, (0, 0))
    dist_lst = [INF] * (N + 2)
    dist_lst[0] = 0
    while que:
        dist, node = heappop(que)
        for to, cost in edges_lst[node]:
            if dist_lst[to] > cost + dist:
                dist_lst[to] = cost + dist
                heappush(que, (cost + dist, to))
    return dist_lst[-1]

print('{:.10f}'.format(dijkstra()))

### FIXED CODE ###

n, x = map(int, input().split())
a = list(map(int, input().split()))
b = [v if v < x else x for v in a]
for i in range(1, n):
    if b[i - 1] + b[i] > x:
        b[i] = x - b[i - 1]
print(sum(i - j for i, j in zip(a, b)))
import collections
def 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)
    countA = 0
    countB = 0
    ans = 0
    i = 0
    for j in range(X):
        if j < C:
            if p[j] > r[i]:
                countA += 1
                ans += p[j]
            else:
                ans += r[i]
                i += 1
        else:
            ans += p[j]
            countA += 1
    for j in range(Y):
        if j < C:
            if q[j] > r[i]:
                countB += 1
                ans += q[j]
            else:
                ans += r[i]
                i += 1
        else:
            ans += q[j]
            countB += 1
    return ans


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

### FIXED CODE ###

import collections
def 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)

    p = p[:X]
    q = q[:Y]
    pqr = p + q + r
    pqr.sort(reverse = True)
    return sum(pqr[:X+Y])




if __name__ == '__main__':
    # main()
    print(main())
N = int(input())
D = [int(i) for i in input().split()]
Dlist = [0]*(max(D))
for d in D:
    Dlist[d-1] += 1

M = int(input())
T = [int(i) for i in input().split()]
Tlist = [0]*(max(T))
for t in T:
    Tlist[t-1] += 1

flag = True

for i in range(len(Tlist)):
    if Tlist[i] > Dlist[i]:
        flag = False
        break


if flag:
    print('YES')
else:
    print('NO')


### FIXED CODE ###

from collections import Counter
N = int(input())
D = [int(i) for i in input().split()]
M = int(input())
T = [int(i) for i in input().split()]

cD = Counter(D)

for t in T:
    if cD.get(t,0) == 0:
        print('NO')
        exit()
    else:
        cD[t] -= 1

print("YES")
def main():
    N, M = map(int, input().split())
    H_list = [int(_) for _ in input().split()]

    # iso_list = []
    index_list = []
    for m in range(M):
        A, B = map(int, input().split())
        if H_list[A-1] > H_list[B-1]:
            index_list.append(B-1)
        elif H_list[A-1] < H_list[B-1]:
            index_list.append(A-1)
        elif H_list[A-1] == H_list[B-1]:
            index_list.append(A-1)
            index_list.append(B-1)
        # iso_list.append(A)
        # iso_list.append(B)        

    index_list = list(set(index_list))
    for i in index_list:
        del H_list[i]        

    # iso_list = list(set(iso_list))
    # iso_list = len(H_list - iso_list)
    
    # out = iso_list + 
    out = len(H_list)
    print(out)
main()

### FIXED CODE ###

N, M = map(int, input().split())
H = [0] + list(map(int, input().split()))
O = [0] + [1] * N
for _ in range(M):
    A, B = map(int, input().split())
    if H[A] <= H[B]:
        O[A] = 0
    if H[A] >= H[B]:
        O[B] = 0
print(sum(O))
import sys
sys.setrecursionlimit(4100000)

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

to = [[] for i in range(N)]
block = [[] for i in range(N)]
sets = []

is_visited = [False] * N
graph_g = [None] * N
graph_cnt = -1

def dfs(s, g):
    global graph_cnt
    if is_visited[s]:
        return graph_g[s]

    is_visited[s] = True
    if g == None:
        graph_cnt += 1
        graph_g[s] = graph_cnt
    else:
        graph_g[s] = g

    for edge in to[s]:
        dfs(edge, graph_cnt)


for i in range(M):
    A, B = map(int, input().split())
    to[A-1].append(B-1)
    to[B-1].append(A-1)

for i in range(K):
    C, D = map(int, input().split())
    block[C-1].append(D-1)
    block[D-1].append(C-1)

for i in range(N):
    if is_visted[i]:
        continue
    dfs(i, None)

group_to_idx = [set() for i in range(graph_cnt+1)]
if len(group_to_idx) != 0:
    for i in range(N):
        group_to_idx[graph_g[i]].add(i)

ret = []
for i in range(N):
    cand = len(group_to_idx[graph_g[i]])
    fri = len(to[i])
    tmp_block = len(group_to_idx[graph_g[i]] & set(block[i]))

    tmp_ret = cand - fri - tmp_block - 1
    ret.append(tmp_ret)

print(*ret)

### FIXED CODE ###

import sys
sys.setrecursionlimit(4100000)

from collections import Counter

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

to = [[] for i in range(N)]
block = [[] for i in range(N)]
sets = []

is_visited = [False] * N
graph_g = [None] * N
graph_cnt = -1

def dfs(s, g):
    global graph_cnt
    if is_visited[s]:
        return 0

    is_visited[s] = True
    if g == None:
        graph_cnt += 1
        graph_g[s] = graph_cnt
    else:
        graph_g[s] = g

    for edge in to[s]:
        if graph_g[edge] == None:
            dfs(edge, graph_cnt)


for i in range(M):
    A, B = map(int, input().split())
    to[A-1].append(B-1)
    to[B-1].append(A-1)

for i in range(N):
    if is_visited[i]:
        continue
    dfs(i, None)

for i in range(K):
    C, D = map(int, input().split())
    if graph_g[C-1] == graph_g[D-1]:
        block[C-1].append(D-1)
        block[D-1].append(C-1)

ct = Counter(graph_g)

ret = []
for i in range(N):
    cand = ct[graph_g[i]]
    fri = len(to[i])
    tmp_block = len(block[i])

    tmp_ret = cand - fri - tmp_block - 1
    ret.append(tmp_ret)

print(*ret)
nd = input().split()
N = int(nd[0])
D = int(nd[1])

ans = 0

for i in range(N-1):
    xy = input().split()
    x = int(xy [2*i])
    y = int(xy [2*i+1])
    d = x**2 + y**2
    if d < D:
        ans += 1

print(ans)

### FIXED CODE ###

nd = input().split()
N = int(nd[0])
D = int(nd[1])
D = D**2

ans = 0

for i in range(N):
    ls = input().split()
    x = int(ls[0])
    y = int(ls[1])
    d = x**2 + y**2
    if d <= D :
        ans += 1

print(ans)
import sys
import collections

sys.setrecursionlimit(1e7)

def dfs(node, parent, distance):
    depth[node] = distance
    for next_node, cost in Tree[node]:
        if next_node != parent:
            dfs(next_node, node, distance + cost)

N = int(input())

Tree = collections.defaultdict(list)

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

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

depth = {}
dfs(k, -1, 0)

for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])


### FIXED CODE ###

import sys
import collections

sys.setrecursionlimit(int(1e7))

def dfs(node, parent, distance):
    depth[node] = distance
    for next_node, cost in Tree[node]:
        if next_node != parent:
            dfs(next_node, node, distance + cost)

N = int(input())

Tree = collections.defaultdict(list)

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

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

depth = {}
dfs(k, -1, 0)

for i in range(q):
    x, y = map(int, input().split())
    print(depth[x] + depth[y])
from itertools import accumulate

N = int(input())
count = [0 for i in range(N+1)]
count[0] += 1
for i in accumulate([int(x) for x in input().split()]):
    count[i] += 1
ans = 0
for i in count:
    ans += (i*(i-1)) // 2
print(ans)


### FIXED CODE ###

from itertools import accumulate

N = int(input())
count = {}
count.setdefault(0, 1)
for i in accumulate([int(x) for x in input().split()]):
    count.setdefault(i, 0)
    count[i] += 1
ans = 0
for i in count.values():
    ans += (i*(i-1)) // 2
print(ans)
n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(n)]
mi=1
ma=n
for i in range(n):
  mi=max(mi,a[i][0])
  ma=min(ma,a[i][1])

if mi>ma:
  print("0")
else:
  print(ma-mi+1)



### FIXED CODE ###

n,m=map(int,input().split())
a=[list(map(int,input().split())) for _ in range(m)]
mi=1
ma=n
for i in range(m):
  mi=max(mi,a[i][0])
  ma=min(ma,a[i][1])

if mi>ma:
  print("0")
else:
  print(ma-mi+1)
# -*- coding: utf-8 -*-

h, w, k = map(int, input().split())

ptn = [[0] * (w + 2) for _ in range(w + 2)]
for i in range(w + 2):
    for j in range(w + 2):
        if i == 0 or i == w or j == 0 or j == w:
            continue
        if abs(i - j) <= 1:
            ptn[i][j] = 1


def f(x):
    l = [1, 2, 3, 5, 7, 13, 19]
    if 0 <= x < 7:
        return l[x]
    else:
        return 1


for _ in range(h - 1):
    temp = [[0] * (w + 2) for _ in range(w + 2)]
    for i in range(w + 2):
        for j in range(w + 2):
            if i == 0 or i == w or j == 0 or j == w:
                continue
            else:
                temp[i][j] = ptn[i-1][j]*f(i-3)*f(w-i-1) + ptn[i][j]*f(i-2)*f(w-i-1) + ptn[i+1][j]*f(i-2)*f(w-i-2)

    ptn = temp

print(ptn[1][k])


### FIXED CODE ###

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

h, w, k = map(int, input().split())


def f(x):
    lst = [1, 2, 3, 5, 8, 13, 21]
    if 0 <= x < 7:
        return lst[x]
    else:
        return 1


ptn = [[0] * (w + 2) for _ in range(w + 2)]
for i in range(w + 2):
    for j in range(w + 2):
        if i == 0 or i == w + 1 or j == 0 or j == w + 1:
            continue
        elif i == j:
            ptn[i][j] = f(i-2)*f(w-i-1)
        elif i == j + 1:
            ptn[i][j] = f(i-3)*f(w-i-1)
        elif i == j - 1:
            ptn[i][j] = f(i-2)*f(w-i-2)

for _ in range(h - 1):
    temp = [[0] * (w + 2) for _ in range(w + 2)]
    for i in range(w + 2):
        for j in range(w + 2):
            if i == 0 or i == w + 1 or j == 0 or j == w + 1:
                continue
            else:
                temp[i][j] = ptn[i-1][j]*f(i-3)*f(w-i-1) + ptn[i][j]*f(i-2)*f(w-i-1) + ptn[i+1][j]*f(i-2)*f(w-i-2)

    ptn = temp

print(ptn[1][k] % 1000000007)