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

N=input()
S=[ list(raw_input()) for i in range(N)]

A=0
ans=0
for B in range(N):
	flag=0
	for i in range(N):
		if flag==-1: break
		for j in range(N):
			x1=(N+i-A)%N
			y1=(N+j-B)%N

			x2=(N+j-A)%N
			y2=(N+i-B)%N

			#print i,j,x1,y1,x2,y2
			if S[x1][y1]==S[x2][y2]:
				pass
			else:
				flag=-1
				#break
	else:
		ans+=1*N


print ans


### FIXED CODE ###

N=input()
S=[ list(raw_input()) for i in range(N)]

A=0
ans=0
for B in range(N):
	flag=0
	for i in range(N):
		if flag==-1: break
		for j in range(N):
			x1=(N+i-A)%N
			y1=(N+j-B)%N

			x2=(N+j-A)%N
			y2=(N+i-B)%N

			#print i,j,x1,y1,x2,y2
			if S[x1][y1]==S[x2][y2]:
				pass
			else:
				flag=-1
				#break
	else:
		ans+=1*N


print ans
### BUGGY CODE ###

from collections import Counter

n = int(input().strip())

count_by_kw = Counter()
for i in range(n):
    s=str(sorted(input().strip()))
    count_by_kw[s]+=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2
        
print(ans)

### FIXED CODE ###

n = int(input().strip())

count_by_kw = {}
for i in range(n):
    s=''.join(sorted(input().strip()))
    if s in count_by_kw.keys():
        count_by_kw[s]+=1
    else:
        count_by_kw[s]=1

c=list(count_by_kw.values())
ans=0
for val in c:
    ans+=val*(val-1)//2

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

A,B,Q = list(map(int,input().split())) 
S = [int(input()) for _ in range(A) ]
T = [int(input()) for _ in range(B) ]
x = [int(input()) for _ in range(Q)]
#S = np.array(S)
#T = np.array(T)
for a in x:
    ans1 = 0
    ans2 = 0
    S1 = list(map(lambda x : abs(x-a),S))
    T1 = list(map(lambda x: abs(x-a),T))
    ans1 +=min(T1)
    ans1 += min(map(lambda x:abs(x-T[T1.index(min(T1))]),S))
    ans2+=min(S1)
    ans2+= min(map(lambda x:abs(x-S[S1.index(min(S1))]),T))
    print(min(ans1,ans2))

### FIXED CODE ###

import bisect
A,B,Q = map(int,input().split()) 
INF = 10**18
S = [-INF]+[int(input()) for _ in range(A)]+[INF]
T = [-INF]+[int(input()) for _ in range(B) ]+[INF]
x = [int(input()) for _ in range(Q)]

for a in x:
    ans1 = 0
    ans2 = 0
    b = bisect.bisect_left(S,a)
    c = bisect.bisect_left(T,a)
    res = INF
    for s in [S[b-1],S[b]]:
        for t in [T[c-1],T[c]]:
            d1,d2 = abs(s-a)+abs(s-t),abs(t-a)+abs(s-t)
            res = min(res,d1,d2)
    print(res)
### BUGGY CODE ###

N = int(input())
A = [int(x) for x in input().split()]
C =[]
for i in A:
    count = 0
    for j in A:
        if i == j:
            count += 1
        if count == 2:
            C.append('NO')
            break
        else:
            C.append('YES')
if 'NO' in C :
    print('NO')
else:
    print('YES')

### FIXED CODE ###

N = int(input())
A = [int(x) for x in input().split()]
B = sorted(A)
NO = False
for i in range(0,len(B)-1):
    if B[i+1] - B[i] == 0:
        NO = True
if NO == True:
    print('NO')
else:
    print('YES')
### BUGGY CODE ###

def Triangles(N, Lrand):
    L = sorted(Lrand, reverse=True)
    cnt = 0
    for i in range(N-2):
        if L[i] >= L[i+1] * 2: break
        for j in range(i+1, N-1):
            if L[i] >= L[j] + L[j+1]: break
            for k in range(j+1, N):
                if L[i] >= L[j] + L[k]: break
                cnt += 1
    return cnt

N = int(input())
L = [int(x) for x in input().split()]
print(Triangles(N, L))

### FIXED CODE ###

from bisect import bisect_left

def Triangles(N, L):
    asc = sorted(L)
    cnt = 0
    for i in range(N-2):
        l1 = asc[i]
        for j in range(i+1, N-1):
            l2 = asc[j]
            pos = bisect_left(asc, l1+l2)
            cnt += pos - 1 - j
    return cnt

