Harryxun/stf_run huggingface dataset:
def main():
  n = input()
  A = map(int, raw_input().split())
  p = input()
  m = map(int, raw_input().split())
  for i in range(q)
    if solve(0, m[q], A):
      print 'yes'
    else:
      print 'no'

def solve(int i, int m, A):
  if m == 0:
    return 1
  if i >= n:
    return 0
  res = solve(i+1, m) or solve(i+1, m-A[i])
  return res

### FIXED CODE ###

def solve(i, m):
  if dp[i][m] != -1:
    return dp[i][m]

  if m == 0:
    dp[i][m] = 1
  elif i >= n:
    dp[i][m] = 0
  elif solve(i+1, m):
    dp[i][m] = 1
  elif solve(i+1, m-A[i]):
    dp[i][m] = 1
  else:
    dp[i][m] = 0

  return dp[i][m]



n = input()
A = map(int, raw_input().split())
p = input()
m = map(int, raw_input().split())

dp = [[-1 for col in range(2000)] for row in range(n+1)]

for i in range(p):
  if solve(0, m[i]):
    print 'yes'
  else:
    print 'no'
N = int(input())
A = list(map(int, input().split()))
 
tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
  
if tmp <= 1e18:
    print(tmp)
elif 0 in tmp:
    print(0)
else:
    print(-1)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
 
tmp = 1
for num in A:
    tmp *= num
    if tmp > 1e18:
      break
  
if tmp <= 1e18:
    print(tmp)
elif 0 in A:
    print(0)
else:
    print(-1)
a,b,c = map(int,input().split())
print(max(a,b,c)*2**k + (a+b+c-max(a,b,c)))

### FIXED CODE ###

a,b,c = map(int,input().split())
k = int(input())
print(2**k*max(a,b,c) + (a+b+c-max(a,b,c)))
n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min[x1, x2])

### FIXED CODE ###

n, k = map(int,input().split())
x1 = n%k
x2 = k - x1
print(min(x1, x2))
import numpy as np

n = int(input())
As = list(map(int, input().split()))
As = np.array(As)
mod = 10**9 + 7



k = np.lcm.reduce(As)
ans = 0
for i in range(n):
    ans += k // As[i]
    ans %= mod
print(ans)


### FIXED CODE ###

from functools import reduce
from fractions import gcd

def lcm_base(x, y):
    return (x * y) // gcd(x, y)

def lcm_list(numbers):
    return reduce(lcm_base, numbers)
mod = 10**9 + 7
n = int(input())
As = list(map(int, input().split()))

lcm = lcm_list(As)
b = [lcm//As[i] for i in range(n)]

print(sum(b) % mod)
nk_str = input()
string = input()
nk_list = nk_str.split()
k = int(nk_list[-1])
char_list = [c for c in string]
char_list[k - 1] = char_list[k - 1].lower()
string = ''.join(string_list)
print(string

### FIXED CODE ###

nk_str = input()
string = input()
nk_list = nk_str.split()
k = int(nk_list[-1])
string_list = [c for c in string]
string_list[k - 1] = string_list[k - 1].lower()
string = ''.join(string_list)
print(string)
def main():
    H,W,K = map(int,input().split())
    S = [[int(s) for s in input()]for _ in range(H)]
    ans = 2**60
    for i in range(2**(H-1)):
        aa = 0
        for j in range(H-1):
            if (i>>j)&1 == 1:
                aa+=1
        c = aa
        b = [0 for _ in range(c+1)]
        OK = True
        for j in range(W):
            k = 0
            for h in range(H):
                if S[h][j] == 1:b[k] += 1
                if (i>>j)&1==1:k+=1
            
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:
                aa += 1
                b = [0]*(c+1)
                k = 0
                for h in range(H):
                    if S[h][j]==1:b[k] += 1
                    if (i>>j)&1==1:k+=1
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:OK = False;break                
        if OK:ans = min(ans,aa)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    H,W,K = map(int,input().split())
    S = [input()for _ in range(H)]
    ans = 10**9
    for i in range(2**(H-1)):
        aa = 0
        for j in range(H-1):
            if (i>>j)&1 == 1:
                aa+=1
        c = aa
        b = [0]*(c+1)
        OK = True
        for j in range(W):
            k = 0
            for h in range(H):
                if S[h][j] == "1":b[k] += 1
                if (i>>h)&1==1:k+=1
            
            ok = True
            for p in b:
                if p > K:ok = False
            if not ok:
                aa += 1
                b = [0]*(c+1)
                
                k = 0
                for h in range(H):
                    if S[h][j]=="1":b[k] += 1
                    if (i>>h)&1==1:k+=1
                ok = True
                for p in b:
                    if p > K:ok = False
                if not ok:OK = False;break                
        if OK:ans = min(ans,aa)
    print(ans)

if __name__ == "__main__":
    main()
str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list.remove(keyence_list[a])
        int_input_list.remove(keyence_list[a])

if keyence_list == []:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

str_input_list = input().rstrip().split(' ')
int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))
    
