Harryxun/stf_run huggingface dataset:
import sys
input = sys.stdin.readline
import numpy as np

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * (n+1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

N, M, K  = (int(i) for i in input().split())

#graph = np.zeros((N+1, N+1))
#graph2 = [[0] * (N+1) for i in range(N+1)]
uf = UnionFind(N)
fblist = [0] * (N+1)

for i in range(M):
    A, B =  (int(i) for i in input().split())
    uf.union(A, B)
    fblist[A] += 1
    fblist[B] += 1
 
for j in range(K):
    A, B =  (int(i) for i in input().split())
    fblist[A] += 1
    fblist[B] += 1

for i in range(1, N+1):
    print(uf.size(i) - fblist[i] - 1, end=" ")

print()


### FIXED CODE ###

import sys
input = sys.stdin.readline

class UnionFind:
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * (n+1)

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return 
        if self.parents[x] > self.parents[y]:
            x, y = y, x
        
        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

    def same(self, x, y):
        return self.find(x) == self.find(y)

N, M, K  = (int(i) for i in input().split())

#graph = np.zeros((N+1, N+1))
#graph2 = [[0] * (N+1) for i in range(N+1)]
uf = UnionFind(N)
fblist = [0] * (N+1)

for i in range(M):
    A, B =  (int(i) for i in input().split())
    uf.union(A, B)
    fblist[A] += 1
    fblist[B] += 1
 
for j in range(K):
    A, B =  (int(i) for i in input().split())
    if uf.same(A, B):
        fblist[A] += 1
        fblist[B] += 1

for i in range(1, N+1):
    print(uf.size(i) - fblist[i] - 1, end=" ")

print()
A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print(Yes)
else:
    print(No)


### FIXED CODE ###

A,B,C = (int(_) for _ in input().split())

if A == B and B == C:
    print('Yes')
else:
    print('No')
import numpy as np
N, K = map(int,input().split())
A = list(map(int,input().split()))

num_max = max(A)
npA = np.sort(A)
npA_fi = np.insert(npA,0,0)
npA_en = np.insert(npA,N,0)
diff = npA_en[1:N] - npA_fi[1:N]

diff_min = np.min(diff)
i = 0
if K > num_max:
    print('IMPOSSIBLE')
    exit()
while np.max(npA) >= K:
    if K in npA:
        print('POSSIBLE')
        exit()
    else:
        npA -= diff_min

print('IMPOSSIBLE')


### FIXED CODE ###

def gcd(a,b):
    if b == 0:
        return abs(a)
    else:
        return gcd(b, a%b)

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

Im = 'IMPOSSIBLE'
Po = 'POSSIBLE'

if max(A) < K:
    print(Im)
else:
    for i in range(N):
        if i == 0:
            tmp = gcd(A[i], 0)
        else:
            tmp = gcd(A[i],tmp)
        if tmp == 1:
            break
    if K%tmp == 0:
        print(Po)
    else:
        print(Im)
K= int(input())
A, B = map(int, input().split())
i = 0
while A <= B:
  if A / K == A // K:
    i = i + 1
    A = A + 1
  else:
    i = i + 0
    A = A + 1
    
if i = 0:
  print("NG")
else:
  print("OK")

### FIXED CODE ###

K= int(input())
A, B = map(int, input().split())
i = 0
while A <= B:
  if A / K == A // K:
    i = i + 1
    A = A + 1
  else:
    i = i + 0
    A = A + 1
    
if i == 0:
  print("NG")
else:
  print("OK")
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)

