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

a,b,c = map(int,input().split())
ans = 0
p = 0
for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z
    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)

### FIXED CODE ###

a,b,c = map(int,input().split())
ans = 0
p = 0

for i in range(c):
    if int(a/2)*2==a and int(b/2)*2==b and int(c/2)*2==c:
        if a == b and b == c:
            break
        ans += 1
        x = b / 2 + c / 2
        y = a / 2 + c / 2
        z = b / 2 + a / 2
        a = x
        b = y
        c = z

    else:
        p = 1
        print(ans)
        break



if p == 0:
    print(-1)
### BUGGY CODE ###

import itertools

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

for i in range(n):
    for j in range(n-1):
        A[i][j] -= 1

taisen = list(itertools.combinations(range(n), 2))
taisen_dic = {}
for i in range(len(taisen)):
    taisen_dic[taisen[i]] = i

B = [[0] * (n-1) for i in range(n)]

for i in range(n):
    for j in range(n-1):
        key0, key1 = min(i, A[i][j]), max(i, A[i][j])
        B[i][j] = taisen_dic[(key0, key1)]

#print(B)

nn = len(taisen)

G = [[] for i in range(nn)]



for i in range(n):
    for j in range(n-2):
        G[B[i][j]].append(B[i][j+1])

#print(G)

S = [[i, 0] for i in range(nn)]
D = [-1] * nn

dis = 0
while len(S) > 0 and dis <= nn:
    now = S.pop()
    now0 = now[0]
    dis = now[1]
    if dis > D[now0]:
        D[now0] = dis
        for i in G[now0]:
            if dis+1 > D[i]:
                S.append([i, dis+1])
                #print(S)

if dis > nn:
    print(-1)
else:
    print(max(D) + 1)

### FIXED CODE ###

import sys
input = sys.stdin.readline

n = int(input())
A = [list(map(int,input().split())) for i in range(n)]
for i in range(n):
    for j in range(n-1):
        A[i][j] -= 1

AA = [[j for j in i] for i in A]

ID = [[-1] * n for i in range(n)]
id_ = 0
for i in range(n):
    for j in range(i+1,n):
        ID[i][j] = id_
        ID[j][i] = id_
        id_ += 1

for i in range(n):
    for j in range(n-1):
        A[i][j] = ID[i][A[i][j]]

M = [[] for i in range(id_)]
IN = [0] * id_
for i in range(n):
    for j in range(n-2):
        M[A[i][j]].append(A[i][j+1])
        IN[A[i][j+1]] +=1
# print(A)
# print(M)

# 以下、トポロジカルソート

S = []
s = 0

for i in range(id_):
    if IN[i] == 0:
        S.append(i)

while s < len(S):
    for x in M[S[s]]:
        IN[x] -= 1
        # print(x,IN)
        if IN[x] == 0:
            S.append(x)
    s += 1

# print(S)

if len(S) < id_:
    print(-1)
else:
    T = [1] * id_
    for i in range(id_):
        for j in M[S[i]]:
            T[j] = max(T[j], T[S[i]] + 1)
    print(max(T))


# 以下、閉路検出(今は削除)

# V = [0] * id_
# S = [0]
# V[0] = 1

# import sys

# def visit(x):
#     if V[x] == 1:
#         print(-1)
#         sys.exit()
#     elif V[x] == 0:
#         V[x] = 1
#         for i in M[x]:
#             visit(i)
#         V[x] = 2

# for i in range(id_):
#     if V[i] == 0:
#         visit(i)
# print("heironasi")

# 閉路検出ここまで
### BUGGY CODE ###

# coding: utf-8

import math

def sieve_of_erastosthenes(num):

    if 2 > num:
        return 0

    serial_number_list = [r for r in range(2, num + 1)]
    multiple_list = []
            
    while math.sqrt(num) >= serial_number_list[0]:
        i = 1

        serial_number = serial_number_list[0]
  
        multiple_list.append(serial_number)
                    
        while serial_number_list[len(serial_number_list) - 1] >= serial_number * i:
    
            if serial_number * i in serial_number_list:
                
                serial_number_list.pop(serial_number_list.index(serial_number * i))

            i += 1

    return len(multiple_list + serial_number_list)