keyence_list = [1, 9, 7, 4]

for a in range(4):
    if keyence_list[a] in int_input_list:
        keyence_list[a] = '*'

if keyence_list == ['*', '*', '*', '*']:
    print('YES')
else:
    print('NO')
W, H, x, y = map(float, input().split())

if x == W or y == H or x == 0 or y == 0:
    ans = H*W/2
    ans_2 = 0
if x*H == y*W or (W-x)*H == y*W or :
    ans = H*W/2
    if float(x) == W/2 and float(y) == H/2:
        ans_2 = 1
    else:
        ans_2 = 0
else:
    yoko_a = W * y
    yoko_b = W * (H-y)
    yoko = min(yoko_a, yoko_b)

    tate_a = H * x
    tate_b = H * (W-x)
    tate = min(tate_a, tate_b)
    
    ans = max(tate, yoko)
    ans = float(ans)

    if tate == yoko:
        ans_2 = 1
    else:
        ans_2 = 0

print(ans, ans_2)

### FIXED CODE ###

W, H, x, y = map(float, input().split())

if x == W or y == H or x == 0.0 or y == 0.0:
    ans = H*W/2
    ans_2 = 0
elif x*H == y*W or (W-x)*H == y*W:
    ans = H*W/2
    if float(x) == W/2 and float(y) == H/2:
        ans_2 = 1
    else:
        ans_2 = 0
elif abs(W/2-x) * (H/2) / abs(H/2-y) < W/2:
    ans = H*W/2
    ans_2 = 0
else:
    yoko_a = W * y
    yoko_b = W * (H-y)
    yoko = min(yoko_a, yoko_b)

    tate_a = H * x
    tate_b = H * (W-x)
    tate = min(tate_a, tate_b)
    
    ans = max(tate, yoko)
    ans = float(ans)

    if tate == yoko:
        ans_2 = 1
    else:
        ans_2 = 0

print(ans, ans_2)
import numpy as np
n, k, q = input().split(' ')
n, k, q = int(n),int(k), int(q)
hum = [k]*n
for i in range(q):
    ind = input()
    hum[int(ind)] += 1
hum_last = np.array(hum)-q
for i in range(len(hum_last)):
    if hum_last[len(hum_last)-i-1] <= 0:
        print('No')
    else:
        print('Yes')

### FIXED CODE ###

import numpy as np
n, k, q = input().split(' ')
n, k, q = int(n),int(k), int(q)
hum = [k]*n
for i in range(q):
    ind = input()
    hum[int(ind)-1] += 1
hum_last = np.array(hum)-q
for i in range(len(hum_last)):
    if hum_last[i] <= 0:
        print('No')
    else:
        print('Yes')
k = int(input)
a,b = [int(x) for x in input().split()]
ans = "NG"
for i in range(1000):
  if a <= i * k and i * k <= b:
    ans = "OK"
    break
print(ans)

### FIXED CODE ###

k = int(input())
a,b = [int(x) for x in input().split()]
ans = "NG"
for i in range(1000):
  if a <= i * k and i * k <= b:
    ans = "OK"
    break
print(ans)
from sys import stdin

N, K = map(int, input().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]

def is_max_len_less_than_input(x,K,A):
  count = 0
  for ln in A:
    count += int(ln/x)
    if count > K:
      return False
  return True