def dijkstra(s,n,cost,l):
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    
    while True:
        v = -1
        for i in range(n):
            if (not used[i]) and (v == -1):
                v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
            break
        used[v] = True
        dist_v = d[v]
        for j in range(n):
            weight = cost[v][j]
            alt = dist_v + weight
            r = (dist_v - 1) // l
            if (r != ((alt - 1) // l) and dist_v != 0:
                alt = (r + 1) * l + weight         
            d[j] = min(d[j],alt)
    return d
 
n,m,l = map(int, input().split())
abc = [list(map(int, input().split())) for i in range(m)]
q = int(input())
st = [list(map(int, input().split())) for i in range(q)]
path = [[float("inf") for i in range(n)] for i in range(n)]
ans_list = []
for i in abc:
  a,b,cost = i[0]-1, i[1]-1, i[2]
  if cost <= l:
    path[a][b] = cost
    path[b][a] = cost
for s in range(n):
  ans_list.append(dijkstra(s,n,path,l))
for i in st:
  s, t = i[0] - 1, i[1] - 1
  ans = ans_list[s][t]
  if ans == float("inf"):
    ans = -1
  else:
    ans = (ans - 1) // l
  print(ans)


### FIXED CODE ###

import sys
input = sys.stdin.readline

def dijkstra(s,n,cost,l):
    d = [float("inf")] * n
    used = [False] * n
    d[s] = 0
    
    while True:
        v = -1
        for i in range(n):
            if (not used[i]) and (v == -1):
                v = i
            elif (not used[i]) and d[i] < d[v]:
                v = i
        if v == -1:
            break
        used[v] = True
        dist_v = d[v]
        for j, weight in enumerate(cost[v]):
            alt = dist_v + weight
            r = (dist_v - 1) // l
            if r != ((alt - 1) // l) and dist_v != 0:
                alt = (r + 1) * l + weight         
            d[j] = min(d[j],alt)
    return d

n,m,l = map(int, input().split())
path = [[float("inf") for i in range(n)] for i in range(n)]
ans_list = []
for i in range(m):
  a,b,cost = map(int, input().split())
  a -= 1
  b -= 1
  if cost <= l:
    path[a][b] = cost
    path[b][a] = cost
for s in range(n):
  ans_list.append(dijkstra(s,n,path,l))
q = int(input())

for i in range(q):
  s,t = map(int, input().split())
  ans = ans_list[s-1][t-1]
  if ans == float("inf"):
    ans = -1
  else:
    ans = (ans - 1) // l
  print(ans)
def(S):

  list = S.split("/")
  y = int(list[0])
  m = int(list[1])
  d = int(list[2])

  if (y > 2019):
      print("TBD")
  elif (y < 2019):
      print("Heisei")
  elif (m > 4):
      print("TBD")
  elif (m <= 4):
      print("Heisei")

### FIXED CODE ###

list = input().split("/")
y = int(list[0])
m = int(list[1])

if (y>=2019 and m>=5):
    print("TBD")
else:
    print("Heisei")
N = int(input())
a = list(map(int,input().split()))

if(N%2 == 0):
  N = (N/2)
else:
  N = int(N/2)+1
count = 0
for i in range(1,N+1):
  if(a[(2*i-1)-1]%2 == 1):
    count += 1
print(count)

### FIXED CODE ###

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

if(N%2 == 0):
  N = int(N/2)
else:
  N = int(N/2)+1
count = 0
for i in range(1,N+1):
  if(a[(2*i-1)-1]%2 == 1):
    count += 1
print(count)
N = int(input())
a = list(int(input()) for _ in range(N)))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')

### FIXED CODE ###

N = int(input())
a = list(int(input()) for _ in range(N))
print('second' if all(a[i] % 2 == 0 for i in range(N)) else 'first')
n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for in a]
    cnt += 1
print(cnt)


### FIXED CODE ###

n = input()
a = list(map(int, input().split()))
cnt = 0
while all(i%2==0 for i in a):
    a = [i/2 for i in a]
    cnt += 1
print(cnt)
result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,5):
            if k%(10**j)==3:
                result.append(i)
                break
            else:
                k=k//10**j
        else:
            continue

### FIXED CODE ###

n=int(input())
 
result=[]
for i in range(1,n+1):
    if i %3==0:
        result.append(i)
    else:
        k=i
        for j in range(1,5):
            if k%10==3:
                result.append(i)
                break
            else:
                k=k//10
        else:
            continue
 
print("",*result)
a = list(map(int, input().split()))

b = a.sort()
print(b)
print("Yes" if b[0]+b[1] == b[2] else "No")


### FIXED CODE ###

a, b, c = sorted(map(int, input().split()))
print("Yes" if a+b == c else "No")
S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)


### FIXED CODE ###

S = input()

ame = 0
if S[0] =="R":
    ame = 1
    if S[1] == "R":
        ame = 2
        if S[2] == "R":
            ame = 3
else:
    if S[1] == "R":
        ame = 1
        if S[2] == "R":
            ame = 2
    elif S[2] == "R":
        ame = 1
print(ame)
from functools import lru_cache

H,N = [int(i) for i in input().rstrip().split(' ')]
M = [[int(i) for i in input().rstrip().split(' ')] for _ in range(N)]
#print(*M, sep='\n') #配列開業表示の仕方

