Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

from collections import deque
H, W = map(int, input().split())
cy, cx = map(int, input().split())
dy, dx = map(int, input().split())
cy -= 1
cx -= 1
dy -= 1
dx -= 1

S = [list(input().strip()) for _ in range(H)]

worps = [[float('inf')]*W for _ in range(H)]
used = [[False]*W for _ in range(H)]
q = deque([[cy, cx]])

worp = 0
while q:
    v = [[False]*W for _ in range(H)]
    while q:
        y, x = q.popleft()
        used[y][x] = True
        worps[y][x] = min(worps[y][x], worp)

        for h in range(-2+y, 3+y):
            for w in range(-2+x, 3+x):
                if 0 <= h and h < H and 0 <= w and w < W and S[h][w] == "." and not used[h][w]:
                    v[h][w] = True

        for h, w in [[0, 1], [0, -1], [1, 0], [-1, 0]]:
            ny, nx = y+h, x+w
            if 0 <= ny and ny < H and 0 <= nx and nx < W:
                if not used[ny][nx] and S[ny][nx] == ".":
                    q.append([ny, nx])

    worp += 1
    for h in range(H):
        for w in range(W):
            if v[h][w] and not used[h][w]:
                q.append([h, w])
                used[h][w] = True

ans = worps[dy][dx]
if ans != float('inf'):
    print(ans)
else:
    print(-1)


### FIXED CODE ###

from collections import deque
H, W = map(int, input().split())
cy, cx = map(int, input().split())
dy, dx = map(int, input().split())
cy -= 1
cx -= 1
dy -= 1
dx -= 1
d = [[0, 1], [0, -1], [1, 0], [-1, 0]]
S = [input() for _ in range(H)]

worps = [[float('inf')]*W for _ in range(H)]
q = deque([[cy, cx]])

worps[cy][cx] = 0
while q:
    y, x = q.popleft()
    worp = worps[y][x]

    for h, w in d:
        ny, nx = y+h, x+w
        if 0 <= ny < H and 0 <= nx < W and S[ny][nx] == "." and worp < worps[ny][nx]:
            worps[ny][nx] = worp
            q.appendleft([ny, nx])

    worp += 1
    for h in range(-2+y, 3+y):
        for w in range(-2+x, 3+x):
            if 0 <= h < H and 0 <= w < W and S[h][w] == "." and worp < worps[h][w]:
                worps[h][w] = worp
                q.append([h, w])

ans = worps[dy][dx]
if ans != float('inf'):
    print(ans)
else:
    print(-1)
### BUGGY CODE ###

from collections import deque, Counter
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math

sys.setrecursionlimit(10 ** 8)
# mem = {}

M = 10 ** 9 + 7


def f(rs, gs, bs):
    res = 0
    for i in rs:
        for j in reversed(gs):
            if not (i < j):
                break
            for k in reversed(bs):
                if not (i < k):
                    break
                if j < k:
                    if (j - i) != k - j:
                        res += 1
                else:
                    if (k - i) != j - k:
                        res += 1

    return res
    # ir,ig,ib=(0,0,0)
    # while True:
    #     i= rs[ir]
    #     j= gs[ig]
    #     k= bs[ib]
    #     if i<j and j<k and (j-i)!=k-j:
    #         res+=1
    #


def main():
    N = int(input())
    S = input()

    rs = []
    gs = []
    bs = []

    for i, c in enumerate(S):
        if c == 'R':
            rs.append(i)
        elif c == 'G':
            gs.append(i)
        else:
            bs.append(i)
    print(f(rs, gs, bs) + f(gs, rs, bs) + f(bs, rs, gs))


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque, Counter
from itertools import chain, combinations
import json
# import numpy as np
import bisect
import sys
import math
import bisect

sys.setrecursionlimit(10 ** 8)
# mem = {}

M = 10 ** 9 + 7