def binary_search(begin,end,K,A):
  while abs(end-begin)>1:
    mid = int((begin+end)/2)
    if is_max_len_less_than_input(mid,K,A):
      end = mid
    else:
      begin = mid
  return mid

print(binary_search(1,max(A),K,A))

### FIXED CODE ###

from sys import stdin
from math import floor,ceil

N, K = map(int, input().rstrip().split())
A = [int(x) for x in stdin.readline().rstrip().split()]

def is_max_len_less_than_input(x,K,A):
  count = 0
  if x==0:
    return False
  for ln in A:
    count += ceil(ln/x)-1
    if count > K:
      return False
  return True

def binary_search(begin,end,K,A):
  while abs(end-begin)>1:
    mid = (begin+end)//2
    if is_max_len_less_than_input(mid,K,A):
      end = mid
    else:
      begin = mid
  return end

print(binary_search(0,max(A),K,A))
import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

# W行H列, x[W][H]
def create_grid(W, H, value = 0):
    return [[ value for _ in range(H)] for _ in range(W)]

########
N, H = l_inpl()
a, b = [], []

for _ in range(N):
    ai, bi = l_inpl()
    a.append(ai)
    b.append(bi)

a.sort()
b.sort()
max_a = max(a)

ans = 0
for bi in b[bisect_right(b, max_a):]:
    H -= bi
    ans += 1
    if H <= 0:
        break

if H > 0:
    ans += math.ceil(H / max_a)

print(ans)

### FIXED CODE ###

import math
import copy
from operator import mul
from functools import reduce
from collections import defaultdict
from collections import Counter
from collections import deque
# 直積 A={a, b, c}, B={d, e}:のとき，A×B={(a,d),(a,e),(b,d),(b,e),(c,d),(c,e)}: product(A, B)
from itertools import product
# 階乗 P!: permutations(seq), 順列 {}_len(seq) P_n: permutations(seq, n)
from itertools import permutations
# 組み合わせ {}_len(seq) C_n: combinations(seq, n)
from itertools import combinations
# 一次元累積和
from itertools import accumulate
from bisect import bisect_left, bisect_right

import re
# import numpy as np
# from scipy.misc import comb

def inside(y, x, H, W):
    return 0 <= y < H and 0 <= x < W

# 四方向: 右, 下, 左, 上
dy = [0, -1, 0, 1]
dx = [1, 0, -1, 0]
 
def i_inpl(): return int(input())
def l_inpl(): return list(map(int, input().split()))
def line_inpl(x): return [i_inpl() for _ in range(x)]

INF = int(1e18)
MOD = int(1e9)+7 # 10^9 + 7

# W行H列, x[W][H]
def create_grid(W, H, value = 0):
    return [[ value for _ in range(H)] for _ in range(W)]

########
N, M, Q = l_inpl()

l, r = [], []
for _ in range(M):
    li, ri = l_inpl()
    l.append(li)
    r.append(ri)

p, q = [], []
for _ in range(Q):
    pi, qi = l_inpl()
    p.append(pi)
    q.append(qi)

s = create_grid(N+1, N+1)

for i in range(M):
    s[l[i]][r[i]] += 1

for hi in range(1, N+1):
    for wi in range(1, N+1):
        s[hi][wi] += s[hi-1][wi]
        s[hi][wi] += s[hi][wi-1]
        s[hi][wi] -= s[hi-1][wi-1]

for i in range(Q):
    pi, qi = p[i], q[i]
    print(s[qi][qi] - s[qi][pi-1] - s[pi-1][qi] + s[pi-1][pi-1])
from sympy import divisors
input_line1 = input()
N = int(input_line1)
count = 0
D = len(divisors(N))

if D == 2:
    count = 1
else:
    for i in range (2,N):
        if N % i == 0:
            count += 1
            N = int(N / i)
            D = len(divisors(N))
            if D == 2:
                count += 1
                if N <= i:
                    count -= 1
                break
 
print(count)

### FIXED CODE ###

N = int(input())
pf = {}
answer = 0