N = int(input())
L = list(map(int, input().split()))
print(Triangles(N, L))
### BUGGY CODE ###

n,a,b = map(int,input().split())
su = 0
blue = 0

while True:
    for x in range(0,a):
        if su < n:
            su += 1
            blue += 1
    for y in range(0,b):
        if su >= n:
            break
        su += 1
    else:
        continue
    break


print(str(blue))

### FIXED CODE ###

n,a,b = map(int,input().split())
su = 0
blue = 0

mo = n%(a+b)
mu = int(n/(a+b))

if mo > a:
    ma = mo-a
    blue = n-ma-b*mu
elif mo <= a:
    blue = n- b*mu

print(str(blue))
### BUGGY CODE ###

X = input()

while X.find('ST') != -1:
    X = ''.join(X.split('ST'))

print(len(X))

### FIXED CODE ###

from collections import deque

X = input()
stack = deque([X[0]])

for i in X[1:]:
    if stack:
        if stack[-1] == 'S' and i == 'T':
            stack.pop()
        else:
            stack.append(i)
    else:
        stack.append(i)

print(len(stack))
### BUGGY CODE ###

n = int(input())
A = list(sorted(map(int, input().split())))
q = int(input())
M = list(map(int, input().split()))


def solve(j, i):
    '''A[j]?????§?????¨??????i???M?????????????´??????????A[0],..,A[j]??????????????????????????????
    '''
    if i == 0:
        return True
    if j > n - 1:
        return False

    if i >= A[j]:
        tmp1 = solve(j + 1, i - A[j])
        tmp2 = solve(j + 1, i)
    else:
        # A[j]???????????§???????????§????????????????????????j??????????????\?????????
        return False

    if tmp1 or tmp2:
        return True
    else:
        return False


for i in M:
    if solve(0, i):
        print('yes')
    else:print('no')

### FIXED CODE ###

n = int(input())
A = list(sorted(map(int, input().split())))
q = int(input())
M = list(map(int, input().split()))

R = [[None for j in range(2000)] for i in range(n + 1)]

def solve(i, m):
    if R[i][m] != None:
        return R[i][m]
    if m == 0:
        R[i][m] = True
        return True
    elif i > n - 1:
        R[i][m] = False
        return False
    else:
        ans = solve(i + 1, m) or solve(i + 1, m - A[i])
        R[i][m] = ans
        return ans

sum_A = sum(A)
for i in M:
    if sum_A < i:
        print('no')
    elif solve(0, i):
        print('yes')
    else:
        print('no')
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
ans=[]
for i in range(n):
    s=l.index(i+1)
    ans.append(s)
for j in ans:
    print(j+1, end=' ')

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
ANS=[]
for i in range(N):
    ANS+=[[A[i],i+1]]
ANS.sort()
for i in range(N):
    print(ANS[i][1])
### BUGGY CODE ###

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

ans=0

for i in range(n-1):
    for j in range(i+1,n):
        ans+=list[i]*list[j]

print(ans%1000000007)

### FIXED CODE ###

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

ans=0
wa=0

for i in range(n-2,-1,-1):
    wa+=list[i+1]
    ans+=list[i]*wa

print(ans%1000000007)
### BUGGY CODE ###

