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

s = input()
t = input()
N = len(s)

if t in s:
    print(s.find(t) + len(t))
else:
    schr = dict()
    for i in range(N):
        if s[i] in schr:
            schr[s[i]].append(i+1) 
        else:
            schr[s[i]] = [i+1]

    schrset = set(schr)
    ans, pos, pre = 0, 0, "#"
    for i in range(len(t)):
        if t[i] in schrset:
            c = schr[t[i]]
            if c[-1] <= pos:
                ans += N - pos + c[0]
                pos = c[0]
            else:
                if pre != t[i]:
                    j = 0
                while c[j] <= pos:
                    j += 1
                ans += c[j] - pos
                pos = c[j]
        else:
            print(-1)
            exit()
    print(ans)

### FIXED CODE ###

s = input()
t = input()
N, M = len(s), len(t)

schr, indchr = dict(), dict()
for i in range(N):
    if s[i] in schr:
        schr[s[i]].append(i+1) 
    else:
        schr[s[i]] = [i+1]
        indchr[s[i]] = 0

schrset = set(schr)
ans, pos, pre, back = 0, 0, set(), True
for i in range(M):
    if t[i] in schrset:
        c = schr[t[i]]
        if c[-1] <= pos:
            ans += N - pos + c[0]
            pos = c[0]
            if not back:
                for x in indchr.keys():
                    indchr[x] = 0
                back, pre = True, set()
        else:
            j = indchr[t[i]]
            while c[j] <= pos:
                j += 1
            if j > 0:
                pre.add(t[i])
            ans += c[j] - pos
            pos, back, indchr[t[i]] = c[j], False, j
    else:
        print(-1)
        exit()
print(ans)
### BUGGY CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
B = []
result = []
for a in P:
    B.append(a/2+0.5)

for i in range(len(P)-K+1):
    result.append(sum(B[i:i+K]))

print(max(result))

### FIXED CODE ###

N, K = map(int, input().split())
P = list(map(int, input().split()))
result = 0
B = [a / 2 + 0.5 for a in P]

result = sum(B[0:K])
t = sum(B[0:K])
for i in range(N-K):
    t -= B[i]
    t += B[i+K]
    if t > result:
        result = t

print(result)
### BUGGY CODE ###

def reduce_mul(s,e):
     a = 1
     for i in range(s,e+1):
          a = a*i
     return a
     
def cmb(n,r):
    r = min(n-r,r)
    if r == 0: return 1
    over = reduce_mul(n-r+1,n)
    under = reduce_mul(1,r)
    return over // under

n,m,k = map(int,input().split())
nm = n*m%(10**9+7)
k = k%(10**9+7)
a = (cmb(nm-2,k-2)%(10**9+7))*(nm*(m*(n**2-1)+n*(m**2-1)))//6
print(a%(10**9+7))

### FIXED CODE ###

def cmb(n, r, mod):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 10**6
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

n,m,k = map(int,input().split())
nm = n*m%(10**9+7)
k = k%(10**9+7)
a = (cmb(nm-2,k-2,mod)%(10**9+7))*(nm*(m*(n**2-1)+n*(m**2-1)))//6
print(a%(10**9+7))
### BUGGY CODE ###

a = int(input())
ar = list(map(int,input().split(" ")))
mi = a
br = set(ar)
count = 0
for r in br:
    if r > ar.count(r):
        count += ar.count(r)
    elif r < ar.count(r):
        count += ar.count(r) - r
print(count)
        

### FIXED CODE ###

import collections
a = int(input())
ar = list(map(int,input().split(" ")))
br = collections.Counter(ar)
cr = set(ar)
count = 0
for r in cr:
    if br[r] < r:
        count += br[r]
    elif br[r] >= r:
        count += br[r] - r
print(count)
### BUGGY CODE ###

a,b = map(int,input().split())
def XOR(start,end):
  xor =  start
  for i in range(a+1,b+1):
    xor = xor^i
    #print(xor)
  print(xor)