for i in range(2,int(N**0.5)+1):
    while N % i ==0:
        pf[i] = pf.get(i, 0) + 1
        N //= i
    
    if N < i:
        break
if N > 1:
    answer += 1
    
for j, k in pf.items():
    sq = 1
    for l in range(k):
        answer += 1
        k -= sq
        sq += 1
        if k == 0:
            break
        elif k < 0:
            answer -= 1
            break

print(answer)
n,m = map(int,input().split())
l = [list(map(int, input().split())) for _ in range(m)]

p = [[],[],[]]
for i in range(m):
    if l[i][0]== 1:
        p[0].append(l[i][1])
    elif l[i][0]== 2:
        p[1].append(l[i][1])
    else:
        p[2].append(l[i][1])

#print(p)

if len(p[0]) == 0:
        p[0].insert(0,1)
#print(p)

for j in range(len(p)):
    if len(p[j]) == 0:
        p[j].append(0)

#print(p)

if len(set(p[0])) > 1 or len(set(p[1])) > 1 or len(set(p[2])) > 1:
    print('-1')
    exit()

q = []
for k in range(len(p)):
    q.append(str(p[k][0]))
#print(q)
if n = 1 and q[0] == '0':
    print(0)
    exit()
    

if q[0] == '0':
    print('-1')
    exit()

if q[0] == '0' and q[1] == '0':
    print('-1')
    exit()

if q[0] == '0' and q[1] == '0' and q[2] == '0':
    print(0)
    exit()

print(''.join(q))



### FIXED CODE ###

n, m = map(int, input().split())
ans = [-1 for _ in range(n)]
l = [list(map(int, input().split())) for _ in range(m)]

if m == 0:
    if n == 1:
        print(0)
        exit()
    elif n == 2:
        print(10)
        exit()
    elif n == 3:
        print(100)
        exit()

for q in range(m):
    if l[q][0] == 1:
        break
else:
     ans[0] = 1

for k in range(m):
    if l[k][1] != 0:
        break
    for p in range(m):
        if l[p][0] == 1:
            break
        else:
            if n ==2:
                print(10)
                exit()
            elif n == 3:
                print(100)
                exit()

else:
    if n == 1:
        print(0)
        exit()
    else:
        print(-1)
        exit()

for i in range(m):
    if l[i][0] == 1 and l[i][1] == 0:
        print(-1)
        break
    if ans[l[i][0]-1] != -1 and ans[l[i][0]-1] != l[i][1]:
        print(-1)
        break
    else:
        ans[l[i][0]-1] = l[i][1]

else:
    for j in range(n):
        if ans[j] == -1:
            ans[j] = 0

    print(''.join(list(map(str,ans))))
def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
z_list = factorization(N)
Z = []
for z in z_list:
        for e in range(1, z[1]+1):
            Z.append(z[0]**e)
sorted(Z)
counter = 0 
if N==i:
    print(0)
    quit()
for z in Z:
    if(N%z==0):
        N = N//z
        counter += 1
print(counter)



### FIXED CODE ###

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i==0:
            cnt=0
            while temp%i==0:
                cnt+=1
                temp //= i
            arr.append([i, cnt])

    if temp!=1:
        arr.append([temp, 1])

    if arr==[]:
        arr.append([n, 1])

    return arr

N = int(input())
z_list = factorization(N)
Z = []
for z in z_list:
        for e in range(1, z[1]+1):
            Z.append(z[0]**e)
sorted(Z)
counter = 0 
if N==1:
    print(0)
    quit()
for z in Z:
    if(N%z==0):
        N = N//z
        counter += 1
print(counter)
n = int(input())
a = list(map(int,input().split()))
p = 0
q = 0
for i in range(n-1):
  e = a[i+1]-a[i]
  if e > 0:
    q = 0
  else:
    if p-q > e:
      q -= e
    else:
      q -= e
      e = q
print(s)


### FIXED CODE ###

#中身の数
n = int(input())
#リスト
a = list(map(int,input().split()))
#合計
p = 0
#前が使った土
q = 0

for i in range(n-1):
  #前の人との差
  e = a[i+1]-a[i]
  if e > 0:
    if e > q:
      q = 0
    else:
      q = q-e
  else:
    q = q-e
  p += q
  