def f(rs, gs, bs):
    res = 0
    lgs = len(gs)
    lbs = len(bs)
    for i in rs:
        j = bisect.bisect_left(gs, i)
        k = bisect.bisect_left(bs, i)
        res += (lgs - j) * (lbs - k)

        for jj in range(j, lgs):
            d = (gs[jj] - i)
            index = bisect.bisect_left(bs, i + 2 * d)
            if index != lbs:
                if bs[index] == i + 2 * d:
                    res -= 1

        for kk in range(k, lbs):
            d = (bs[kk] - i)
            index = bisect.bisect_left(gs, i + 2 * d)
            if index != lgs:
                if gs[index] == i + 2 * d:
                    res -= 1


        # for j in reversed(gs):
        #     if not (i < j):
        #         break
        #     for k in reversed(bs):
        #         if not (i < k):
        #             break
        #         if j < k:
        #             if (j - i) != k - j:
        #                 res += 1
        #         else:
        #             if (k - i) != j - k:
        #                 res += 1

    return res


def main():
    N = int(input())
    S = input()

    rs = []
    gs = []
    bs = []

    for i, c in enumerate(S):
        if c == 'R':
            rs.append(i)
        elif c == 'G':
            gs.append(i)
        else:
            bs.append(i)
    print(f(rs, gs, bs) + f(gs, rs, bs) + f(bs, rs, gs))


if __name__ == "__main__":
    main()
### BUGGY CODE ###

MOD = 998244353
class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0

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

