Harryxun/stf_run huggingface dataset:
a,b,c,d = map(int, input().split())
if abs(a - c) > d:
    if abs(b - a) > d or abs(b - c) > d:
        pint("No")
    else:
        print("Yes")
else:
    print("Yes")


### FIXED CODE ###

a,b,c,d = map(int, input().split())
if abs(a - c) > d:
    if abs(b - a) > d or abs(b - c) > d:
        print("No")
    else:
        print("Yes")
else:
    print("Yes")
import n
a = n*n*n
print a

### FIXED CODE ###

x = raw_input()
x = int(x)
x = x ** 3
print x
N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    temp = A[0]
    for a in A[1:]:
        if a - 1 == temp:
            return "0"
        temp = a

    # We can
    memo = [0] * (N + 1)

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0
        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
            # print(f"memo[{i}] = {count1} + {count2} -> {memo[i]}")
        return memo[i]
    return rec(N)


print(solve())


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

N, M = [int(_) for _ in input().split()]
A = [int(input()) for i in range(M)]
isBroken = [False] * (N + 1)
for i in A:
    isBroken[i] = True


def solve():

    # It's impossible
    if M >= 1:
        temp = A[0]
        for a in A[1:]:
            if a - 1 == temp:
                return 0
            temp = a

    # We can
    memo = [0] * (N + 2)

    def rec(i):
        if i == 0:
            return 1
        if i < 0:
            return 0
        if isBroken[i]:
            return 0

        if memo[i] == 0:
            count1 = rec(i - 1) % 1000000007
            count2 = rec(i - 2) % 1000000007
            memo[i] = (count1 + count2) % 1000000007
        return memo[i]
    return rec(N)


print(solve())
n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, b[i])
  cost += min(m, b[i]) * a[i]
  m -= min(m, b[i])
print(cost)

### FIXED CODE ###

n, m = map(int, input().split())
shop = []
for i in range(n):
  shop.append(list(map(int, input().split())))
shop.sort()
bought = 0
cost = 0
for i in range(n):
  bought += min(m, shop[i][1])
  cost += min(m, shop[i][1]) * shop[i][0]
  m -= min(m, shop[i][1])
print(cost)
import sys
import numpy as np
from scipy.ndimage.morphology import distance_transform_cdt
INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
sys.setrecursionlimit(10 ** 9)


def main():
    H, W = MAP()
    A = [INPUT() for _ in range(H)]

    A = np.array([[(Ai[j] != "#") for j in range(W)] for Ai in A])
    print(distance_transform_cdt(A, metric="taxicab").max())


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
import numpy as np
from scipy.ndimage.morphology import distance_transform_cdt
INPUT = lambda: sys.stdin.readline().rstrip()
MAP = lambda: map(int, INPUT().split())
sys.setrecursionlimit(10 ** 9)


def main():
    H, W = MAP()
    A = [INPUT() for _ in range(H)]
    A = np.array([[(Ai[j] != "#") for j in range(W)] for Ai in A])
    print(distance_transform_cdt(A, metric="taxicab").max())


if __name__ == '__main__':
    main()
N, M = map(int ,raw_input().split())
s="#"*(M+2)
a=[]

a.append(s)
for i in range(N):
    a.append("#"+raw_input()+"#")

a.append(s)

for i in range(N+2):
    print(a[i])


### FIXED CODE ###

N, M = map(int ,raw_input().split())
s="#"*(M+2)
a=[]

a.append(s)
for i in range(N):
    a.append("#"+raw_input()+"#")
a.append(s)

for i in range(N+2):
    print(a[i])
h,w = (int(x) for x in input().split())



if h != 1 and w != 1:
    num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) 
print(num)

### FIXED CODE ###

h,w = (int(x) for x in input().split())