print(p)
from math
a,b,c,d=list(map(int,input().split()))
a-=1
def calculation(x,c,d):
	x=x-(x//c)-(x//d)+(x//((c*d)//math.gcd(c,d)))
	return x
	
print(calculation(b,c,d)-calculation(a,c,d))

### FIXED CODE ###

import math
a,b,c,d=list(map(int,input().split()))
a-=1
def calculation(x,c,d):
	x=x-(x//c)-(x//d)+(x//((c*d)//math.gcd(c,d)))
	return x
	
print(calculation(b,c,d)-calculation(a,c,d))
import math

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)

    # divisors.sort()
    return divisors

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

n = int(input())

ans = [-1 for i in range(30002)]
for i in range(10001):
    price = int((i*1.08)//1)
    ans[price] = i

if(ans[n]!=-1):
    print(ans[n])
else:
    print(':(')
    

### FIXED CODE ###

import math

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)

    # divisors.sort()
    return divisors

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

n = int(input())

ans = [-1 for i in range(80002)]
for i in range(50002):
    price = int((i*1.08)//1)
    ans[price] = i

if(ans[n]!=-1):
    print(ans[n])
else:
    print(':(')
ソースコード 

Copy
Copy
from scipy.sparse import *
from itertools import *
 
n,m,r = [int(x) for x in input().split()]
R = [int(i)-1 for i in input().split()]
route_list = [[10**8]*n for i in range(n)]
ans = 10**9
for j in range(m):
  a,b,c = map(int,input().split())
  route_list[a-1][b-1] = c
  route_list[b-1][a-1] = c
 
Co = csgraph.floyd_warshall(csr_matrix(route_list))
 
for v in permutations(R):
  temp = 0
  for i in range(1,r):
    temp += Co[v[i-1]][v[i]]
  ans = min(ans,temp)
print(int(ans))

### FIXED CODE ###

import math
from itertools import permutations

def warshall_floyd(d):
    #d[i][j]: iからjへの最短距離
    n=len(d[0])
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

N,M,R=[int(x) for x in input().split()]
r=[int(x)-1 for x in input().split()]

route_list=[[10**9]*N for i in range(N)]

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

wa_list=warshall_floyd(route_list)
ans=30**9

for perm in permutations(r):
    #print(perm)
    cur = sum(wa_list[v][u] for v, u in zip(perm, perm[1:]))
    ans = min(ans, cur)

print(ans)
order = list(input())
X, Y = map(int, input().split())

Xs = []
Ys = []
now_lis = Xs
cnt = 0
for s in order:
    if s=='T':
        now_lis.append(cnt)
        now_lis = Ys if now_lis==Xs else Xs
        cnt = 0
    else:
        cnt += 1
now_lis.append(cnt)
lx = len(Xs)
ly = len(Ys)

def dp(length, lis, goal):
    M = sum(lis)
    dp = [[0]*(M*2+1) for _ in range(length+1)]
    dp[0][M] = 1
    for i, x in enumerate(lis, 1):
        for j in range(M*2):
            if dp[i-1][j]==1:
                if not j+x>=M*2 or not j+x<0:
                    dp[i][j+x] = 1
                if not j-x<0 or not j-x>=M*2:
                    dp[i][j-x] = 1
    return dp[-1][goal+M]

if dp(lx, Xs, X) and dp(ly, Ys, Y):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

order = list(input())
X, Y = map(int, input().split())
 
Xs = []
Ys = []
cnt = 0
now_lis = Xs
x_dir = 1
for s in order:
    if s=='T':
        if not cnt==0:
            now_lis.append(cnt)
        now_lis = Ys if x_dir else Xs
        x_dir = not x_dir
        cnt = 0
    else:
        cnt += 1
if not cnt==0:
    now_lis.append(cnt)

if order[0]=='T':
    x_start = 0
else:
    x_start = Xs[0]
    del Xs[0]

def dp(start, lis, goal):
    nodes = set([start])
    for x in lis:
        nx = set()
        L = list(nodes)
        for l in L:
            nx.add(l+x)
            nx.add(l-x)
        nodes = nx
    return goal in nodes
 
if dp(x_start, Xs, X) and dp(0, Ys, Y):
    print('Yes')
else:
    print('No')
input(x)

if 30<=x<=40:
  print('yes')
else :
  print('No')


### FIXED CODE ###

x = int(input())

if x>=30:
  print('Yes')
else :
  print('No')
a,b,c =map(int,input().split())
if a == 5 && b==5 && c==7:
  print("YES")
elif a == 5 && b==7 && c==5:
  print("YES")
elif a == 7 && b==5 && c==5:
  print("YES")
else :
  print("NO")

### FIXED CODE ###

a,b,c =map(int,input().split())
if a == 5 and b==5 and c==7:
  print("YES")
elif a == 5 and b==7 and c==5:
  print("YES")
elif a == 7 and b==5 and c==5:
  print("YES")
else :
  print("NO")
n=int(input())
A=[]
X=[]
Y=[]
x=[]
y=[]
for i in range(n):
  a=int(input())
  A.append(a)
  for j in range(a):
    x1,y1=[int(s) for s in input().split()]
    x.append(x1)
    y.append(y1)
  X.append(x)
  Y.append(y)
  
c=0
for i in range(n):
  l=[1]*n
  for j in range(i, n-i):
    if l[j]==0:continue
    for k in range(A[j]):
    　　l[X[j][k]] *= Y[j][k]
  if c<l.count(1):
    c=l.count(1) 
  
        
  
print(c)  
  
  
  
  
  
  
  
  
  
  
  
  
  

### FIXED CODE ###

n=int(input())
X=[]
Y=[]
A=[0]*n
for i in range(n):
  A[i]=int(input())
  a=A[i]
  x=[0]*a
  y=[0]*a
  for j in range(a):
    x[j],y[j]=[int(s) for s in input().split()]
  X.append(x)
  Y.append(y)
  
s=0
for i in range(2**n):
  c=0
  d=0
  B=[0]*n
  for j in range(n):
    if((i >> j) & 1):
      c=c+1
      B[j]=1
  for k in range(n):
    if B[k]==1:
      for j in range(A[k]):
        if Y[k][j]!=B[X[k][j]-1]:
          d=-1
          break
    if d<0:
      break
  if s<c and d==0:
    s=c
      
      
print(s)
N = int(input())
S = input()                                                      
list_S = list(S)
N1 = 0
X1 = 0
X2 = 0
X1MIN = 0
X2MIN = 0
list_X = []

for color in list_S:
    if color == '.':
            N1 +=1
    else:
        list_S1 = list_S[N1:]
        list_S2 = list_S[:N1]
        X1 = list_S1.count('.')
        X2 = list_S2.count('#')
        X = X1 + X2
        list_X.append(X)
        N1 +=1

X_MIN = min(list_X1)
print(X_MIN)

### FIXED CODE ###

N = int(input())
S = input()                                                      
list_S = list(S)
N1 = 0
list_X =[]
X = list_S.count('.')
list_X.append(X)
    
for color in list_S:
    if list_S[N1] == '.':
        X -= 1
        list_X.append(X)
        N1 +=1
    else:
        X += 1
        list_X.append(X)
        N1 +=1

X = list_S.count('#') 
list_X.append(X)

X_MIN = min(list_X)
print(X_MIN)
d, t, s = input().split()
int(d)
int(t)
int(s)
if(d/s <= t):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

d, t, s = input().split()
d = int(d)
t = int(t)
s = int(s)
if(d/s <= t):
    print('Yes')
else:
    print('No')
S, T = input().split()
r, b = map(int, input().split())
N = input()

if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 print(r, b)

### FIXED CODE ###

S,  T = input().split()
r, b = map(int, input().split())
N = input()
 
if S == N:
  r -= 1
elif T == N:
  b -= 1
  
 
print(r, b)
S=input()
K=int(input())

i=0
while i<=len(S):
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])

### FIXED CODE ###

S=input()
K=int(input())

i=0
while i<=len(S)-1:
    if S[i]=="1":
        i+=1
    else:
        break

if K<=i:
    print("1")
else:
    print(S[i])