@lru_cache(maxsize=None)
def DP(hp):
    global M
    if hp <= 0:
        return 0
    res = min([DP(hp-a)+b for a,b in M])
    return res

print(DP(H))

### FIXED CODE ###

from functools import lru_cache
import sys

H,N = [int(i) for i in input().rstrip().split(' ')]
M = [[int(i) for i in input().rstrip().split(' ')] for _ in range(N)]

sys.setrecursionlimit(10**9)
DP = [0]*(H+1)

for x in range(1,H+1):
    DP[x] = min(DP[max(x-a,0)] + b for a,b in M)

print(DP[H])
def main():
  n = int(input())
  As = map(int, input().split())
  Bs = map(int, input().split())

  diffs = [a - b for a, b in zip(As, Bs)]
  positives = list(sorted(filter(lambda x: x>0, diffs), reverse=True))
  negatives = list(sorted(filter(lambda x: x<0, diffs)))
  max_i = -1
  for neg in negatives:
    for i, pos in enumerate(positives):
      neg += pos
      max_i = max(i, max_i)
      if neg >= 0:
        positives[i] = neg
        break
      else:
        positives[i] = 0
  if negatives[-1] < 0:
    print(-1)
    return
  print(len(negatives) + max_i + 1)


if __name__ == '__main__':
  main()


### FIXED CODE ###

from itertools import accumulate


def main():
  n = int(input())
  As = map(int, input().split())
  Bs = map(int, input().split())

  diffs = [a - b for a, b in zip(As, Bs)]
  pos_acc = list(accumulate(sorted(filter(lambda x: x>0, diffs), reverse=True)))
  negatives = list(filter(lambda x: x<0, diffs))
  neg_sum = abs(sum(negatives))
  num_negs = len(negatives)
  if num_negs == 0:
    print(0)
    return
  for i, pa in enumerate(pos_acc):
    if neg_sum <= pa:
      print(num_negs + i + 1)
      return
  print(-1)


if __name__ == '__main__':
  main()
N, M = map(int, input().split())
A = [int(input()) for i in range(M)]
A.append(N+1)

import math
def fibonacci(n):
    a = 1/math.sqrt(5) * (((1+math.sqrt(5))/2)**n - ((1-math.sqrt(5))/2)**n)
    return(int(a))

ans = 1
t1 = 0
a_ind = 0
for i in range(N+1):
    if i == A[a_ind] or i == N:
        t2 = A[a_ind]
        ans *= fibonacci(t2-t1)
        t1 = A[a_ind]+1
        a_ind =min(a_ind+1, len(A)-1)
print(ans%1000000007)

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(input()) for i in range(M)]
A.append(N+1)

#import math
def fibonacci(n):
    #a = 1/math.sqrt(5) * (((1+math.sqrt(5))/2)**n - ((1-math.sqrt(5))/2)**n)
    if n <= 0:
        a = 0
    elif n<=2:
        a =1
    else:
        a0=1
        a1=1
        for i in range(3,n+1):
            a = a0 + a1
            a0 = a1
            a1 = a
    return(int(a))

ans = 1
t1 = 0
a_ind = 0
for i in range(N+1):
    if i == A[a_ind] or i == N:
        t2 = A[a_ind]
        ans *= fibonacci(t2-t1)
        t1 = A[a_ind]+1
        a_ind =min(a_ind+1, len(A)-1)
print(ans%1000000007)
n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[1]*n
for i in range(m):
  a,b=map(int,input().split())
    if h[a-1]<h[b-1]:
         final[a-1]=0
    elif h[a-1]>h[b-1]:
         final[b-1]= 0
    else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))


### FIXED CODE ###

n,m=map(int,input().split())
h=list(map(int,input().split()))
final=[1]*n
for i in range(m):
  a,b=map(int,input().split())
  if h[a-1]<h[b-1]:
         final[a-1]=0
  elif h[a-1]>h[b-1]:
         final[b-1]=0
  else:
         final[a-1]=0
         final[b-1]=0

print(sum(final))
n, m = map(int, input().split())
path = list(list(map(int, input().split())) for _ in range(m))

dic = dict()
for i in range(m):
    p = path[i]
    if p[0] not in dic:
        dic[p[0]] = [p[1]]
    else:
        dic[p[0]].append(p[1])
    if p[1] not in dic:
        dic[p[1]] = [p[0]]
    else:
        dic[p[1]].append(p[0])
        