n = min(K // A + 2, N + 1)

lst = Factorial(N + 1, MOD)
N_factrorial = lst.factorial(N)
# print (N_factrorial)

def calc(a, b):
    tmp = 0
    G = min(a, b) + 1 #緑色の最大値 + 1
    # print ('G=', G)
    for green in range(G):
        red = a - green
        blue = b - green
        none_color = N - red - green - blue
        # print (red, green, blue, none_color)
        if none_color < 0:
            continue
        tmp += ((((N_factrorial * lst.ifactorial(red) % MOD) * lst.ifactorial(green) % MOD) * lst.ifactorial(blue) % MOD) * lst.ifactorial(none_color) % MOD)
        tmp %= MOD
    return tmp

def count(a, b):
    if a + b > 2 * N:
        return 0
    # print ('to calc')
    return calc(a, b)

ans = 0
for a in range(n): #Aの数
    if A * a > K:
        continue
    if (K - A * a) % B != 0:
        continue
    b = (K - A * a) // B
    # print ('a=', a, 'b=', b)
    ans += count(a, b)
    ans %= MOD

print (ans)



### FIXED CODE ###

import numpy as np
MOD = 998244353

class Factorial:
    def __init__(self, n, mod):
        self.f = [1]
        self.mod = mod
        for j in range(1, n + 1):
            self.f.append(self.f[-1] * j % mod)
        self.i = [pow(self.f[-1], mod - 2, mod)]
        for j in range(n, 0, -1):
            self.i.append(self.i[-1] * j % mod)
        self.i.reverse()
    def factorial(self, j):
        return self.f[j]
    def ifactorial(self, j):
        return self.i[j]
    def comb(self, n, k):
        return self.f[n] * self.i[n - k] % self.mod * self.i[k] % self.mod if n >= k else 0

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

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

if A < B:
    A, B = B, A

# n = 2 * min(K // A + 2, N + 1) + 3
n = min((K + A - 1) // A, N) + 1
lcm = A * B // gcd(A, B)
step = lcm // A

c = Factorial(N + 1, MOD).comb #O(N)

def calc(a, b):
    if a > b:
        a, b = b, a #必ずaのほうが小さくなる
    return (c(N, a) * c(N, b)) % MOD


def count(a, b):
    if a <= N and b <= N:
        return calc(a, b)
    return 0

def maike_satrt(step):
    for i in range(step):
        if (K - A * i) % B == 0:
            return i

start = maike_satrt(step)
# print (start, n)
ans = 0
for a in range(start, n, step): #Aの数
    if A * a > K:
        break
    # if (K - A * a) % B != 0:
    #     continue
    b = (K - A * a) // B
    # print ('a=', a, 'b=', b)
    ans += count(a, b)
    ans %= MOD

print (ans)
### BUGGY CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

cnt = Counter(A)
flg = False
for a in A:
   if A.count(a) > 1:
      flg = True

if not flg:
  print("YES")
else:
  print("NO")


### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n = I()

A = FLI()

flg = len(set(A)) == n

print("YES" if flg else "NO")
### BUGGY CODE ###

from itertools import combinations

n = int(input())
l = list(map(int, input().split()))
l.sort()
comb = list(combinations(l,3))

ans = 0
for c in comb:
    if c[0] + c[1] - c[2] > 0:
        ans += 1

print(ans)


### FIXED CODE ###

n = int(input())
l = list(map(int, input().split()))
l.sort()

ans = 0
for i in range(len(l)):
    right = i+1
    for left in range(i+1, len(l)):
        while right+1 < len(l) and l[right+1] < l[left] + l[i]:
            right += 1
        ans += right - left
        if right == left:
            right += 1

print(ans)
### BUGGY CODE ###

import bisect
N=int(input())
S=input()
R,G,B=[],[],[]
for i in range(N):
    if S[i]=='R':
        R.append(i)
    elif S[i]=='G':
        G.append(i)
    elif S[i]=='B':
        B.append(i)
ans=0
for i in range(N):
    for j in range(i):
        if(S[i]==S[j]):
            continue
        else:
            s=set([S[i],S[j]])
        if('B' not in s):
            lon=len(B)-bisect.bisect_left(B,i)
            mi=bisect.bisect_left(B,i+i-j)
            if(mi<len(B) and B[mi]==i+i-j):
                lon-=1
        elif('R' not in s):
            lon=len(R)-bisect.bisect_left(R,i)
            mi=bisect.bisect_left(R,i+i-j)
            if(mi<len(R) and R[mi]==i+i-j):
                lon-=1
        elif('G' not in s):
            lon=len(G)-bisect.bisect_left(G,i)
            mi=bisect.bisect_left(G,i+i-j)
            if(mi<len(G) and G[mi]==i+i-j):
                lon-=1
        ans+=lon
        
print(ans)

### FIXED CODE ###

import bisect
import sys
input=sys.stdin.readline
def main():
    N=int(input())
    S=input().rstrip()
    R,G,B=[],[],[]
    for i in range(N):
        if S[i]=='R':
            R.append(i)
        elif S[i]=='G':
            G.append(i)
        elif S[i]=='B':
            B.append(i)
    ans=0
    for i in range(N):
        for j in range(i):
            if(S[i]==S[j]):
                continue
            s=set([S[i],S[j]])
            if('B' not in s):
                lon=len(B)-bisect.bisect_left(B,i)
                mi=bisect.bisect_left(B,i+i-j)
                if(mi<len(B) and B[mi]==i*2-j):
                    lon-=1
            elif('R' not in s):
                lon=len(R)-bisect.bisect_left(R,i)
                mi=bisect.bisect_left(R,i+i-j)
                if(mi<len(R) and R[mi]==i*2-j):
                    lon-=1
            elif('G' not in s):
                lon=len(G)-bisect.bisect_left(G,i)
                mi=bisect.bisect_left(G,i+i-j)
                if(mi<len(G) and G[mi]==i*2-j):
                    lon-=1
            ans+=lon
        
    print(ans)
    
if __name__=='__main__':
    main()
### BUGGY CODE ###

line1 = int(input())



line2 = input()
literal = list(line2)


cnt =0
jud = []
for i in range(line1):
  for s in range(line1):
    for t in range(line1):
      jud = [literal[i],literal[s], literal[t]]
      if (jud[0] !=jud[1]) and (jud[1]!=jud[2]) and (jud[0] !=jud[2]):
        if s -i !=t-s and i<s and s<t:
          cnt +=1
          
print(cnt)
       

    


### FIXED CODE ###

import itertools
N = int(input())
S = input()
#Rc1,Gc1,Bc1
out = S.count('R') * S.count('G') * S.count('B')

RGBs = list(itertools.permutations(['R', 'G', 'B'], 3))

for i in range(1, N):
  for j in range(N-i*2):
    #三つ連続であり、RGBで構成されている
    if (S[j], S[j+i], S[j+i*2]) in RGBs:
      out -= 1
print(out)
### BUGGY CODE ###

n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a

n2=n//4
n3=n-n2*4

y1=[]
y2=[]
y3=[]
y4=[]
for i in range(n2):
    y1.append(x[i])
    y2.append(x[i+n2])
    y3.append(x[i+n2*2])
    y4.append(x[i+n2*3])
#    y5.append(x[i+n2*4])
#    y6.append(x[i+n2*5])
#    y7.append(x[i+n2*6])
#    y8.append(x[i+n2*7])
y9=[]
for i in range(n3):
    y9.append(x[i+n2*4])
    

# itertools 使用 bit全探索
import itertools

def xdic(n2,xx):
    xsum=dict()
    for i in itertools.product([0,1], repeat=n2):
        isum=0
        for ii in range(n2):
            if i[ii]==0:
                isum=isum+xx[ii]
        if isum in xsum:
            xsum[isum]=xsum[isum]+1
        else:
            xsum[isum]=1
    return xsum

xsum1=xdic(n2,y1)
xsum2=xdic(n2,y2)
xsum3=xdic(n2,y3)
xsum4=xdic(n2,y4)
#xsum5=xdic(n2,y5)
#xsum6=xdic(n2,y6)
#xsum7=xdic(n2,y7)
#xsum8=xdic(n2,y8)
xsum9=xdic(n3,y9)
  
#xsum[0]=xsum[0]
#print(xsum)        
    
icnt=0
for xs1 in xsum1.items():
    for xs2 in xsum2.items():
        for xs3 in xsum3.items():
            for xs4 in xsum4.items():
                for xs9 in xsum9.items():
                    if xs1[0]+xs2[0]+xs3[0]+xs4[0]+xs9[0]==0:
                        icnt=icnt+xs1[1]*xs2[1]*xs3[1]*xs4[1]*xs9[1]

print(icnt-1)                        


### FIXED CODE ###

n,a=map(int,input().split())
x=list(map(int,input().split()))

for i in range(n):
    x[i]=x[i]-a
    
nx=n*n
dp=[[0]*(2*nx+1) for i in range(n+1)]

#print(dp)

dp[0][nx]=1

for j in range(1,n+1):
    jj=j-1
    for t in range(2*nx+1):
        if t-x[jj]<0 or 2*nx<t-x[jj]:
            dp[j][t]=dp[j-1][t]
        elif 0<t-x[jj] and  t-x[jj]<2*nx:
            dp[j][t]=dp[j-1][t]+dp[j-1][t-x[jj]]
        else:
            dp[j][t]=0

print(dp[n][nx]-1)
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))
m = [0] * n
m[0] = 0
for i in range(1, n):
    t = k if i >= k else i
    m[i] = min(m[i - j - 1] + abs(h[i - j - 1] - h[i]) for j in range(t))