if __name__ ==  '__main__':
  XOR(a,b)
    


### FIXED CODE ###

a,b = map(int,input().split())
def XOR(start,end):
  xor =  start
  if end-start < 10:
      for i in range(a+1,b+1):
        xor = xor^i
        #print('end={0},xor={1}'.format(i,xor))
      print(xor)
  else:
    if start%2==0:
      new_start = start-1
    else:
      new_start = start
    
    if (end - new_start)%4==0:
      if start%2==0:
        print(0)
      else:
        print(start)
    elif (end - new_start)%4==1:
      if start%2==0:
        print(end)
      else:
        print(start^end)
    elif (end - new_start)%4==2:
      if start%2==0:
        print((end-1)^end)
      else:
        print(start^(end-1)^end)
    else:
      if start%2==0:
        print((end-2)^(end-1)^end)
      else:
        print(start^(end-2)^(end-1)^end)

if __name__ ==  '__main__':
  XOR(a,b)
### BUGGY CODE ###

import sys
import heapq 
input = sys.stdin.readline
n,m = map(int,input().split())
alwork = {}
w = []
hpop = heapq.heappop
hpush = heapq.heappush
ans = 0

for i in range(n):
  a,b = map(int,input().split())
  if a not in alwork:
    alwork[a] = (-b,)
  else:
    alwork[a] += (-b,)

for i in range(1,m+1):
  if i in alwork:
    for j in alwork[i]:
      hpush(w,j)
  if w:
    ans += hpop(w)
print(-ans)

### FIXED CODE ###

import sys
import heapq 
input = sys.stdin.readline
n,m = map(int,input().split())
l=[tuple(map(int,input().split())) for i in range(n)]
l.sort(reverse=True)

w = []
hpop = heapq.heappop
hpush = heapq.heappush
ans = 0

for i in range(1,m+1):
  while l and l[-1][0]==i:
    hpush(w,-l.pop()[1])
  if w:
    ans += hpop(w)
print(-ans)
### BUGGY CODE ###

N = int(input())
X = input()
MOD = len(list(filter(lambda x:x=='1', X)))

for i in range(N):
    c = 0
    tmp = X[:i] + ('1' if X[i] == '0' else '0') + X[i+1:]
    tmp = int(tmp, 2)
    while tmp:
        MOD = len(list(filter(lambda x:x=='1', format(tmp, 'b'))))
        tmp = tmp % MOD
        c += 1
    print(c)


### FIXED CODE ###

N = int(input())
X = input()
tmp = bin(int(X, 2)).count("1")
big = int(X, 2) % (tmp + 1)
small = int(X, 2) % (tmp - 1) if tmp - 1 else 0

for i in range(N):
    ans = 0
    if X[i] == '1':
        if not tmp - 1:
            print(ans)
            continue

        c = small - pow(2, (N - i - 1), tmp - 1)
        c = c % (tmp - 1)
    else:
        c = big + pow(2, (N - i - 1), tmp + 1)
        c = c % (tmp + 1)
    ans += 1
    while c:
        MOD = bin(int(c)).count("1")
        c %= MOD
        ans += 1
    print(ans)
### BUGGY CODE ###

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

mod = 10**9 + 7
array = [0] * K