table = [0]*n
sign = [0]*n

def bfs(k):
    for i in dic[k]:
        if table[i-1] == 0 and i != 1:
            table[i-1] = table[k-1] + 1
            sign[i-1] = k
        elif table[k-1] + 1 < table[i-1]:
            table[i-1] = table[k-1] + 1
            sign[i-1] = k
        else:
            continue
        bfs(i)
    return

bfs(1)

print("Yes")
for i in range(n-1):
    print(sign[i+1])

### FIXED CODE ###

from collections import deque

n, m = map(int, input().split())
path = list(list(map(int, input().split())) for _ in range(m))

d = deque()

dic = dict()
for i in range(m):
    p = path[i]
    if p[0] not in dic:
        dic[p[0]] = [p[1]]
    else:
        dic[p[0]].append(p[1])
    if p[1] not in dic:
        dic[p[1]] = [p[0]]
    else:
        dic[p[1]].append(p[0])
        
sign = [0]*n
done = [0]*n
done[0] = 1

for i in dic[1]:
    d.appendleft(i)
    sign[i-1] = 1
    done[i-1] = 1

while len(d) > 0:
    x = d.pop()
    for i in dic[x]:
        if done[i-1] == 0:
            d.appendleft(i)
            sign[i-1] = x
            done[i-1] = 1
        
print("Yes")
for i in range(n-1):
    print(sign[i+1])
n = int(input())
l = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
print(l[n+1])

### FIXED CODE ###

n = int(input())
l = (1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51)
print(l[n-1])
def factorial_power(n):
    if n == 0:
        return 1
    else :
        return n * factorial_power(n-1)
    
divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N) % divisor)

### FIXED CODE ###

def factorial_power(n):
    power = 1
    
    for i in range(1, n+1):
        power *= i
        power = power % divisor
    return power

divisor = (10 ** 9) + 7

N = int(input())

print(factorial_power(N))
import functools
import math
import copy

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n):
  l=copy.copy(a)
  del l[i]
  g=functools.reduce(math.gcd, l)
  if ans<g:
    ans=g
print(ans)

### FIXED CODE ###

import fractions
n=int(input())
a=list(map(int,input().split()))
l=[a[0]]
r=[a[-1]]
for i in range(n-1):
  l.append(fractions.gcd(l[i],a[i+1])) #l[i] は最初i個
for i in range(n-1):
  r.append(fractions.gcd(r[i],a[-2-i])) #r[i]は右i r[n-1]=全部 l[0]and r[n-3]
m=[l[n-2],r[n-2]]
for i in range(n-2):
  m.append(fractions.gcd(l[i],r[n-i-3]))
print(max(m))
raw_input()
ran = raw_input().split().reversed()
print [a + ' ' for a in ran][:-1]

### FIXED CODE ###

raw_input()
an = raw_input().split()
an.reverse()
print ' '.join(an)
import sys

input = sys.stdin.buffer.readline

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

max_n = 300000 + 10
keta = max_n.bit_length()
num = 1 << (keta - 1)
SEG = [0] * (2 * num)

func = max
ele = 0


def update(idx, val):
    idx += num
    SEG[idx] = val
    for i in reversed(range(1, num)):
        SEG[i] = func(SEG[2 * i], SEG[2 * i + 1])


def query(left, right):
    res_left = ele
    res_right = ele
    left += num
    right += num
    while left < right:
        if left & 1:
            res_left = func(res_left, SEG[left])
            left += 1
        if right & 1:
            right -= 1
            res_right = func(SEG[right], res_right)
        left //= 2
        right //= 2
    return func(res_left, res_right)


ans = 0
for _ in range(n):
    val = int(input())
    lower = val - k
    upper = val + k
    if lower < 0:
        lower = 0
    if upper > num:
        upper = num
    temp = query(lower, upper + 1)
    update(val, temp + 1)
    ans = max(ans, temp + 1)

print(ans)



### FIXED CODE ###

import sys

input = sys.stdin.buffer.readline