print(m[n-1])


### FIXED CODE ###

def main():
    n, k = map(int, input().split())
    h = list(map(int, input().split()))
    m = [0] * n
    m[0] = 0
    for i in range(1, n):
        m[i] = min(m[j] + abs(h[j] - h[i]) for j in range(max(0, i-k),i))
    print(m[-1])

main()
### BUGGY CODE ###

h,w = map(int,input().split())
grid = []
for i in range(h):
    grid.append(list(map(int,input().split())))
for i in range(h):
    lst = list(map(int,input().split()))
    for j in range(w):
        grid[i][j] = abs(grid[i][j]-lst[j])
lst = [[set() for _ in range(w)] for _ in range(h)]
lst[0][0].add(grid[0][0])
for j in range(1,w):
    for x in lst[0][j-1]:
        lst[0][j].add(abs(grid[0][j]-x))
        if grid[0][j] + x <= 6400:
            lst[0][j].add(grid[0][j]+x)
for i in range(1,h):
    for x in lst[i-1][0]:
        lst[i][0].add(abs(grid[i][0]-x))
        if grid[i][0] + x <= 6400:
            lst[i][0].add(grid[i][0]+x)
for i in range(1,h):
    for j in range(1,w):
        for x in lst[i][j-1]:
            lst[i][j].add(abs(grid[i][j]-x))
            if grid[i][j] + x <= 6400:
                lst[i][j].add(grid[i][j]+x)
        for x in lst[i-1][j]:
            lst[i][j].add(abs(grid[i][j]-x))
            if grid[i][j] + x <= 6400:
                lst[i][j].add(grid[i][j]+x)
print(min(lst[h-1][w-1]))

### FIXED CODE ###

import time
t1 = time.time()
h,w = map(int,input().split())
grid = []
for i in range(h):
    grid.append(list(map(int,input().split())))
for i in range(h):
    lst = list(map(int,input().split()))
    for j in range(w):
        grid[i][j] = abs(grid[i][j]-lst[j])
lst = [[set() for _ in range(w)] for _ in range(h)]
lst[0][0].add(grid[0][0])
for j in range(1,w):
    for x in lst[0][j-1]:
        lst[0][j].add(abs(grid[0][j]-x))
        if (grid[0][j] + x) <= 6400:
            lst[0][j].add(grid[0][j]+x)