from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
dp = [[[0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]
for i in range(n+1):
    for j in range(n+1):
        for k in range(n+1):
            non_zero = i+j+k
            if non_zero == 0:
                continue
            dp[i][j][k] = n/non_zero
            if 0 <= i-1 and j+1 <= n:
                dp[i][j][k] += dp[i-1][j+1][k]*i/non_zero
            if 0 <= j-1 and k+1 <= n:
                dp[i][j][k] += dp[i][j-1][k+1]*j/non_zero
            if 0 <= k-1:
                dp[i][j][k] += dp[i][j][k-1]*k/non_zero
print(dp[c[3]][c[2]][c[1]])


### FIXED CODE ###

from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
dp = [[[0]*(n+1) for _ in range(n+1)] for _ in range(n+1)]

for i in range(n+1):
    for j in range(n+1-i):
        for k in range(n+1-i-j):
            non_zero = i+j+k
            if non_zero == 0:
                continue
            dp[i][j][k] = n
            if 0 <= i-1 and j+1 <= n:
                dp[i][j][k] += dp[i-1][j+1][k]*i
            if 0 <= j-1 and k+1 <= n:
                dp[i][j][k] += dp[i][j-1][k+1]*j
            if 0 <= k-1:
                dp[i][j][k] += dp[i][j][k-1]*k
            dp[i][j][k] /= non_zero

print(dp[c[3]][c[2]][c[1]])
### BUGGY CODE ###

S = input()
Q = int(input())
cnt = 0
mae = ""
usiro = ""
for _ in range(Q):
    q = input().split()
    if len(q) == 1:
        cnt += 1
    else:
        if cnt % 2 == 0:
            if int(q[1]) == 1:
                mae += q[2]
            else:
                usiro += q[2]
        else:
            if int(q[1]) == 1:
                usiro += q[2]
            else:
                mae += q[2]

mae = mae[::-1]
S = mae + S + usiro

if cnt % 2 == 1:
    S = S[::-1]
print(S)

### FIXED CODE ###

S = input()
Q = int(input())
cnt = 0
mae = []
usiro = []
for _ in range(Q):
    q = input().split()
    if len(q) == 1:
        cnt += 1
    else:
        if cnt % 2 == 0:
            if int(q[1]) == 1:
                mae.append(q[2])
            else:
                usiro.append(q[2])
        else:
            if int(q[1]) == 1:
                usiro.append(q[2])
            else:
                mae.append(q[2])

mae = mae[::-1]
S = "".join(mae) + S + "".join(usiro)

if cnt % 2 == 1:
    S = S[::-1]
print(S)
### BUGGY CODE ###

h, n = map(int, input().split())

a = []
b = []

for i in range(n):
    tmp1, tmp2 = map(int, input().split())
    a.append(tmp1)
    b.append(tmp2)

dp = [pow(10, 10)] * (h + 1)
dp[0] = 0

for k in range(n):  # check magic
    for j in range(h):  # check dp
        next_index = min(j + a[k], h)
        dp[next_index] = min(dp[next_index], dp[j] + b[k])

print(dp[h])


### FIXED CODE ###

h, n = map(int, input().split())

a = [0] * n
b = [0] * n

for i in range(n):
    a[i], b[i] = map(int, input().split())

magic = [float("inf")] * (h + 1)
magic[0] = 0

for i in range(n):
    for j in range(0, h + 1):
        if j + a[i] <= h:
            magic[j + a[i]] = min(magic[j + a[i]], magic[j] + b[i])
        else:
            magic[h] = min(magic[h], magic[j] + b[i])

print(magic[h])
### BUGGY CODE ###

NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]
A = list(map(int, input().split()))

done = [1]
now = 1
for i in range(1,N+1):
    nexttown = A[now-1]
    #print(now, "->", nexttown)
    if nexttown not in done:
        done.append(nexttown)
        now = nexttown
    else:
        break

start = done.index(nexttown)
end = len(done)-1
before = start #ループに入るまでの転移数
loop = done[start:]

if K < before:
    saisyuu = done[K]
else:
    nokori = K-before
    n_loop = int(nokori/len(loop))
    hasuu = nokori%len(loop)
    loopfirst = A[done[-1]-1]
    saisyuu = loop[hasuu]
    #print("1から",before,"回転移して",loopfirst,"に到着した後、大きさ",loop,"のループを",n_loop,"回転移して",loopfirst,"にいます。")
    #print("その後、",hasuu,"回の転移をして",saisyuu,"に到着します。")
print(saisyuu)


### FIXED CODE ###

NK = list(map(int, input().split()))
N = NK[0]
K = NK[1]
A = list(map(int, input().split()))

done = [1]
donedic = {}
donedic[1] = 1
now = 1
for i in range(1,N+1):
    nexttown = A[now-1]
    #print(now, "->", nexttown)
    try:
        a = donedic[nexttown]
    except:
        donedic[nexttown] = 1
        done.append(nexttown)
        now = nexttown
    else:
        break

start = done.index(nexttown)
end = len(done)-1
before = start #ループに入るまでの転移数
loop = done[start:]

if K < before:
    saisyuu = done[K]
else:
    nokori = K-before
    n_loop = int(nokori/len(loop))
    loopfirst = done[start]
    hasuu = nokori%len(loop)
    saisyuu = loop[hasuu]
    #print("1から",before,"回転移して",loopfirst,"に到着します。")
    #print("その後、大きさ",len(loop),"のループを",n_loop,"回転移して",loopfirst,"にいます。")
    #print("その後、",hasuu,"回の転移をして",saisyuu,"に到着します。")
print(saisyuu)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 6)