class SegmentTree:
    ele = 0
    func = max
    # SEG木は1-index
    # Aに関しては0-index

    def __init__(self, n):  # Aは0-idx
        self.n = n
        self.num = 2 ** ((self.n - 1).bit_length())
        self.SEG = [self.ele] * (2 * self.num)

    def search(self, idx):
        return self.SEG[idx + self.num]

    def initialize(self, A):
        for i in range(self.n):
            self.SEG[i + self.num] = A[i]
        for i in range(self.num - 1, 0, -1):
            self.SEG[i] = self.func(self.SEG[2 * i], self.SEG[2 * i + 1])

    # 1点更新
    def set(self, idx, val):
        idx += self.num
        self.SEG[idx] = val
        idx //= 2
        while idx:
            self.SEG[idx] = self.func(self.SEG[2 * idx], self.SEG[2 * idx + 1])
            idx //= 2

    # 区間取得
    def query(self, left, right):
        # 開区間
        resleft = self.ele
        resright = self.ele
        left += self.num
        right += self.num
        while right - left > 0:
            if left % 2 == 1:
                resleft = self.func(resleft, self.SEG[left])
                left += 1
            if right % 2 == 1:
                right -= 1
                resright = self.func(resright, self.SEG[right])
            left //= 2
            right //= 2
        return self.func(resleft, resright)


n, k = map(int, input().split())
ans = 0
ST = SegmentTree(3000001)
for _ in range(n):
    val = int(input())
    lower = val - k
    lower = max(lower, 0)
    upper = val + k
    upper = min(upper, 3000000)
    temp = ST.query(lower, upper + 1) + 1
    ST.set(val, temp)
    ans = max(ans, temp)
print(ans)
def dfs(i,p):
    
    for j in edges[i]:
        if(j!=p):
            
            num[j] += num[i]
            
            dfs(j,i)
    

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


a=[]
b=[]

p=[]
x=[]

#隣接リスト
global edges = [ [] for i in range(N)]
global num = [0]*N


for i in range(N-1):
    a0,b0 = map(int,input().split())
    a.append(a0)
    b.append(b0)
    
    edges[a0-1].append(b0-1)
    edges[b0-1].append(a0-1)
    
for i in range(Q):
    p0,x0 = map(int,input().split())
    p.append(p0)
    x.append(x0)
    num[p0-1] += x0
    
dfs(0,-1)
    
for i in range(N):
    print(num[i], end=" ")

### FIXED CODE ###

# https://atcoder.jp/contests/abc138/tasks/abc138_d
import sys
sys.setrecursionlimit(2*2*10**5)

def dfs(i,p,edges,num):
    
    for j in edges[i]:
        if(j!=p):
            
            num[j] += num[i]
            
            dfs(j,i,edges,num)
    
def input():
    return sys.stdin.readline()[:-1]

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


#隣接リスト
edges = [ [] for i in range(N)]
num = [0]*N


for i in range(N-1):
    a0,b0 = map(int,input().split())

    edges[a0-1].append(b0-1)
    edges[b0-1].append(a0-1)
    
for i in range(Q):
    p0,x0 = map(int,input().split())

    num[p0-1] += x0
    
dfs(0,-1, edges, num)
    
for i in range(N):
    print(num[i], end=" ")
mass=int(input())
number=list(map(int,input().split()))

cnt = 0

for i in mass:
    if (i+1)%2!=0 and number[i]%2!=0:
        cnt+=1
 print(cnt)

### FIXED CODE ###

mass=int(input())
number=list(map(int,input().split()))

cnt = 0

for i in range(mass):
    if (i+1)%2!=0 and number[i]%2!=0:
        cnt+=1

print(cnt)
n=input()
b=list(map(int,input(). split ()))
c=1
if 0 in b:
  print(0)
  return
c=1
for i in b:
  c=c*i
  if c>10**18:
    print(-1)
    return
print(c)

### FIXED CODE ###

n=int(input())
a=list(map(int, input().split( )))
if 0 in a:
  print(0)
  
else:
    c=1
    for i in a:
        c= c*i
        if c> 10**18:
            c=-1
            break
    print(c)
a=input()
b=input()
if a>b:
    print("GREATER")
elif a=b
    print("EQUAL")
else
    print("LESS")
    
  

### FIXED CODE ###

a=input()
b=input()
a=int(a)
b=int(b)
if a>b:
    print("GREATER")
elif a==b:
    print("EQUAL")
else:
    print("LESS")
alpha='B'
if (alpha.isupper()){
  print(A)
}else{
  print(B)
}

### FIXED CODE ###

alpha=input()
if (alpha.isupper()):
  print('A')