for i in range(1,h):
    for x in lst[i-1][0]:
        lst[i][0].add(abs(grid[i][0]-x))
        if grid[i][0] + x <= 6400:
            lst[i][0].add(grid[i][0]+x)
for i in range(1,h):
    for j in range(1,w):
        for x in lst[i][j-1]:
            lst[i][j].add(abs(grid[i][j]-x))
            if grid[i][j] + x <= 6400:
                lst[i][j].add(grid[i][j]+x)
        for x in lst[i-1][j]:
            lst[i][j].add(abs(grid[i][j]-x))
            if grid[i][j] + x <= 6400:
                lst[i][j].add(grid[i][j]+x)
        t = time.time()
        if t - t1 > 1.8:
            print(0)
            exit()
print(min(lst[h-1][w-1]))
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
res = 0
all_p = N*(N-1)*(N-2)/6

for i in range(N):
  for j in range(i+1, N):
    for k in range(j+1, N):
      if L[i] >= L[j]+L[k] or L[j] >= L[i]+L[k] or L[k] >= L[i]+L[j]:
        res += 1
        
print(int(all_p - res))

### FIXED CODE ###

from bisect import bisect_left

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

L.sort()
result = 0
for i in range(N - 2):
    for j in range(i + 1, N - 1):
        result += bisect_left(L, L[i] + L[j]) - j - 1
print(result)
### BUGGY CODE ###

# ABC 051 B Sum of Three Integers

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

res = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z == s:
                res += 1

print(res)

### FIXED CODE ###

# ABC 051 B Sum of Three Integers

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

res = 0

for x in range(k+1):
    for y in range(k+1):
        if 0 <= s-x-y <= k:
            res += 1
    
    
print(res)
### BUGGY CODE ###

import numpy as np
inf = np.iinfo(np.uint32).max

# def solve():
#     dxy = abs(x - y)
#     for j in range(3, n+1):
#         ans = max(n - dxy - j + 1, 0) # 0 -> XY -> N
#         print(ans)
#         if j*2 <= dxy + 1:
#             ans += dxy + 1
#         print(ans)
#         for bit1 in [x-1, n-y]:
#             bit2 = ceildiv(dxy - 1, 2)
#             print(j, bit1, bit2)
#             ans += max(min(j - 1, bit1, bit2) , 0)
#             ans += max(min(j - 2, bit1, bit2) , 0)
#         print(ans)
#         if j==1:
#             ans-=1
#         exit()
#         print(j, ans)