for k in range(1, K+1):
    array[k-1] = pow((K // k), N)
    
for k in range(K, 0, -1):
    for i in range(2*k, K+1, k):
        array[k-1] -= array[i-1]

sum = 0
for k in range(1, K+1):
    array[k-1] *= k
    array[k-1] %= mod
    sum += array[k-1]
    
sum %= mod

print(sum)

### FIXED CODE ###

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

mod = 10**9 + 7
array = []

for k in range(1, K+1):
    array.append(pow((K // k), N, mod))
    
for k in range(K, 0, -1):
    for i in range(2*k, K+1, k):
        array[k-1] -= array[i-1]

sum = 0
for k in range(1, K+1):
    array[k-1] *= k
    array[k-1] %= mod
    sum += array[k-1]
    
sum %= mod

print(sum)
### BUGGY CODE ###

# テスト対象（ABC081A - Placing Marbles (https://atcoder.jp/contests/abs/tasks/abc081_a)
H,W = map(int, input().split())
A = 0
dp = []
mat = []
for h in range(H):
    dpr = [-1] * W
    for w, x in zip(range(W), input()):
        if x == "#":
            dpr[w] = 0
            mat += [(h, w, 0)]
    dp += [dpr]

def search(dp, mat, conf, nH, nW, cnt):
    if not conf:
        return
    if dp[nH][nW] < 0 or cnt+1<dp[nH][nW]:
        if dp[nH][nW] < 0:
            mat += [(nH, nW, cnt+1)]
        dp[nH][nW] = cnt+1

i = 0
while len(mat) > 0:
    h, w, cnt = mat[0]
    mat = mat[1:]

    i+=1
    search(dp, mat, h > 0, h - 1, w, cnt)
    search(dp, mat, h < H-1, h + 1, w, cnt)
    search(dp, mat, w > 0, h , w - 1, cnt)
    search(dp, mat, w < W-1, h , w + 1, cnt)

import numpy as np
print(np.max(dp))


### FIXED CODE ###

from collections import deque
H,W = map(int, input().split())
A = 0
dp = [None] * H
mat = [None] * (H*W)
matS = matE = 0
for h in range(H):
    s = list(input())
    for w, x in zip(range(W), s):
        if x == "#":
            mat[matE] = (h, w, 0)
            matE+=1
    dp[h] = s

def search(dp, mat, nH, nW, cnt):
    global matE
    if dp[nH][nW] == ".":
        mat[matE] = (nH, nW, cnt+1)
        matE+=1
        dp[nH][nW] = "#"

while matS < matE:
    h, w, cnt = mat[matS]
    matS += 1

    if h > 0:
        search(dp, mat, h - 1, w, cnt)
    if h < H-1:
        search(dp, mat, h + 1, w, cnt)
    if w > 0:
        search(dp, mat, h , w - 1, cnt)
    if w < W-1:
        search(dp, mat, h , w + 1, cnt)

print(cnt)
### BUGGY CODE ###

def li():
    return list(map(int,input().split()))
n=int(input())
p=li()
s=1
for i in range(n):
    s*=p[i]
if s>=10**18+1:
    print(-1)
else:
    print(s)


### FIXED CODE ###

import sys
def main():

    n=int(input())
    p=list(map(int,input().split()))
    s=1
    p=sorted(p)
    for i in p:
        s*=i
        if i==0:
            print(0)
            sys.exit()
        elif s>=10**18+1:
            print(-1)
            sys.exit()
    print(s)

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

n,m = map(int,input().split())
a = []
for _ in range(m):
    a.append(int(input()))

if n == 1:
    print(1)
elif n == 2:
    if 1 in a:
        print(1)
    else:
        print(2)
else:
    if 1 in a:
        b1 = 0
    else:
        b1 = 1
    if 2 in a:
        b2 = 0
    else:
        b2 = b1+1

    b3 = b1 + b2

    for i in range(3,n+1):
        if i in a:
            b3 = 0
        else:
            b3 = b1+b2
        if b3 > 1000000007:
            b3 = b3 % 1000000007
        b1 = b2
        b2 = b3
        if b1==b2==0:
            break

    print(b3)

### FIXED CODE ###

n,m = map(int,input().split())
a = [0]*(n+2)
for _ in range(m):
    a[int(input())] = -1

if n == 1:
    print(1)
elif n == 2:
    if a[1] == -1:
        print(1)
    else:
        print(2)
else:
    if a[1] == -1:
        b1 = 0
    else:
        b1 = 1
    if a[2] == -1:
        b2 = 0
    else:
        b2 = b1+1

    b3 = b1 + b2

    for i in range(3,n+1):
        if a[i] == -1:
            b3 = 0
        else:
            b3 = b1+b2
        if b3 > 1000000007:
            b3 = b3 % 1000000007
        b1 = b2
        b2 = b3
        if b1==b2==0:
            break

    print(b3)
### BUGGY CODE ###

import math
mod = 10**9 + 7
n, m = map(int, input().split())
#mの素因数分解
#(prime, power)を要素としてもつ配列を返す関数を作る
def factorize(n):
    fct = []
    b, e = 2, 0
    while b*b <= n:
        while n%b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b, e))
        b += 1
        e = 0
    if n > 1:
        fct.append((n, 1))
    return fct

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

num = factorize(m)
ans = 1
for p in num:
    ans *= (combinations_count(p[1]+n-1, p[1]) % mod)
print(ans%mod)


### FIXED CODE ###

import math
mod = 10**9 + 7
n, m = map(int, input().split())
#mの素因数分解
#(prime, power)を要素としてもつ配列を返す関数を作る
def factorize(n):
    fct = []
    b, e = 2, 0
    while b*b <= n:
        while n%b == 0:
            n //= b
            e += 1
        if e > 0:
            fct.append((b, e))
        b += 1
        e = 0
    if n > 1:
        fct.append((n, 1))
    return fct

num = factorize(m)
ans = 1

for p in num:
    for i in range(p[1]):
        ans *= n+i
    for i in range(p[1]):
        ans //= i+1
print(ans%mod)
### BUGGY CODE ###

N=int(input())
li=[]
for i in range(N):
    li.append(input())

    li.sort()
B=[]

for i in range(N):
    B.append(int(li.count(li[i])))

M=max(B)
C=[]
for i in range(N):
    if li.count(li[i])==M and not li[i] in C:
        C.append(li[i])
    else:
        pass

C.sort()

S=len(C)

L=len(C)

for k in range(L):
    print(C[k])


### FIXED CODE ###

N=int(input())
li=[]
import collections

for i in range(N):
    S=input()
    li.append(S)

li.sort()

c=collections.Counter(li)
cl=c.values()
m=max(cl)
keys=[k for k,v in c.items() if v==m]
keys.sort()

for j in range(len(keys)):
    print(keys[j])
### BUGGY CODE ###

# 2019-11-18 17:34:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect_left as bi_l, bisect_right as bi_r, insort_left as in_l
# import itertools
# from functools import reduce
# import operator as op
# import re
# import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, m, *a = [int(x) for x in sys.stdin.read().split()]
    a.sort()

    for _ in range(m):
        highest = a.pop()
        in_l(a, highest // 2)
    
    print(sum(a))
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

# 2019-11-18 17:34:23(JST)
import sys
# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
import heapq
# import array
# from scipy.misc import comb # (default: exact=False)
# import numpy as np 


def main():
    n, m = [int(x) for x in sys.stdin.readline().split()]
    a = [-int(x) for x in sys.stdin.readline().split()]

    heapq.heapify(a)
    for _ in range(m):
        highest = - heapq.heappop(a)
        heapq.heappush(a, -(highest // 2))
    
    print(-sum(a))
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

N, S = map(int, input().split())
x = [0]
x.extend([int(x) for x in input().split()])
 
# 状態リストを作成
m = [[[0 for _ in range(3)] for _ in range(S+1)] for _ in range(N+1)]
m[0][0][0] = 1
 
for i in range(1,N+1):
    
    for k in range(S+1):

        # x を含めない
        m[i][k][0] += m[i-1][k][0] # まだ開始しない
        m[i][k][1] += m[i-1][k][0] + m[i-1][k][1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
        m[i][k][2] += m[i-1][k][0] + m[i-1][k][1] + m[i-1][k][2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

        # x を含める場合
        if k - x[i] >= 0:
            m[i][k][1] += m[i-1][k - x[i]][0] + m[i-1][k - x[i]][1]
            m[i][k][2] += m[i-1][k - x[i]][0] + m[i-1][k - x[i]][1]
        
        m[i][k][0] = m[i][k][0] % 998244353
        m[i][k][1] = m[i][k][1] % 998244353
        m[i][k][2] = m[i][k][2] % 998244353
            
print(m[N][S][2])

### FIXED CODE ###

import numpy as np

N, S = map(int, input().split())
x = [int(x) for x in input().split()]
 
# 状態リストを作成
m = np.zeros((S+1,3))
p = np.zeros((S+1,3))
p[0,0] = 1

# 前状態から次状態の場合数を計算
for i in range(1,N+1):
    
    # x[i] を加えない場合
    m[:,0] = p[:,0]
    m[:,1] = p[:,0] + p[:,1]  # 今回から開始して加えない、もしくは既に開始しているが、加えない
    m[:,2] = p[:,0] + p[:,1] + p[:,2]  # 今回、開始・終了して加えない、今回開始して加えず終了。

    # x[i] を加える場合
    m[x[i-1]:,1] += p[:-x[i-1],0] + p[:-x[i-1],1]
    m[x[i-1]:,2] += p[:-x[i-1],0] + p[:-x[i-1],1]

    p[:,0] = m[:,0] % 998244353
    p[:,1] = m[:,1] % 998244353
    p[:,2] = m[:,2] % 998244353
            
print(int(p[S,2]))
### BUGGY CODE ###

x,k,d = list(map(int,input().split()))
cnt = 0
dis = x
while cnt<k:
    if dis>=0:
        dis = dis - d
    else:
        dis = dis + d
    cnt += 1
print(abs(dis))

### FIXED CODE ###

x,k,d = list(map(int,input().split()))
x = abs(x)
point =x % d
num = x//d
if num<k:
    rest = k - num
    if rest%2==0:
        pass
    else:
        point = d -point
else:
    point = x - k*d
print(point)
### BUGGY CODE ###

# coding: utf-8
import math
A, B, N = map(int, input().split())
ans = [0 for i in range(N+1)]
for i in range(1, N+1):
    ans[i] = math.floor(A * i / B) - A * math.floor(i / B)
print(max(ans))

### FIXED CODE ###

# coding: utf-8
A, B, N = map(int, input().split())

num = min(B-1, N)

print(A * num // B - A * (num // B))
### BUGGY CODE ###

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

for _ in range(m):
    b, c = map(int, input().split())
    a += [c]*b

a.sort(reverse=True)

print(sum(a[:n]))

### FIXED CODE ###

from operator import itemgetter

n, m = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(m)]


BC.sort(reverse=True, key=itemgetter(1))
cnt = 0
for b, c in BC:
    if cnt + b > n:
        b = n-cnt
    for _ in range(b):
        A.append(c)
    cnt += b
    if cnt == n:
        break

A.sort(reverse=True)

print(sum(A[:n]))
### BUGGY CODE ###

n= int(input())
gsb = [tuple(map(int,input().split())) for _ in range(2)]

def increase(num, gsb0, gsb1):
    max_num = 0
    g_max = num//gsb0[0] if (gsb0[0] < gsb1[0]) else 0
    for i in range(g_max + 1):
        remain = num - i*gsb0[0]
        s_max = remain//gsb0[1] if (gsb0[1] < gsb1[1]) else 0
        for j in range( s_max + 1 ):
            remain2 = remain - j*gsb0[1]
            k = remain2//gsb0[2] if (gsb0[2] < gsb1[2]) else 0
            tmp = (remain2 - k*gsb0[2]) + i*gsb1[0] + j*gsb1[1] + k*gsb1[2]
            max_num = max(max_num, tmp)

    return(max_num)

num = increase(n,gsb[0],gsb[1])
num = increase(num,gsb[1],gsb[0])

print(num)

### FIXED CODE ###

n= int(input())
gsb = [tuple(map(int,input().split())) for _ in range(2)]

def increase(num, gsb0, gsb1):
    dp = [ [num] * (num+1) for _ in range(3+1)]
    for i in range(1,4):
        w = gsb0[i-1]
        v = gsb1[i-1]
        for j in range(num+1):
            if(j < w):
                dp[i][j] = dp[i-1][j]
            else:
                dp[i][j] = max(dp[i-1][j], dp[i][j-w] + v-w)

    return(dp[-1][-1])

num = increase(n,gsb[0],gsb[1])
num = increase(num,gsb[1],gsb[0])

print(num)
### BUGGY CODE ###

A,B,C,D,E,F = map(int,input().split())
ans = []
for a in range(F // (A*100) + 1):
    for b in range(F // (B*100) + 1):
        water =  100*a*A + 100*b*B 
        if water <= F:
            for c in range(E*water//100//C+1):
                for d in range(E*water//100//D+1):
                    suger = C*c + D*d
                    if suger+water <= F and E*water//100 >= suger:
                        try:
                            n = suger / (suger+water)
                            ans.append([n,suger+water,suger])
                        except:
                            pass
ans.sort()
print(ans[-1][1],ans[-1][2])




### FIXED CODE ###

A,B,C,D,E,F = map(int,input().split())
ans = []
for a in range(F // (A*100) + 1):
    for b in range(F // (B*100) + 1):
        water =  100*a*A + 100*b*B 
        if water <= F:
            for c in range(E*water//100//C+1):
                for d in range(E*water//100//D+1):
                    suger = C*c + D*d
                    if suger+water <= F and E*water//100 >= suger:
                        try:
                            n = suger / (suger+water)
                            ans.append([n,suger+water,suger])
                        except:
                            pass
ans.sort()
print(ans[-1][1],ans[-1][2])
### BUGGY CODE ###

S = raw_input()

find_val = S.find('ABC')
count = 0
while find_val >= 0:
    count += 1
    list_s = list(S)
    list_s[find_val:find_val+3] = 'BCA'
    S = "".join(list_s)
    find_val = S.find('ABC')
print count


### FIXED CODE ###

S = raw_input()

count = 0
idx = 0
a_count = 0
while idx < len(S):
    if a_count > 0:
        if S[idx: idx+2] == 'BC':
            count += a_count
            idx += 2
            continue
    if S[idx] == 'A':
        a_count += 1
    else:
        a_count = 0
    idx += 1

print count
### BUGGY CODE ###

s = list(input())[::-1]
n = len(s)
mod = 10**9 + 7

t = [[0 for j in range(13)] for i in range(n)]
for i,x in enumerate(s):
    if i == 0:
        if x == "?":
            for j in range(0,10):
                t[i][j] += 1
        else:
            t[i][int(x)] += 1
    else:
        if x == "?":
            for k in range(13):
                for j in range(10):
                    b = (k + j*pow(10, i ,13))%13
                    t[i][b] += t[i-1][k]
                    t[i][b] %= mod
        else:
            for k in range(0,13):
                b = (k + int(x)*pow(10, i ,13))%13
                t[i][b] += t[i-1][k]
                t[i][b] %= mod
print(t[-1][5]%mod)


### FIXED CODE ###

s = list(input())[::-1]
n = len(s)
mod = 10**9 + 7

t = [[0 for j in range(13)] for i in range(n)]
for i,x in enumerate(s):
    A = pow(10, i ,13)
    if i == 0:
        if x == "?":
            for j in range(0,10):
                t[i][j] += 1
        else:
            t[i][int(x)] += 1
    else:
        if x == "?":
            for k in range(13):
                for j in range(10):
                    b = (k + j*A)%13
                    t[i][b] += t[i-1][k]
                    t[i][b] %= mod
        else:
            for k in range(0,13):
                b = (k + int(x)*A)%13
                t[i][b] += t[i-1][k]
                t[i][b] %= mod
print(t[-1][5]%mod)
### BUGGY CODE ###

n,x,y = map(int, input().split())
dst = [[0]*n]*n
ans = [0]*n

for i in range(n):
    for j in range(1,n-i):
        dst[i][j] = min(j, abs(x-1-i)+abs(y-1-(i+j))+1, abs(x-1-(i+j))+abs(y-1-i)+1)
        ans[dst[i][j]] += 1

for m in range(1,n):
    print(ans[m])

### FIXED CODE ###

n,x,y = map(int, input().split())
ans = [0]*(n-1)

for i in range(n):
    for j in range(1,n-i):
        d = min(j, abs(x-1-i)+abs(y-1-(i+j))+1)
        ans[d-1] += 1

for m in range(n-1):
    print(ans[m])
### BUGGY CODE ###

import sys,itertools,copy,time
input = sys.stdin.readline
S=int(input().strip())

A=S
B=0


def divide(a):
    if a==1:return [1,1]
    if a==0:return [0,0]
    temp=a
    ans=[a,1]
    c=2
    while True:
        if c==temp:
            break
        elif temp%c==0:
            ans[1]*=c
            temp/=c
            ans[0]=temp
            if ans[0]<=10**9 and ans[1]<=10**9:
                break
            c=2
        else:
            c+=1

    return ans

while True:
    if A <= 10**9:
        print(0,0,A,0,0,1)
        break
    else:
        if A%2==1:
            A+=1
            B+=1
        x1y2=divide(A)
        x2y1=divide(B)
        if max(x1y2) < 10**9 and max(x2y1) < 10**9:
            print(0,0,x1y2[0],x2y1[1],x2y1[0],x1y2[1])
            break
        else:
            A+=1
            B+=1



### FIXED CODE ###

import sys,itertools,copy,math
input = sys.stdin.readline
S=int(input().strip())

y2=math.ceil(S/(10**9))
x2=y2*10**9-S

print(0,0,10**9,1,x2,y2)
### BUGGY CODE ###

n = int(input())
nums = [int(input()) for _ in range(n)]
p, q = nums.index(1), nums.index(n)
a, b = 1, 1
s = 0

for i in range(2, n+1):
    if  p < nums.index(i):
        a += 1
    else:
        s = max(s, a)
        a = 1
    p = nums.index(i)
s = max(s, a)
for j in range(n, 0, -1):
    if  q > nums.index(j):
        b += 1
    else:
        s = max(s, b)
        b = 1
    q = nums.index(j)
s = max(s, b)
print(n - s)

### FIXED CODE ###

n = int(input())
nums = [int(input()) for _ in range(n)]
mem = [0] * (n + 1)
a, b = 1, 1
s = 0
for i in range(n):
    mem[nums[i]] += i

p, q = mem[1], mem[n]

for i in range(2, n+1):
    if  p < mem[i]:
        a += 1
    else:
        s = max(s, a)
        a = 1
    p = mem[i]
s = max(s, a)
for j in range(n, 0, -1):
    if  q > mem[j]:
        b += 1
    else:
        s = max(s, b)
        b = 1
    q = mem[j]
s = max(s, b)
print(n - s)
### BUGGY CODE ###

X, K, D = map(int, input().split())

ans = min([abs(X+D*i) for i in range(-K, K+1, 2)])

print(ans)


### FIXED CODE ###

X, K, D = map(int, input().split())

def sign(x):
    return 1 if x >= 0 else -1


ans = abs(X) - K * D

if abs(X) - K * D < 0:
    divs = abs(X) // D
    mods = abs(X) % D
    nums = K - divs

    ans = abs(mods - (nums%2) * D)

print(ans)


# ans = min([abs(X+D*i) for i in range(-K, K+1, 2)])
# 
# print(ans)
### BUGGY CODE ###

N = int(input())

data = input().split()

data = [int(s) for s in data]

num = 0
ans = 0

for i in range(N) :
  num += data[i]
  ans += (sum(data) - num) * data[i]

print(ans % 1000000007)

### FIXED CODE ###

N = int(input())

data = input().split()

data = [int(s) for s in data]

num = 0
ans = 0
sum = sum(data)

for i in range(N) :
  num += data[i]
  ans += (sum - num) * data[i]

print(ans % 1000000007)