if __name__ == '__main__':
    input_list = []
    
    while True:
        try:
            print(sieve_of_erastosthenes(int(input())))
        except:
            break

### FIXED CODE ###

a = [True for i in range(1000000)]
i = 3
while i * i < 1000000:
    for j in range(3 * i, 1000000, 2 * i): a[j] = False
    i += 2
 
while True:
    try:
        n = int(input())
    except:
        break
 
    count = int(n >= 2) + sum(a[i] for i in range(3, n + 1, 2))
    print(count)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

n,k = map(int,input().split())
s = []
for i in range(k):
  l,r = map(int,input().split())
  s.append((l,r))
s.sort()
MOD = 998244353

memo = [-1 for _ in range(n+1)]

def f(x):
  if x < 1:
    return 0
  if x == 1:
    return 1
  if memo[x] != -1:
    return memo[x]
  res = 0
  for l,r in s:
    for i in range(l,r+1):
      res += f(x-i)
      res %= MOD
  memo[x] = res
  return res

print(f(n))


### FIXED CODE ###

# D - Leaping Tak
n,k = map(int,input().split())
lr = [tuple(map(int,input().split())) for _ in range(k)]
MOD = 998244353

# 累積和を使ってもらうdpを効率よく実現する。

dp = [0 for _ in range(n+1)]
dpsum = [0 for _ in range(n+1)]
dp[1] = 1
dpsum[1] = 1
for i in range(2,n+1):
  for li,ri in lr:
    r = i-li
    if r < 1:
      continue
    l = max(i-ri-1,0)
    dp[i] += dpsum[r]-dpsum[l]
    dp[i] %= MOD
  dpsum[i] += dpsum[i-1]+dp[i]
  dpsum[i] %= MOD
print(dp[n])
### BUGGY CODE ###

a, b = map(int, input().split())

x = 0

for i in range(a, b+1):
    x = x ^ i

print(x)

### FIXED CODE ###

a, b = map(int, input().split())

N = b - a + 1

if a%2 == 0:
    if N%4 == 0:
        print(0)
    elif N%4 == 1:
        print(b)
    elif N%4 == 2:
        print(1)
    else:
        print(b + 1)
else:
    if N%4 == 0:
        print(a ^ b ^ 1)
    elif N%4 == 1:
        print(a)
    elif N%4 == 2:
        print(a ^ b)
    else:
        print(a ^ 1)
### BUGGY CODE ###

#ABC077C
def main():
    import sys, bisect
    N = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    C = list(map(int, sys.stdin.readline().split()))
    
    A.sort()
    B.sort()
    C.sort()
    #print(A, B, C)
    ans = 0
    for i in range(N):
        idxB = bisect.bisect_right(B, A[i])
        for j in range(idxB, N):
            idxC = bisect.bisect_right(C, B[j])
            #print(A[i],B[j], (N-idxC))
            ans +=(N-idxC)
    print(ans)


if __name__=='__main__':
    main()


### FIXED CODE ###

#ABC077C
def main():
    import sys, bisect
    N = int(sys.stdin.readline())
    A = list(map(int, sys.stdin.readline().split()))
    B = list(map(int, sys.stdin.readline().split()))
    C = list(map(int, sys.stdin.readline().split()))
    
    A.sort()
    B.sort()
    C.sort()
    #print(A, B, C)
    ans = 0
    #Bを起点
    for i in range(N):
        idxA = bisect.bisect_left(A, B[i])
        idxC = bisect.bisect_right(C, B[i])
        #print(idxA, idxC)
        ans +=idxA*(N-idxC)
    print(ans)

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