else:
  print('a')
N,M,X=map(int, input().split())

import numpy as np

A=[]
B=[]

for i in range(N):
  A.append(list(map(int,input().split())))

#for i in range(M):
#  B.append([A[j][i] for j in range(N)])

C=[]
temp=[0 for i in range(N)]

for i in range(2**N):
  for j in range(N):
    if (i >> j) & 1:
      temp[j]=1
    else:
      temp[j]=0
  tempE=[0 for i in range(M+1)]
  for k in range(N):
    x = np.array(tempE)
    y = np.array([A[k][j]*temp[k] for j in range(M+1)])
    tempE=x+y
  C.append(tempE)


tempC=float('inf')
for i in range(2**N):
  tempD=min(C[i][1:M+1])
  if tempD>=X:
    tempC=min([tempC,C[i][0]])

if tempC==float('inf'):
  tempC=-1

print(tempC)

### FIXED CODE ###

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

import numpy as np

A=[]
B=[]

for i in range(N):
  A.append(list(map(int,input().split())))


C=[]
temp=[0 for i in range(N)]

for i in range(2**N):
  for j in range(N):
    if (i >> j) & 1:
      temp[j]=1
    else:
      temp[j]=0
  tempE=[0 for i in range(M+1)]
  for k in range(N):
    x = np.array(tempE)
    y = np.array([A[k][j]*temp[k] for j in range(M+1)])
    tempE=x+y
  C.append(tempE)


tempC=float('inf')
for i in range(2**N):
  tempD=min(C[i][1:M+1])
  if tempD>=X:
    tempC=min([tempC,C[i][0]])

if tempC==float('inf'):
  tempC=-1

print(tempC)
N = int(input())
P = list(map(int, input().split(' ')))
num = 0
for i in range(len(P)):
    if P[i] == i+1:
        P[i],P[i+1] = P[i+1],P[i]
        num += 1
print(num)


### FIXED CODE ###

N = int(input())
P = list(map(int, input().split(' ')))
num = 0
for i in range(len(P)):
    if P[i] == i+1:
        if i+1 == len(P):
            P[i],P[i-1] = P[i-1],P[i]
        else:
            P[i],P[i+1] = P[i+1],P[i]
        num += 1
print(num)
line = input().split()
N = int(line[0])
M = int(line[1])
broken = []
count = 0
step = []
def check(value):
  if count < M:
    return broken[count]==value
  else:
    return False

for i in range(M):
  a = int(input())
  broken += [a]
if check(1):
  step+=[0]
  count += 1
else:
  step +=[1]
if check(2):
  step += [0]
  count += 1
else:
  step += [1+step[0]]
for j in range(2, N):
  if check(j+1):
    step += [0]
    count += 1
  else:
    step += [step[j-2]+step[j-1]]
ans = step[N-1]%(10^9+7)
print(ans)


### FIXED CODE ###

inf = input().split()
H = int(inf[0])
W = int(inf[1])
sheet = [[] for i in range(H+2)]
score = [[] for i in range(H+2)]
m = 0
 
for h in range(H+2):
  if h==0 or h==H+1:
    a = [False]*(W+2)
    b = [(0,0)]*(W+2)
    sheet[h]=a
    score[h]=b
  else:
    line = input()
    a = []
    b = []
    a += [False]
    b += [(0,0)]
    for w in range(W):
      b+=[(0,0)]
      if line[w]=='.':
        a += [True]
      else:
        a += [False]
    a += [False]
    b += [(0,0)]
    sheet[h]=a
    score[h]=b
      
for h in range(1,H+1):
  for w in range(1,W+1):
    if sheet[h][w]:
      s = 0
      hs = 0
      ws = 0
      if sheet[h-1][w]:
        hs += score[h-1][w][0]
      else:
        i = h+1
        while sheet[i][w]:
          hs+=1
          i+=1
      if sheet[h][w-1]:
        ws += score[h][w-1][1]
      else:
        j = w+1
        while sheet[h][j]:
          ws+=1
          j+=1
      s = 1 + hs + ws
      score[h][w]=(hs, ws)
      if m < s:
        m = s
print(m)
s = input()

if s == "AAA" || s == "BBB":
  print("No")
else:
  print("Yes")

### FIXED CODE ###

s = input()
if s == "AAA" or s == "BBB":
    print("No")
else:
    print("Yes")