def xy(a, x, y, i):
    if i == n - 2:
        if i % 2:
            return x - y - max(a) + min(a)
        else:
            return x - y + max(a) - min(a)
    t = tuple(a + [x, y])
    if t in memo:
        return memo[t]
    if i % 2:
        L = xy(a[1:], x, y + a[0], i + 1)
        R = xy(a[:-1], x, y + a[-1], i + 1)
        re = min(L, R)
        memo[t] = re
        return re
    else:
        L = xy(a[1:], x + a[0], y, i + 1)
        R = xy(a[:-1], x + a[-1], y, i + 1)
        re = max(L, R)
        memo[t] = re
        return re


memo = {}
n = int(input())
a = list(map(int, input().split()))
if n == 1:
    print(a[0])
    exit()
print(xy(a, 0, 0, 0))


### FIXED CODE ###

def kukan(n, a):
    dp = [[0] * n for _ in range(n)]
    for i in range(n):
        dp[i][i] = a[i]
    for i in range(n - 2, -1, -1):
        for j in range(i + 1, n):
            L = a[i] - dp[i + 1][j]
            R = a[j] - dp[i][j - 1]
            dp[i][j] = L if L > R else R
    return dp[0][n - 1]


n = int(input())
a = list(map(int, input().split()))
print(kukan(n, a))
### BUGGY CODE ###

from heapq import *
n,m,s=map(int,input().split())
c=[0]*n
d=[0]*n
g=[[]for i in range(n)]

for i in range(m):
    u,v,a,b=map(int,input().split())
    u-=1
    v-=1
    g[u].append((v,a,b))
    g[v].append((u,a,b))
for i in range(n):
    c[i],d[i]=map(int,input().split())

flag=0 #if this == (1<<n)-1 then finish roop
endflag=[[False]*2501 for i in range(n)]
mintimes=[10**15]*n

hp=[(0,min(2500,s),0)]#(time,silver,node)
while flag!=((1<<n)-1):
    time,silver,node = heappop(hp)
    flag=flag|(1<<node)
    endflag[node][silver]=True
    mintimes[node]=min(mintimes[node],time)
    for atnode,costmoney,costtime in g[node]:
        if costmoney<=silver and not endflag[atnode][silver-costmoney]:
            heappush(hp,(time+costtime,silver-costmoney,atnode))
    if silver!=2500 and not endflag[node][min(silver+c[node],2500)]:
        heappush(hp,(time+d[node],min(silver+c[node],2500),node))
        
print(*mintimes[1:],sep="\n")

### FIXED CODE ###

from heapq import *
n,m,s=map(int,input().split())
c=[0]*n
d=[0]*n
g=[[]for i in range(n)]

for i in range(m):
    u,v,a,b=map(int,input().split())
    u-=1
    v-=1
    g[u].append((v,a,b))
    g[v].append((u,a,b))
for i in range(n):
    c[i],d[i]=map(int,input().split())

flag=0 #if this == (1<<n)-1 then finish roop
lasttime=[[10**15]*2501 for i in range(n)]
lasttime[0][min(2500,s)]=0
mintimes=[10**15]*n
hp=[(0,min(2500,s),0)]#(time,silver,node)

while flag!=((1<<n)-1):
    time,silver,node = heappop(hp)
    flag=flag|(1<<node)
    mintimes[node]=min(mintimes[node],time)

    for atnode,costmoney,costtime in g[node]:
        nexttime,nextsilver=time+costtime,silver-costmoney
        if costmoney<=silver and lasttime[atnode][nextsilver]>nexttime:
            heappush(hp,(nexttime,nextsilver,atnode))
            lasttime[atnode][nextsilver]=min(lasttime[atnode][nextsilver],nexttime)

    nexttime,nextsilver=time+d[node],min(silver+c[node],2500)
    if silver!=2500 and lasttime[node][nextsilver]>nexttime:
        heappush(hp,(nexttime,min(silver+c[node],2500),node))
        lasttime[node][nextsilver]=min(lasttime[node][nextsilver],nexttime)
        
print(*mintimes[1:],sep="\n")
### BUGGY CODE ###