n,q=map(int,input().split())
s=input()
l_li=[]
r_li=[]
for i in range(q):
    l,r=map(int,input().split())
    l_li.append(l)
    r_li.append(r)
    

dp =[[0 for i in range(n+2)] for j in range(n+2)]

for i in range(1):
    for j in range(i,n):
        t=0
        if s[j]=="C" and j!=i:
            if s[j-1]=="A":
                t=1
        
        dp[i][j]=dp[i][j-1]+t
        
for i in range(1,n):
    t=0
    if s[i]=="C" and s[i-1]=="A":   
        for j in range(n):
            dp[i][j]=dp[i-1][j]-1
    else:
        for j in range(n):
            dp[i][j]=dp[i-1][j]        
        
        
for i in range(q):
    print(dp[l_li[i]-1][r_li[i]-1])

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
    
dp =[0 for j in range(n)]


for j in range(n):
    t=0
    if s[j]=="C" and j!=0:
        if s[j-1]=="A":
            t=1

    dp[j]=dp[j-1]+t
        

for i in range(q):
    l,r=map(int,input().split())
    print(dp[r-1]-dp[l-1])
### BUGGY CODE ###

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

def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

ans = 1
if n == 2:
    print(max(a))
else:
    for i in range(n):
        b = a[:i] + a[i + 1:]
        element = gcd(b[0], b[1])
        if n == 3:
            ans = max(ans, element)
        else:
            for j in range(2, n - 1):
                element = gcd(element, b[j])
            ans = max(ans, element)
    print(ans)


### FIXED CODE ###

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


def gcd(x, y):
    if y == 0:
        return x
    return gcd(y, x % y)

ans = 1
if n == 2:
    print(max(a))
else:
    l = [0] * (n + 1)
    r = [0] * (n + 1)
    for i in range(1, n):
        l[i] = gcd(l[i - 1], a[i - 1])
        r[n - i] = gcd(r[n - i + 1], a[-i])
    for i in range(n):
        m = gcd(l[i], r[i + 1])
        ans = max(ans, m)
    print(ans)
### BUGGY CODE ###

def solve():
    from sys import stdin
    f_i = stdin
    
    N, K = map(int, f_i.readline().split())
    A = sorted(map(int, f_i.readline().split()))
    
    INF = 10 ** 18 + 1
    l = -INF
    r = INF
    
    from bisect import bisect_left, bisect_right
    
    zero_num = bisect_right(A, 0) - bisect_left(A, 0)
    tot_init = zero_num * (N - 1)
    
    mA = A[:bisect_left(A, 0)]
    pA = A[bisect_right(A, 0):]
    
    while l + 1 < r:
        x = (l + r) // 2
        if x > 0:
            tot = tot_init
        else:
            tot = 0
        
        for a in mA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    right = mid
                else:
                    left = mid
            tot += (N - right)
            if a ** 2 < x:
                tot -= 1
        
        for a in pA:
            left = -1
            right = N
            while left + 1 < right:
                mid = (left + right) // 2
                if A[mid] * a < x:
                    left = mid
                else:
                    right = mid
            tot += right
            if a ** 2 < x:
                tot -= 1
        
        tot //= 2
        if tot < K:
            l = x
        else:
            r = x
    
    print(l)

solve()

### FIXED CODE ###

from sys import stdin
f_i = stdin

import numpy as np

N, K = map(int, f_i.readline().split())
A = np.array(f_i.read().split(), dtype=int)

A = np.sort(A)
zero_left = A.searchsorted(0, side='left')
zero_right = A.searchsorted(0, side='right')
zero_cnt = zero_right - zero_left
pos = A[zero_right:]
neg = A[:zero_left]