num  = 1
if h != 1 and w != 1:
    num = ((w // 2) + (w % 2))*( (h // 2) + ( h% 2) ) + ((w // 2) + (w % 2)-(w%2))*( (h // 2) + (h%2) -(h%2)) 
print(num)
a = int(input())
2 s = input()
3 print(s if a >= 3200 else 'red')

### FIXED CODE ###

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

if a<3200:
  print("red")
else:
  print(s)
import math
A, B, C, D = map(int, input().split())
k = B - A
count = round(k//C + k//D - k//((C*D)/math.gcd(C,D)))
print(k-count)

### FIXED CODE ###

import fractions
def lcm(a,b):
  return a*b //fractions.gcd(a, b)

A, B,C,D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)
print((B-(A-1))-(b_num-a_num))
W, H, x, y = map( int, input().split())
print(WH/2, 1)

### FIXED CODE ###

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

if not ( x == W/2 and y == H/2):
  print(W*H/2, 0)
  
else:
  print(W*H/2,1)
import heapq
n,m=map(int, input().split())
s = [list(map(int, input().split())) for i in range(n)]
q = []
ans=0
#ヒープソート
heapq.heapify(s)
for k in range(m-2,-1,-1):
    if s!=[]:
        #最小値を返す
        p=heapq.heappop(s)
        if p[0]+k<=m:
            #heappush(list,item) listの葉にitemを追加して小さい要素を上に持ち上げる
            heapq.heappush(q,-p[1])
        else:
            heapq.heappush(s,p)
            break
    else:
        break
    if q!=[]:
        #最小値をヒープから取り出す
        p=heapq.heappop(q)
        ans+=-p
print(ans)


### FIXED CODE ###

a,b=map(int, input().split())
print(max(a+b,a-b,a*b))
# -*- coding: utf-8 -*-

x = int(input())
#x = 8

y = input()
#y = ["3","1","4","1","5","9","2","6"]

for i in range(x):
    y[i] = int(y[i])

Max = max(y)
Min = min(y)

ans = Max - Min

print(ans)


### FIXED CODE ###

# -*- coding: utf-8 -*-
 
x = int(input())
#x = 8
 
y = input().split()
#y = ["3","1","4","1","5","9","2","6"]
 
for i in range(x):
    y[i] = int(y[i])
 
Max = max(y)
Min = min(y)
 
ans = Max - Min
 
print(ans)
n = int(input())
L = list(map(int, input().split())
L.sort()
array_L = []
for m in [i * 2 for i in range(n)]:
    array_L.append(L[m])
print(sum(array_L))
    

### FIXED CODE ###

n = int(input())
L = list(map(int, input().split()))
L.sort()
array_L = []
for m in [i * 2 for i in range(n)]:
    array_L.append(L[m])
print(sum(array_L))
S = input()
 
if S[2:3] > 12 and S[:2] == '00':
  print('NA')
else:
  if S[2:3] > 12:
    print('YYMM')
  elif S[:1] == '00':
    print('MMYY')
  else:
    print('AMBIGUOUS') 

### FIXED CODE ###

S = input() 
is_yymm = 1 <= int(S[2:4]) <= 12
is_mmyy = 1 <= int(S[0:2]) <= 12

if is_mmyy and is_yymm:
    print('AMBIGUOUS') 
elif is_yymm:
    print('YYMM')
elif is_mmyy:
    print('MMYY')
else:
    print('NA')
N=int(input())
a=list(map(int, input().split()))
Flag=True

#print(bin(a[N-1] ^ a[1]))
#print(bin(a[0]))

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
  if bin(a[N-1] ^ a[1]) == bin(a[0]):
    if N!=3:
      for i in range(0,N-3):
        #print(bin(a[N] ^ a[N+2]),bin(a[N+1]))
        if Flag:
          if bin(a[N] ^ a[N+2])!=bin(a[N+1]):
            Flag=False
            break  
      if Flag:
        print("Yes")
      else:
        print("No")
    else:
      if bin(a[0] ^ a[2]) == bin(a[1]):
        print("Yes")
      else:
        print("No")
  else:
    print("No")    
else:
  print("No")
    

### FIXED CODE ###

from collections import Counter,OrderedDict

N=int(input())
a=list(map(int,input().split()))
d=OrderedDict(Counter(a))
e=list(d)
e.sort()

if len(d)>3:
    ans="No"
else:
    ans="No"
    if len(d)==1:
        if e[0]==0:
            ans="Yes"
    elif len(d)==2:
        if N%3==0:
            if e[0]==0 and d[0]==N//3 and d[e[1]]==2*N//3:
                ans="Yes"
    else:
        if N%3==0:
            if d[e[0]]==d[e[1]]==d[e[2]]:
                if e[0]^e[1]^e[2]==0:
                    ans="Yes"
                   
print(ans)
a=int(input())
if a=25:
  print('Christmas')
elif a=24:
  print('Christmas Eve')
elif a=23:
  print('Christmas Eve Eve')
elif a=22:
  print('Christmas Eve Eve Eve')

### FIXED CODE ###

a=int(input())
if a==25:
  print('Christmas')
elif a==24:
  print('Christmas Eve')
elif a==23:
  print('Christmas Eve Eve')
elif a==22:
  print('Christmas Eve Eve Eve')
def factor(N):
    arr=[]
    for i in range(1,int(N**0.5)+1):
        if(N%i==0):
            arr.append(i)
            if(N//i!=i):
                arr.append(N//i)
    return arr

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

cnt=[0]*1000001
for i in range(N):
    cnt[A[i]]+=1
ng=set()
for i in range(N):
    if cnt[A[i]]>1:
        ng.add(A[i])

s=set(A)

ans=0
for i in reversed(range(N)):
    if A[i] in ng:
        continue
    if A[i]<min_*2:
        ans+=1
        continue
    s.remove(A[i])
    arr=factor(A[i])
    ok=True
    for x in arr:
        if x in s:
            ok=False
            break
    if ok:
        ans+=1
    s.add(A[i])
print(ans)


### FIXED CODE ###

def factor(N):
    arr=[]
    for i in range(1,int(N**0.5)+1):
        if(N%i==0):
            arr.append(i)
            if(N//i!=i):
                arr.append(N//i)
    return arr

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

cnt=[0]*1000001
for i in range(N):
    cnt[A[i]]+=1
ng=set()
for i in range(N):
    if cnt[A[i]]>1:
        ng.add(A[i])

s=set(A)
min_=min(A)

ans=0
for i in reversed(range(N)):
    if A[i] in ng:
        continue
    if A[i]<min_*2:
        ans+=1
        continue
    s.remove(A[i])
    arr=factor(A[i])
    ok=True
    for x in arr:
        if x in s:
            ok=False
            break
    if ok:
        ans+=1
    s.add(A[i])
print(ans)
S = input()
S = S[::-1]
isStrip = 0
end = 1
while end:
    isStrip = 0
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.reaplace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')

### FIXED CODE ###

#C - Day dream
S_input = input()
S = S_input
for i in range(len(S_input)):
    S = S[:i]+S_input[len(S_input)-1-i]+S[i+1:]
#print(S)
#S_input = input()
    
#S = S_input[::-1]
end_flg = 1
while end_flg:
    if S.startswith('maerd'):
        S = S.replace('maerd', '', 1)
    elif S.startswith('remaerd'):
        S = S.replace('remaerd','',1)
    elif S.startswith('esare'):
        S = S.replace('esare','',1)
    elif S.startswith('resare'):
        S = S.replace('resare', '', 1)
    else:
        end_flg = 0
if len(S) == 0:
    print('YES')
else:
    print('NO')
def count(list):
    a,b=0,0
    for i in range(len(list)):
        if list[i][0]=='B':
            b+=1
        if list[i][-1]=='A':
            a+=1
    return min(a,b)
def check(string):
    c=0
    for i in range(len(string)-1):
        if string[i]=='A' and i+1<len(string) and string[i+1]=='B':
            c+=1
    return c
n=int(input())
m,l=0,[]
for i in range(n):
    s=input()
    m+=check(s)
    
    l.append(s)
m+=count(l)

print(m)
    


### FIXED CODE ###

m=list(map(int, input().strip().split()))
print(m[0]-m[1]+1)
import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]

DP = np.zeros(W+1, dtype=int)
# i 円以下で買える商品の最大価値
for i in range(N):
    DP[w[i]:] = np.maximum(DP[:-w[i]]+ v[i], DP[w[i]:])
    print(DP)
print(DP[-1])


### FIXED CODE ###

import numpy as np
N, W = map(int, input().split())
w, v = [], []
for i in range(N):
    a, b = map(int, input().split())
    w += [a]
    v += [b]
 
DP = np.ones(N*1000+1, dtype=int) *(W+1)
DP[0] = 0
#総価値 i 円を得るために最低限必要な重量
for i in range(N):
    DP[v[i]:] = np.minimum(DP[:-v[i]]+ w[i], DP[v[i]:])
ans = 0
for k in range(N*1000+1):
    if DP[k] <= W:
        ans = k
        
print(ans)
n=int(input())
d = {}
for i in range(26):
  d[chr(ord("a")+i)]=10**9
for i in range(n):
  s=input()
  for j in range(26):
    d[chr(ord("a")+i)]=min(d[chr(ord("a")+i)], s.count(chr(ord("a")+i)))

ans = ""
for e in d.items():
  ans+=e[0]*e[1]
print(ans)
  
  

### FIXED CODE ###

n=int(input())
d = {}
for i in range(26):
  d[chr(ord("a")+i)]=10**9
for i in range(n):
  s=input()
  for j in range(26):
    d[chr(ord("a")+j)]=min(d[chr(ord("a")+j)], s.count(chr(ord("a")+j)))

ans = ""
for e in d.items():
  ans+=e[0]*e[1]
print(ans)
N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sorted(reverse=True)
K = 0
for i in range(N):
  K += a[i]
if(a[M-1]>=K/(4*M)):
  print("Yes")
else:
  print("No")

### FIXED CODE ###

N, M = map(int,input().split())
a = list(map(int,input().split()))
a.sort(reverse=True)
K = 0
for i in range(N):
  K += a[i]
if(a[M-1]>=K/(4*M)):
  print("Yes")
else:
  print("No")
A, B = list(map(int, input().split()))

def calc_num(N):
  if N % 4 == 1:
    return (1, 0)
  if N % 4 == 2:
    return (N, 1)
  if N % 4 == 3:
    return (0, 0)
  return (N, 0)

A, subA = calc_num(A-1)
B, subB = calc_num(B)

A = [int(i) for i in str(bin(A)).split("b")[1]]
B = [int(i) for i in str(bin(B)).split("b")[1]]
A[-1] += subA
A[-1] %= 2
B[-1] += subB
B[-1] %= 2

if len(B) > len(A):
  temp = [0] * (len(B)-len(A))
  temp.extend(A)
  A = temp
#print(A)
#print(B)

res = [str((A[i]+B[i])%2) for i in range(len(A))]
#print(res)
print(int("".join(res), 2))


### FIXED CODE ###

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

def calc_num(N):
  if N==0:
    return 0
  if N % 4 == 1:
    return 1
  if N % 4 == 2:
    return N ^ 1
  if N % 4 == 3:
    return 0
  return N ^ 0

A = calc_num(A-1)
B = calc_num(B)

print(A^B)
n=int(input().split())
if n[1]%n[0]==0:
    print(n[0]+n[1])
else:
    print(n[1]-n[0])

### FIXED CODE ###

n=list(map(int,input().split()))
if n[1]%n[0]==0:
    print(n[0]+n[1])
else:
    print(n[1]-n[0])
N = int(input())
L = N % 10
if L == 3:
  print("bon")
#0
,
1
,
6
,
8

elif L == 0 or L == 1 or L == 6 or L == 8:
  print('pon')
else:
  print('hon')

### FIXED CODE ###

N = int(input())
L = N % 10
if L == 3:
  print("bon")
elif L == 0 or L == 1 or L == 6 or L == 8:
  print('pon')
else:
  print('hon')
A, B, C = map(int, input().split())
if A == B :
    print(C)
elif A == C :
    print(B) :
else :
    print(A)

### FIXED CODE ###

A, B, C = map(int, input().split())
if A == B :
    print(C)
elif A == C :
    print(B)
else :
    print(A)
import fractions

a,b,c,d = map(int, input().split())
print(a,b,c,d)
total = b-a+1
print(total)
lcm = c*d / fractions.gcd(c,d)
x = (b//c)) + (b//d) - (b//lcm)
y = ((a-1)//c) + ((a-1)//d) - ((a-1)//lcm)
print(x,y)
print(total - (x - y))


### FIXED CODE ###

import fractions

a,b,c,d = map(int, input().split())
#print(a,b,c,d)
total = b-a+1
#print(total)
lcm = int(c*d / fractions.gcd(c,d))
#print(lcm)
x = (b//c) + (b//d) - (b//lcm)
y = ((a-1)//c) + ((a-1)//d) - ((a-1)//lcm)
#print(x,y)
print(total - (x - y))
def ABC075C():
    N, M = map(int, input().split())
    graf = [[10000000 for i in range(N)] for j in range(N)]
    for i in range(M):
        graf[i][i] = 0
    inputs = []
    for i in range(M):
        a, b = map(int, input().split())
        inputs.append([a, b])
        graf[a - 1][b - 1] = 1
        graf[b - 1][a - 1] = 1
    import copy
    ans = 0
    for l in range(M):
        key = 1
        this_graf = copy.deepcopy(graf)
        this_graf[inputs[l][0] - 1][inputs[l][1] - 1] = 10000000
        this_graf[inputs[l][1] - 1][inputs[l][0] - 1] = 10000000
        for k in range(N):
            for i in range(N):
                for j in range(N):
                    this_graf[i][j] = min(this_graf[i][j], this_graf[i][k] + this_graf[k][j])
        for i in range(N):
            for j in range(N):
                if this_graf[i][j] >= 100000:
                    ans += 1
                    key = 1
                    break
            if key == 1:
                break

    print(ans)
ABC075C()

### FIXED CODE ###

def wf(this_graf):
    s = len(graf)
    for k in range(s):
        for i in range(s):
            for j in range(s):
                this_graf[i][j] = min(this_graf[i][j], this_graf[i][k] + this_graf[k][j])
    return this_graf

n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
graf = [[10 ** 10 for i in range(n)] for j in range(n)]

for i, j in ab:
    graf[i - 1][j - 1] = 1
    graf[j - 1][i - 1] = 1

import copy
cnt = 0

for i, j in ab:
    this_graf = copy.deepcopy(graf)
    tmp = 0
    this_graf[i - 1][j - 1] = 10 ** 10
    this_graf[j - 1][i - 1] = 10 ** 10
    this_graf = wf(this_graf)
    for i in range(n):
        for j in range(n):
            if this_graf[i][j] == 10 ** 10:
                tmp = 1
                break
        if tmp:
            break
    cnt += tmp

print(cnt)
# -*- coding: utf-8 -*-
if __name__ == '__main__':
    N = raw_input()
    A = map(int, raw_input().split())
    c_total = 1
    c_odd = 1
    for a in A:
            c_total *= 3
        if a % 2 == 0 and a != 100:
            c_odd *= 2
    print c_total - c_odd


### FIXED CODE ###

# -*- coding: utf-8 -*-
if __name__ == '__main__':
    N = raw_input()
    A = map(int, raw_input().split())
    c_total = 1
    c_odd = 1
    for a in A:
        c_total *= 3
        if a % 2 == 0:
            c_odd *= 2
    print c_total - c_odd
x = list(map(int,input().split()))
a = 0
b = x[1]+1
for i in range(x[0],x[1]+1):
    if i % x[2] ==0:
        a = 1
        b=i+x[2]
        break
while x[1]>=b:   
    b += x[2]
    a=a+1
print(a)

### FIXED CODE ###

x = list(map(int,input().split()))
a = 0
if x[0]%x[2]==0:
    b = x[0]
else:
     b = ((x[0] // x[2])+1)*x[2]
c = (x[1]-b)//x[2] + 1

print(c)
s = input()

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

t = []

for i in range(len(s)):
    if s[i] != 'x':
        t.append(s[i])

if t != t[::-1]:
    print(-1)
    exit()

central_char = t[len(t)//2]

s = list(s)
s.insert(0, '*')
s.append('*')

central_position = 0

for i in range(len(s)):
    if s[i] == central_char:
        central_position = i

left = central_position - 1
right = central_position + 1
x_cnt = 0

while left != 0 or right != len(s)-1:
    if s[max(0, left)] == s[min(len(s), right)]:
        left -= 1
        right += 1
    else:
        x_cnt += 1
        if s[max(0, left)] == 'x':
            left -= 1
        else:
            right += 1

print(x_cnt)

### FIXED CODE ###

s = input()

left = 0
right = len(s) - 1
x_cnt = 0

while left < right:
    if s[left] == s[right]:
        left += 1
        right -= 1
    else:
        if s[left] == 'x':
            x_cnt += 1
            left += 1
        elif s[right] == 'x':
            x_cnt += 1
            right -= 1
        else:
            print(-1)
            exit()

print(x_cnt)
import math
from functools import reduce


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


def lcm_list(numbers):
    return reduce(lcm_base, numbers, 1)


def main():
    n, m = map(int, input().split())
    a = list(map(int, input().split()))
    mul = lcm_list(a)

    if m > mul // 2:
        ans = (m - mul // 2) // mul + 1
        print(int(ans))
    else:
        print(0)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a
 
def div_ceil(x, y): return (x + y - 1) // y
 
N, M = map(int, input().split())
*A, = map(int, input().split())
A = list(set([a // 2 for a in A]))
L = A[0]
for a in A[1:]:
    L *= a // gcd(L, a)
for a in A:
    if (L // a) % 2 == 0:
        ans = 0
        break
else:
    ans = div_ceil(M // L, 2)
print(ans)
H,W = map(int,input().split())
field = [input() for x in range(H)]
vx = [0,0,1,-1]
vy = [1,-1,0,0]
reached = [[-1 for x in range(W)]for x in range(H)]
from collections import deque
def bfs(y,x):
    q = deque([[y,x]])
    reached[y][x] = 1
    try:
        while q:
            y,x = q.popleft()
            if [y,x] == [H-1,W-1]:
                return reached[y][x]
            for dy,dx in zip(vy,vx):
                ny,nx = y+dy,x+dx
                if not (0<=ny<H and 0<=nx<W):
                    continue
                if field[ny][nx] == '.' and reached[ny][nx] == -1:
                    q.append([ny,nx])
                    reached[ny][nx] = reached[y][x] + 1
    except:
        return -1
bk = 0
for x in field:
    for y in x:
        if y == '#':
            bk += 1
print(H*W-bfs(0,0)-bk)


### FIXED CODE ###

H,W = map(int,input().split())
field = [input() for x in range(H)]
vx = [0,0,1,-1]
vy = [1,-1,0,0]
reached = [[-1 for x in range(W)]for x in range(H)]
from collections import deque
def bfs(y,x):
    q = deque([[y,x]])
    reached[y][x] = 1

    while q:
        y,x = q.popleft()
        if [y,x] == [H-1,W-1]:
            return reached[y][x]
        for dy,dx in zip(vy,vx):
            ny,nx = y+dy,x+dx
            if not (0<=ny<H and 0<=nx<W):
                continue
            if field[ny][nx] == '.' and reached[ny][nx] == -1:
                q.append([ny,nx])
                reached[ny][nx] = reached[y][x] + 1
    return -1
bk = 0
for x in field:
    for y in x:
        if y == '#':
            bk += 1
ans = bfs(0,0)
if ans==-1:
    print(-1)
else:
    print(H*W-ans-bk)
INF = 10 ** 18
N, M = map(int, input().split())
abc = []
d = [INF] * N
d[0] = 0
loop = [False] * N

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

for j in range(N):
    for i in range(M):
        if d[abc[i][1]] > d[abc[i][0]] + abc[i][2]:
            d[abc[i][1]] = d[abc[i][0]] + abc[i][2]
ans = -1 * d[-1]

for i in range(N):
    for j in range(M):
        if d[abc[i][0]] != INF and d[abc[j][1]] > d[abc[j][0]] + abc[j][2]:
            d[abc[j][1]] = d[abc[j][0]] + abc[j][2]
            loop[abc[j][1]] = True

        if loop[abc[j][0]] == True:
            loop[abc[j][1]] = True

if loop[N - 1]:
    print('inf')
else:
    print(ans)

### FIXED CODE ###

INF = 10 ** 18
N, M = map(int, input().split())
abc = []
d = [INF] * N
d[0] = 0
loop = [False] * N

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

for j in range(N):
    for i in range(M):
        if d[abc[i][1]] > d[abc[i][0]] + abc[i][2]:
            d[abc[i][1]] = d[abc[i][0]] + abc[i][2]
ans = -1 * d[-1]

for i in range(N):
    for j in range(M):
        if d[abc[j][1]] > d[abc[j][0]] + abc[j][2]:
            d[abc[j][1]] = d[abc[j][0]] + abc[j][2]
            loop[abc[j][1]] = True

        if loop[abc[j][0]] == True:
            loop[abc[j][1]] = True

if loop[N - 1]:
    print('inf')
else:
    print(ans)
n=int(input())
k=int(input())
j=0
for i in range(100,-1,-1):
  if(int(n%pow(10,i))==0):
  else:
    s.append(int(n%pow(10,i)))
    n-=s[j]
    j+=1
if(s[0]=1):
  print(s[1])
else:
  print(s[0])

### FIXED CODE ###

#coding:utf-8
n=input()
count=0
l=int(input())
for i in range(len(n)):
  if(n[i]=='1'):
    count+=1
    if(l==count):
      print(n[i])
      break;
    continue
  else:
    print(n[i])
    break;
import sys
input = lambda: sys.stdin.readline().rstrip()
from itertools import accumulate


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

S = input()

if len(S) == 1:
    print('1')
    exit()

cum_sum = [0]

tmp_S = S

if S[-1] == '0':
    tmp_S += '1'
else:
    tmp_S += '0'

cnt = 1
for i in range(len(tmp_S)-1):
    if tmp_S[i] == tmp_S[i+1]:
        cnt += 1
    else:
        cum_sum.append(cnt)
        cnt = 1

print(*cum_sum)
cum_sum = list(accumulate(cum_sum))
print(*cum_sum)

ans = 0
ran = K+K
if S[0] == '0':
    for i in range(0, len(cum_sum), 2):
        if i+ran < len(cum_sum):
            ans = max(ans, cum_sum[i+ran] - cum_sum[i])
else:
    for i in range(0, len(cum_sum), 2):
        if i+ran < len(cum_sum):
            ans = max(ans, cum_sum[i+ran+1] - cum_sum[i])

print(ans)

### FIXED CODE ###

import sys
input = lambda: sys.stdin.readline().rstrip()
from itertools import accumulate

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

S = input()


num = []

if S[0] == '0':
    num.append(0)

if S[-1] == '1':
    S += '0'
else:
    S += '1'    

cnt = 1
for i in range(len(S)-1):
    if S[i] == S[i+1]:
        cnt += 1
    else:
        num.append(cnt)
        cnt = 1 
if S[-2] == '0':
    num.append(0)

num = [0] + num
cum_sum = list(accumulate(num))

ans = 0

for i in range(0, len(cum_sum), 2):
    right = i + K * 2 + 1
    if i + K * 2 >= len(cum_sum): 
        right = len(cum_sum) - 1

    ans = max(ans, cum_sum[right] - cum_sum[i])
print(ans)