from collections import Counter
N = int(input())
A = Counter(list(map(int, input().split(' '))))
ans = 0
for i in A.keys():
    flg = True
    if A[i] > 1:
        continue
    tmp = set([])
    for j in range(1,int(i**0.5)+2):
        if not i%j:
            tmp.add(j)
            tmp.add(i//j)
    for k in tmp:
        if A[k] and i != k:
            flg = False
            break
    if flg:
        ans += 1
print(ans)

### FIXED CODE ###

from collections import Counter
N = int(input())
A = Counter(list(map(int,input().split(' '))))
ans = 0
m = max(A.keys())
L = [1]*(10**6+1)
for i in sorted(A.keys()):
    if not L[i]:
        continue
    if A[i] == 1:
        ans += 1
    for j in range(i,m+1,i):
        L[j] = 0
print(ans)
### BUGGY CODE ###

s = list(input())
counter = 0
flag = True
while flag:
  for pointer in range(0, len(s)-1):
    if s[pointer] != s[pointer + 1]:
      del s[pointer:pointer+2]
      counter += 2
      break
  else:
    flag = False
print(counter)

### FIXED CODE ###

s = list(input())
r = s.count("0")
b = s.count("1")
print(min(r, b) * 2)
### BUGGY CODE ###

from collections import deque
h,w=map(int,input().split())
meiro=[]
for i in range(h):
	tmp=input()
	meiro.append([tmp[i] for i in range(w)])



def bfs(sh,sw,eh,ew,meiro):
	que=deque([[sh,sw]])
	dist=[[-1 for _ in range(w)] for _ in range(h)]
	dist[sh][sw]=0
	
	while True:
		check=que.popleft()
		hnow=check[0]
		wnow=check[1]
		
		dnow=dist[hnow][wnow]
		
		if hnow==eh and wnow== ew:
			return dnow
		
		hnext=hnow-1
		wnext=wnow
		if 0 < hnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow+1
		wnext=wnow
		if h-1 > hnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow
		wnext=wnow-1
		if 0 < wnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow
		wnext=wnow+1
		if w-1 > wnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1

roadlist=[]
for i in range(h):
	for j in range(w):
		if meiro[i][j] == ".":
			roadlist.append([i,j])

max=0
for start in roadlist:
	for end in roadlist:
		tmp=bfs(start[0],start[1],end[0],end[1],meiro)
		if tmp > max:
			max = tmp

print(max)




### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
meiro=[]
for i in range(h):
	tmp=input()
	meiro.append([tmp[i] for i in range(w)])



def bfs(sh,sw,meiro):
	que=deque([[sh,sw]])
	dist=[[-1 for _ in range(w)] for _ in range(h)]
	dist[sh][sw]=0

	while True:
		if que == deque([]):
			tmpmax=0
			for di in dist:
				tmptmpmax=max(di)
				if tmptmpmax>tmpmax:
					tmpmax=tmptmpmax
			return tmpmax
		
		
		check=que.popleft()
		hnow=check[0]
		wnow=check[1]
		
		dnow=dist[hnow][wnow]
		
		hnext=hnow-1
		wnext=wnow
		if 0 < hnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow+1
		wnext=wnow
		if h-1 > hnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow
		wnext=wnow-1
		if 0 < wnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1
		
		hnext=hnow
		wnext=wnow+1
		if w-1 > wnow:
			if dist[hnext][wnext]==-1 and meiro[hnext][wnext] == ".":
				que.append([hnext,wnext])
				dist[hnext][wnext]=dnow+1

roadlist=[]
for i in range(h):
	for j in range(w):
		if meiro[i][j] == ".":
			roadlist.append([i,j])

amax=0
for start in roadlist:
	tmp=bfs(start[0],start[1],meiro)
	if tmp > amax:
		amax = tmp

print(amax)
### BUGGY CODE ###

from collections import defaultdict

N, M = [int(x) for x in input().split()]
a = []

for _ in range(M):
    a.append(int(input()))

MOD = 1000000007

dict = defaultdict(int)

for i in range(M):
    if i >= 1 and a[i] - a[i - 1] == 1:
        print("0")
        exit()

dict[0] = 1
for i in range(N):
    if not i in a:
        dict[i + 1] += dict[i]
        dict[i + 2] += dict[i]
    else:
        a.pop(0)


print(dict[N] % MOD)




### FIXED CODE ###

from collections import defaultdict

N, M = [int(x) for x in input().split()]
a = []

for _ in range(M):
    a.append(int(input()))

MOD = 1000000007

dict = defaultdict(int)

for i in range(M):
    if i >= 1 and a[i] - a[i - 1] == 1:
        print("0")
        exit()

dict[0] = 1
a_s = set(a)
for i in range(N):
    if not i in a_s:
        dict[i + 1] += dict[i]
        dict[i + 2] += dict[i]


print(dict[N] % MOD)
### BUGGY CODE ###

from fractions import gcd
a,b,c,d = map(int,input().split())
lcm = int(c*d/gcd(c,d))
ans = 0
syou = (b-a)//lcm
nokori = a + lcm*syou
for i in range(a,a+lcm):
    if i%c != 0 and i%d != 0:
        ans += 1
ans *= syou
for j in range(nokori,b+1):
    if j%c != 0 and j%d != 0:
        ans += 1
print(ans)

### FIXED CODE ###

from fractions import gcd
a,b,c,d = map(int,input().split())
lcm = c*d//gcd(c,d)
ac = (a-1)//c
ad = (a-1)//d
la = (a-1)//lcm
a_ = a-(ac+ad-la)
bc = b//c
bd = b//d
lb = b//lcm
b_ = b-(bc+bd-lb)
ans = b_ - a_ + 1
print(ans)
### BUGGY CODE ###

from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import dijkstra
from collections import Counter

n, x, y = list(map(int, input().split()))
graph = [[0]*n for _ in range(n)]

# 辺を張る
for i in range(n-1):
    graph[i][i+1] = 1
    graph[i+1][i] = 0
graph[x-1][y-1] = 1
graph[y-1][x-1] = 1

graph = csr_matrix(graph)

# 各点からの最短距離を求める
counter = Counter()
for i in range(n):
    dist = dijkstra(csgraph=graph, directed=False, indices=i)
    counter += Counter(dist)

# 答えを出力
for i in range(1, n):
    print(counter[i] // 2)


### FIXED CODE ###

from collections import Counter

n, x, y = list(map(int, input().split()))
counter = Counter()

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

for cnt in range(1, n):
    print(counter[cnt])
### BUGGY CODE ###

N=int(input())
L=list()
for i in range(N):
  L.append(list(input())*2)
L=L*2
ans=0
for o in range((2*N)-1):
  a=0
  if o<N:
    i=0
    j=o
    omomi=N-j
  else:
    j=0
    i=o-N+1
    omomi=N-i
  for t in range(N):
    for q in range(t):
      if L[i+t][j+q]!=L[i+q][j+t]:
        a=1
        break
    if a==1:
      break
  if a==0:
    ans+=omomi
print(ans)

### FIXED CODE ###

N=int(input())
L=list()
for i in range(N):
  L.append(list(input())*2)
L=L*2
ans=0
for o in range((2*N)-1):
  a=0
  if o<N:
    i=0
    j=o
    omomi=N-j
  else:
    j=0
    i=o-N+1
    omomi=N-i
  for t in range(N):
    for q in range(t):
      if L[i+t][j+q]!=L[i+q][j+t]:
        a=1
        break
    if a==1:
      break
  if a==0:
    ans+=omomi
print(ans)
### BUGGY CODE ###

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

ans = 0
for i,p in enumerate(Ps):
  if p==min(Ps[:i+1]):
    ans += 1
  if p==1:
    break
    
print(ans)

### FIXED CODE ###

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

ans = 0
min_val = Ps[0]
for i,p in enumerate(Ps):
  if p<=min_val:
    ans += 1
    min_val = p
print(ans)
### BUGGY CODE ###

n = int(input())

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

ans = 0

for i in range(len(a)):
    flag = False
    for j in range(len(a)):
        if i == j:
            continue

        if a[i] % a[j] == 0:
            flag = True
            break
    
    if flag == False:
        ans += 1

print(ans)

### FIXED CODE ###

n = int(input())

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

ans = 0
d = {}


for i in range(len(a)):
    if a[i] in d.keys():
        d[a[i]] += 1
    else:
        d[a[i]] = 1
max_ = max(a)
arr = [True] * (max_+1) 
ans = 0

for i in range(1, max_+1):
    if i in d.keys() and arr[i]:
        temp = i
        # print("i: ", i)
        while (temp + i) <= (max_):
            # print(temp+i)
            arr[(temp+i)] = False

            temp += i

        if d[i] == 1:
            ans += 1
# print(arr)
print(ans)
### BUGGY CODE ###

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

for i in range(m):
	amax = max(a_s)
	a_s[a_s.index(amax)] = amax // 2

res = sum(a_s)
print(res)


### FIXED CODE ###

from math import ceil
from heapq import *

n, m = map(int, input().split())
a_s = [-int(a) for a in input().split()]
heapify(a_s)

for _ in range(m):
	amax = heappop(a_s)
	heappush(a_s, ceil(amax / 2))

res = sum([-heappop(a_s) for _ in range(n)])
print(res)