def f(x):
    cnt = 0
    
    if x >= 0:
        cnt += zero_cnt * N
    
    cnt += np.searchsorted(A, x // pos, side='right').sum()
    cnt += (N - np.searchsorted(A, (-x - 1) // (-neg), side='right')).sum()
    
    cnt -= np.count_nonzero(A ** 2 <= x)
    return cnt // 2


left = -10 ** 18
right = 10 ** 18
while left + 1 < right:
    x = (left + right) // 2
    if f(x) >= K:
        right = x
    else:
        left = x

print(right)
### BUGGY CODE ###

n = int(input())
numbers = list(map(int, input().split()))
c = 0

for i in numbers[::-1]:
    for j in numbers[numbers.index(i)::-1]:
        if  i <= j :
            continue
        else:
            break
    else:
        c += 1

print(c)


### FIXED CODE ###

n = int(input())
number = list(map(int, input().split()))
cnt = 0
min_num = number[0]
for i in range(n):
  if min_num >= number[i]:
    cnt += 1
    min_num = number[i]
  else:
    continue
print(cnt)
### BUGGY CODE ###

sList, tList = map(list, sorted([input(), input()], key=lambda x: len(x)))
#sList, tList = map(list, sorted(["sd;fnas;ncnlaubsukefbcasjbdlcbaslidoc;ulabnuebchasvdbcnuayrfivoasdbfkasvludfhwialunejcbasdnbciluahweflicbja",
#                                 "sjdnlifvbasublchawubeyfcainwbidcnbasvebhfcjhbwavendjkcahbsjdbcbasuibefcasjhdvcanwukehfucanbshdbc"], key=lambda x: len(x)))

dp = [[["", 0]] * (len(tList) + 1) for _ in range(2)]
index = 0
for i, s in enumerate(sList, start=1):
    index = i % 2
    sameStr, sameStrLen = "", 0
    for j, t in enumerate(tList, start=1):
        aboveStr, aboveStrLen = dp[index-1][j]
        if s[0] == t[0]:
            sameStr = dp[index - 1][j - 1][0] + s[0]
            sameStrLen = dp[index - 1][j - 1][1] + 1

        if sameStrLen > aboveStrLen:
            dp[index][j] = sameStr, sameStrLen
        else:
            dp[index][j] = aboveStr, aboveStrLen

print(dp[index][-1][0])


### FIXED CODE ###


sList, tList = input(), input()

dp = [[0] * (len(tList) + 1) for _ in range(len(sList)+1)]


# 横方向で回す
for i, s in enumerate(sList, start=1):
    for j, t in enumerate(tList, start=1):
        dp[i][j] = max([dp[i][j - 1], dp[i-1][j],
                        dp[i-1][j-1] + 1 if s == t else 0])
m = dp[i][j]
ans = ""
# traceback
cnt = 0
while i + j != 0:
    if dp[i - 1][j - 1] == m - 1 and tList[j-1] == sList[i-1]:
        ans = tList[j-1] + ans
        i -= 1
        j -= 1
        m -= 1
    else:
        if dp[i - 1][j] == m:
            i -= 1
        elif dp[i][j-1] == m:
            j -= 1
    cnt += 1
print(ans)
### BUGGY CODE ###

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

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

D=[]
for i in range(M):
    B, C = map(int, input().split())
    D += [C]*B
D.sort(reverse=True)
if len(D) >= N:
    D = D[:N]
A += D
A.sort(reverse = True)

print(sum(A[:N])) 

### FIXED CODE ###

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

A = sorted(list(map(int, input().split())), reverse=True)

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

B.sort(key=lambda x:(-x[1]))

cnt = 0
ans = 0
a = 0
b = 0
while True:
    if b <= M-1 and A[a] <= B[b][1]:
        n = min(B[b][0], N-cnt)
        ans += B[b][1]*n
        cnt += n
        if cnt == N:
            print(ans)
            break
        b += 1
    elif a <= N-1:
        cnt += 1
        ans += A[a]
        if cnt == N:
            print(ans)
            break
        a += 1
### BUGGY CODE ###

from collections import deque

N,M,*f = map(int, open(0).read().split())
uv = [f[i:i+2] for i in range(0, len(f)-2, 2)]
S = f[-2]
T = f[-1]
connected = [[] for _ in range(N+1)]
for u, v in uv:
    connected[u].append(v)

d = deque([S])
for i in range(1,N+1):
    for j in range(3):
        for k in range(len(d)):
            temp = d.popleft()
            for edge in connected[temp]:
                if edge == T:
                    if j == 2:
                        print(i)
                        exit()
                    else:
                        d.append(edge)
                else:
                    d.append(edge)
else:
    print('-1')

### FIXED CODE ###

from collections import deque

N,M,*f = map(int, open(0).read().split())
uv = [f[i:i+2] for i in range(0, len(f)-2, 2)]
S = f[-2]
T = f[-1]
connected = [[] for _ in range(N+1)]
for u, v in uv:
    connected[u].append(v)
dist = [[-1] * 3 for _ in range(N+1)]
dist[S][0] = 0
ans = 0
d = deque([(S,0)])
while d:
    temp = d.popleft()
    for edge in connected[temp[0]]:
        if edge == T and temp[1] == 2:
            print((dist[temp[0]][2]+1)//3)
            break
        else:
            if dist[edge][(temp[1]+1)%3] < 0:
                dist[edge][(temp[1]+1)%3] = dist[temp[0]][temp[1]] + 1
                d.append((edge,(temp[1]+1)%3))
    else:
        continue
    break
else:
    print(-1)
### BUGGY CODE ###

from collections import defaultdict 

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

if M == 0:
  print(-1)
  exit()

INF = 10**20
pqc = [tuple(map(lambda x:int(x)-1,input().split())) for _ in range(M)]

to1d={v:{} for v in range(N)}
count=2
for p,q,c in pqc:
  if not to1d[p].get(c):
    to1d[p][c] = count
    count += 1
  if not to1d[q].get(c):
    to1d[q][c] = count
    count += 1

G = [{} for _ in range(count)]
lines = [set() for _ in range(N)]
for p,q,c in pqc:
  v1,v2 = to1d[p][c],to1d[q][c]
  G[v1][v2] = G[v2][v1] = 0
  lines[p].add(c)
  lines[q].add(c)
  
for v in range(N):
  if len(lines[v])>1:
    tmp = list(lines[v])
    for i in range(len(tmp)-1):
      for j in range(i+1,len(tmp)):
        v1,v2 = to1d[v][tmp[i]],to1d[v][tmp[j]]
        G[v1][v2] = G[v2][v1] = 1
        
def dijkstra(start = 0):
    from heapq import heappop, heappush
    d = [INF]*len(G)
    d[start] = 0
    que = []
    heappush(que, (0, start))
    while que:
        p = heappop(que)
        v = p[1]
        if d[v] < p[0]: continue
        for u in G[v].keys():
            if d[u] > d[v] + G[v][u]:
                d[u] = d[v] + G[v][u]
                heappush(que, (d[u], u))
    return d

for c in lines[0]:
  v = to1d[0][c]
  G[0][v] = 1
for c in lines[N-1]:
  v = to1d[N-1][c]
  G[v][1] = 0
  
d = dijkstra(0)
ans = d[1]
print(ans if ans < INF else -1)

### FIXED CODE ###

def main():
  N,M=map(int,input().split())

  if M == 0:
    print(-1)
    exit()

  INF = 10**6
  pqc = [tuple(map(lambda x:int(x)-1,input().split())) for _ in range(M)]

  to1d={v:{} for v in range(N)}
  count=2
  for p,q,c in pqc:
    if not to1d[p].get(c):
      to1d[p][c] = count
      count += 1
    if not to1d[q].get(c):
      to1d[q][c] = count
      count += 1

  G = [{} for _ in range(N+count)]
  for p,q,c in pqc:
    v1,v2 = to1d[p][c],to1d[q][c]
    G[v1][v2] = G[v2][v1] = 0

  for i in range(N):
    if len(to1d[i])<=1: continue
    for c in to1d[i].keys():
      v = to1d[i][c]
      G[v][count] = 1
      G[count][v] = 0
    count += 1

  def dijkstra(start = 0, goal = 1):
      from heapq import heappop, heappush
      NN = len(G)
      d = [INF]*NN
      d[start] = 0
      que = []
      heappush(que, start)
      while que:
          p = divmod(heappop(que),NN)
          v = p[1]
          if d[v] < p[0]: continue
          for u in G[v].keys():
              if d[u] > d[v] + G[v][u]:
                  d[u] = d[v] + G[v][u]
                  heappush(que, d[u]*NN+u)
          if v == goal: return d[goal]
      return d[goal]

  for c in to1d[0].keys():
    v = to1d[0][c]
    G[0][v] = 1
  for c in to1d[N-1].keys():
    v = to1d[N-1][c]
    G[v][1] = 0

  ans = dijkstra(0,1)
  print(ans if ans < INF else -1)
  
if __name__=="__main__":
  main()
### BUGGY CODE ###

import heapq
def dijkstra(G, s):
    dist = [float("inf")]*len(G)
    q = []
    dist[s] = 0
    heapq.heapify(q)
    heapq.heappush(q, [0, s])
    while 0 < len(q):
        pre_cost, p = heapq.heappop(q)
        if dist[p] < pre_cost:
            continue
        for v, d in G[p]:
            if dist[v] > dist[p] + d:
                dist[v] = dist[p] + d
                heapq.heappush(q, [dist[v], v])
    return dist
def main():
    n, m, s, t = map(int, input().split())
    s, t = s-1, t-1
    G_y = [[] for _ in range(n)]
    G_s = [[] for _ in range(n)]
    f = [True]*n
    for _ in range(m):
        u, v, a, b = map(int, input().split())
        u, v = u-1, v-1
        G_y[u].append([v, a])
        G_y[v].append([u, a])
        G_s[u].append([v, b])
        G_s[v].append([u, b])
    cost_y = dijkstra(G_y, s)
    cost_s = dijkstra(G_s, t)
    cost = [[cost_y[i] + cost_s[i], i] for i in range(n)]
    cost.sort()
    x = 0
    for i in range(n):
        while not f[cost[x][1]]:
            x += 1
        print(pow(10, 15) - cost[x][0])
        f[i] = False

if __name__ == "__main__":
    main()


### FIXED CODE ###

import heapq
def dijkstra(G, s):
    dist = [float("inf")]*len(G)
    q = []
    dist[s] = 0
    heapq.heapify(q)
    heapq.heappush(q, [0, s])
    while 0 < len(q):
        pre_cost, p = heapq.heappop(q)
        if dist[p] < pre_cost:
            continue
        for v, d in G[p]:
            if dist[v] > dist[p] + d:
                dist[v] = dist[p] + d
                heapq.heappush(q, [dist[v], v])
    return dist
import sys
input = sys.stdin.readline
def main():
    n, m, s, t = map(int, input().split())
    s, t = s-1, t-1
    G_y = [[] for _ in range(n)]
    G_s = [[] for _ in range(n)]
    f = [True]*n
    for _ in range(m):
        u, v, a, b = map(int, input().split())
        u, v = u-1, v-1
        G_y[u].append([v, a])
        G_y[v].append([u, a])
        G_s[u].append([v, b])
        G_s[v].append([u, b])
    cost_y = dijkstra(G_y, s)
    cost_s = dijkstra(G_s, t)
    cost = [[cost_y[i] + cost_s[i], i] for i in range(n)]
    cost.sort()
    x = 0
    for i in range(n):
        while not f[cost[x][1]]:
            x += 1
        print(10**15 - cost[x][0])
        f[i] = False

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

N=int(input())
for h in range(1,3501):
	for n in range(1,3501):
		tmp=4*h*n-N*n-N*h
		if tmp==0:continue
		w=N*n*h/tmp
		if 1<=w<=3500 and w==int(w):
			print(h,n,int(w))
			exit()
		

### FIXED CODE ###

N=int(input())
for h in range(1,3501):
	for n in range(1,3501):
		tmp=4*h*n-N*n-N*h
		if tmp==0:continue
		w=N*n*h/tmp
		if 1<=w<=3500 and w==int(w):
			print(h,n,int(w))
			exit()
### BUGGY CODE ###

def main():
    import numpy as np
    n=int(input())
    s=np.array([np.array(list(input())) for _ in [0]*n])
    cnt=0
    for a in range(n):
        for i in range(n):
            ia_n=(i+a)%n
            if not (s[i,i+a:n]==s[i:n-a,ia_n]).all():
                break
            elif not (s[i,:a]==s[n-a:n,ia_n]).all():
                break
        else:
            cnt+=1
    print(n*cnt)
main()

### FIXED CODE ###

def main():
    n=int(input())
    nn=2*n-1
    s=[input() for _ in [0]*n]
    s=[i+i[:-1] for i in s]+[i+i[:-1] for i in s][:-1]
    ans=[[0]*n for _ in [0]*n]
    for i in range(1,nn):
        m=min(i+1,n)
        for j in range(nn-1):
            for k in range(max(i-j-n,0)+1,min(m,nn-j,i-j+n)):
                ii=i-k
                if s[i][j]!=s[ii][j+k]:
                    l=min(n-k+1,ii,j)
                    width=l-max(-1,ii-n,j-n)
                    ans[ii-l][j-l]=max(ans[ii-l][j-l],width)
    for i in range(1,n):
        for j in range(1,n):
            ans[i][j]=max(ans[i][j],ans[i-1][j-1]-1)
    print(sum([sum([i==0 for i in a]) for a in ans]))
main()
### BUGGY CODE ###

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

threshold = 1000000007
ans = 0
for i in range(N-1):
    count = 0
    for j in range(i+1, N):
        count += list_A[j]
    ans += (list_A[i] * count % threshold)
ans = ans % threshold
print(ans)

### FIXED CODE ###

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

threshold = 1000000007
tmp = sum(list_A[1:])
ans = 0
for i in range(N-1):
    if i == 0:
        ans += list_A[i] * tmp % threshold
    else:
        tmp = tmp - list_A[i]
        ans += (list_A[i] * tmp % threshold)
ans = ans % threshold
print(ans)
### BUGGY CODE ###

from collections import deque

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

def bfs(n: int, graph: list) -> list:
    d = deque([n])
    check = [-1 for _ in range(N)]
    check[n] = 0
    while d:
        e = d.popleft()
        for i in range(N):
            if (graph[e][i]) == 1 and check[i] == -1:
                check[i] = 1 + check[e]
                d.append(i)
    return check


dist = [[0 for _ in range(N)] for _ in range(N)]
for i in range(N):
    for j in range(N):
        if abs(i - j) == 1:
            dist[i][j] = 1

dist[X-1][Y-1] = 1
dist[Y-1][X-1] = 1

ans = [0 for _ in range(N - 1)]
for i in range(N):
    tmp = bfs(i, dist)
    for j in range(i):
        ans[tmp[j]-1] += 1

for i in range(N - 1):
    print(ans[i])


### FIXED CODE ###

from collections import deque

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

dist = [[0 for _ in range(N)] for _ in range(N)]
ans = [0 for _ in range(N)]

for i in range(N):
    for j in range(N):
        tmp1 = abs(i - X + 1) + abs(j - Y + 1) + 1
        tmp2 = abs(i - Y + 1) + abs(j - X + 1) + 1

        dist[i][j] = min(abs(i - j), tmp1, tmp2)
        dist[j][i] = min(abs(i - j), tmp1, tmp2)

for i in range(N):
    for j in range(i+1, N):
        ans[dist[i][j]-1] += 1

for i in range(N - 1):
    print(ans[i])