def solve():
    min_dists = np.full((n, n), inf)
    count_dists = np.zeros(n+1, dtype=int)
    for a in range(1,n+1):
        for b in range(1,n+1):
            dis = min(abs(b-a), abs(x-a)+ abs(y-b) + 1, abs(y-a) + abs(x-b) + 1)
            min_dists[a-1,b-1] = dis
            count_dists[dis] += 1
    #print(min_dists)
    for j in range(1,n):
        print(count_dists[j]//2)



def ceildiv(a, b):
    return a // b + a % b




n, x, y = [int(i) for i in input().split(" ")]
solve()

### FIXED CODE ###

import numpy as np

inf = np.iinfo(np.uint32).max



# def solve():
#     dists_y = [abs(y-a) for a in range(0,n+1)]
#     dists_x = [abs(x-a) for a in range(0,n+1)]
#     count_dists = np.zeros(n+1, dtype=int)
#     for a in range(1,n+1):
#         for b in range(1,a+1):
#             dis = min(abs(b-a), dists_x[a] + dists_y[b] + 1, dists_y[a] + dists_x[b] + 1)
#             count_dists[dis] += 1
#     #print(min_dists)
#     for j in range(1,n):
#         print(count_dists[j])

def solve():
    dists_y = [abs(y-a) for a in range(1,n+1)]
    dists_x = [abs(x-a) for a in range(1,n+1)]

    aa = np.tile(np.arange(1, n+1), (n, 1))
    bb = aa.transpose().copy()
    base_dists = np.abs(aa-bb).copy()
    aa = np.tile(dists_y, (n, 1))
    bb = np.tile(dists_x, (n, 1)).transpose().copy()
    ab_dists = aa + bb + 1
    ba_dists = ab_dists.transpose().copy()
    min_dists = np.minimum(ab_dists, ba_dists)
    min_dists = np.minimum(min_dists, base_dists)
    count_dists = np.bincount(min_dists.reshape(n**2))
    for j in range(1,n):
        if j+1>len(count_dists):
            print(0)
        else:
            print(count_dists[j]//2)



#
# def ceildiv(a, b):
#     return a // b + a % b



n, x, y = [int(i) for i in input().split(" ")]

# import time
# t = time.time()
# n, x, y = 2000, 200, 600


solve()
#print(time.time()- t)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

import math

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

if "1"*M in S:
  print(-1)
  exit()  

S = [int(S[i]) for i in range(N+1)]

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N+1):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(len(bin(b))-2)

now = N
deme = []
while now > 0:
  x = max_n[now]
  if x == 0:
    print(-1)
    exit()
  now = now-x
  deme.append(x)
print(*deme[::-1])

### FIXED CODE ###

import sys
input = sys.stdin.readline

import math
import bisect

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

if "1"*M in S:
  print(-1)
  exit()  

S = [int(S[i]) for i in range(N+1)]

L = [(1<<i) -1 for i in range(1,M+1)]

max_n = [0]
mask = (1<<M) -1
b = 0
for i in range(N):
  b = ((b<<1) + (1- S[i])) & mask
  max_n.append(bisect.bisect_left(L,b)+1)

now = N
deme = []
while now != 0:
  x = max_n[now]
  now -= x
  deme.append(x)
print(*deme[::-1])
### BUGGY CODE ###

import numpy as np

n = int(input())
a = list(map(int, input().split()))
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

a = np.array(a)
for num, rep in zip(b, c):
    if num in set(a):
        a = np.where(a == num, rep, a)
        print(sum(a))
    else:
        print(sum(a))
        continue

### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
X = Counter(a)
q = int(input())
b = [0 for _ in range(q)]
c = [0 for _ in range(q)]
for i in range(q):
    b[i], c[i] = map(int, input().split())

ans = sum(a)
for num, rep in zip(b, c):
    ans += (rep * X[num] - num * X[num])
    X[rep] += X[num]
    del(X[num])
    print(ans)
### BUGGY CODE ###

a,b,c = map(int, input().split())
count = 0
while (count != c) or (b < a):
    count += 1
    b = b - a
print(count)

### FIXED CODE ###

a,b,c = map(int, input().split())
print(min(b // a,c))
### BUGGY CODE ###

h,w=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(h)]
b=[list(map(int,input().split()))for _ in range(h)]
c=[[abs(a[i][j]-b[i][j]) for j in range(w)]for i in range(h)]
dp=[[[False]*25601 for _ in range(w+1)]for _ in range(h+1)]
dp[0][1][12800]=True
for i in range(1,h+1):
    for j in range(1,w+1):
        t=c[i-1][j-1]
        for k in range(25601):
            if t<=k:dp[i][j][k]|=dp[i-1][j][k-t]|dp[i][j-1][k-t]
            if 25600>=t+k:dp[i][j][k]|=dp[i-1][j][k+t]|dp[i][j-1][k+t]
ans=10**20
for i in range(25601):
    if dp[h][w][i]:
        ans=min(ans,abs(12800-i))
print(ans)


### FIXED CODE ###

h,w=map(int,input().split())
a=[list(map(int,input().split()))for _ in range(h)]
b=[list(map(int,input().split()))for _ in range(h)]
d=[[a[i][j]-b[i][j]for j in range(w)]for i in range(h)]
dp=[w*[0]for _ in range(h)]
dp[0][0]=1<<(80+d[0][0])|1<<(80-d[0][0])
for i in range(h):
  for j in range(w):
    if i!=0:
      dp[i][j]|=(dp[i-1][j]<<80+d[i][j])
      dp[i][j]|=(dp[i-1][j]<<80-d[i][j])
    if j!=0:
      dp[i][j]|=(dp[i][j-1]<<80+d[i][j])
      dp[i][j]|=(dp[i][j-1]<<80-d[i][j])
n=dp[-1][-1]|(1<<15000)
ans=1<<1000
for i in range(15000):
  if n&(1<<i):ans=min(ans,abs(i-(h+w-1)*80))
print(ans)