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

import heapq
from collections import defaultdict
def gijkstra(n,E,key=1,s=1):
    d = {i:float('inf') for i in range(1,n+1)}
    p = {i:-1 for i in range(1,n+1)}
    hq = [(0,s)]
    d[s] = 0
    while hq:
        u = heapq.heappop(hq)[1]
        for e in E[u]:
            c, v = d[u] + e[key], e[0]
            if d[v] > c:
                d[v] = c
                p[v] = u
                heapq.heappush(hq,(c,v))
    return d, p

n, m, s, t =  map(int,input().split())
E = defaultdict(set)

for i in range(m):
    u,v,a,b = tuple(map(int,input().split()))
    E[u].add((v,a,b))
    E[v].add((u,a,b))
d1, _ = gijkstra(n,E,key=1,s=s)
d2, _ = gijkstra(n,E,key=2,s=t)
d = [d1[v]+d2[v] for v in range(1,n+1)]
for i in range(n):
    print(10**15 - min(d[i:]))

### FIXED CODE ###

import heapq
from collections import defaultdict
def gijkstra(n,E,s=1):
    d = [float('inf')]*(n+1)
    p = [-1]*(n+1)
    hq = [(0,s)]
    d[s] = 0
    while hq:
        u = heapq.heappop(hq)[1]
        for v, c in E[u]:
            if d[v] > d[u] + c:
                d[v], p[v] = d[u]+c, u
                heapq.heappush(hq, (d[u]+c, v))
    return d, p

n, m, s, t =  map(int,input().split())
E1 = defaultdict(set)
E2 = defaultdict(set)

for i in range(m):
    u,v,a,b = tuple(map(int,input().split()))
    E1[u].add((v,a))
    E1[v].add((u,a))
    E2[u].add((v,b))
    E2[v].add((u,b))
d1, _ = gijkstra(n,E1,s=s)
d2, _ = gijkstra(n,E2,s=t)
d = [d1[-1] + d2[-1],]
for i in range(n-1,0,-1):
    d.append(min(d[-1],d1[i]+d2[i]))
[print(10**15-c) for c in reversed(d)]
### BUGGY CODE ###

K,S=map(int,input().split())
K+=1
ans=0
for i in range(K):
  for j in range(K):
    for k in range (K):
      if(i+j+k==S):
        ans+=1
print(ans)

### FIXED CODE ###

K,S=map(int,input().split())
ans=0
#a=max(0,S-2*K)
for i in range(K+1):
  for j in range(K+1):
    if i+j+K>=S and i+j<=S :
      ans+=1

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

def get_answer(ki):
    n = ki[0][0]
    q = ki[0][1]
    #n_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[1:-q]]]
    #q_data = [[int(k[0]), int(k[1])] for k in [k.split(" ") for k in ki[-q:]]]
    n_data = ki[1:-q]
    #q_data = ki[-q:]
    q_index = [0] * n
    for qq in ki[-q:]:
        q_index[qq[0] - 1] += qq[1]

    score = [0] * n

    """
        assert get_answer(["4 3",
                       "1 3", "1 4", "2 3",
                       "2 10", "1 100", "3 1"]) == "100 111 101 100"
    """
    t_index = []
    for i in range(0, n + 1):
        t_index.append([])
    for nn in n_data:
        t_index[nn[0]].append(nn[1])
        t_index[nn[1]].append(nn[0])

    t_stack = [1]
    s_stack = [0]
    r_flag = [0] * n
    while len(t_stack) > 0:
        i = t_stack.pop()
        s = s_stack.pop()
        if r_flag[i - 1]:
            continue
        r_flag[i - 1] = 1
        s += q_index[i - 1]
        score[i - 1] += s
        t_stack += t_index[i]
        s_stack += [s] * len(t_index[i])

    s_value = str(score[0])
    for i in range(1, n):
        s_value += " " + str(score[i])
    return s_value


if __name__ == "__main__":
    input_ki = []
    while True:
        try:
            input1 = input()
            if not input1:
                break;
            if len(input1) == 0:
                break;
            s = input1.split(" ")
            input_ki.append([int(s[0]), int(s[1])])
        except EOFError:
            break
    print(get_answer(input_ki))


### FIXED CODE ###

import collections

n,q=map(int,input().split())
cnt=[0]*(n+1)
g=[[] for _ in range(n+1)]
for _ in range(n-1): #木グラフの隣接リストを作成
 a,b=map(int,input().split())
 g[a].append(b)
 g[b].append(a)
for _ in range(q): #各頂点についてcount[v]を計算
 v,val=map(int,input().split())
 cnt[v]+=val
q=collections.deque()
q.append(1) #DFSのスタックによる実装、まずスタックに始点1を積む
checked=[0]*(n+1) #各頂点を見たかどうかのフラグを持っておく
while q:
 v=q.pop()
 checked[v]=1 #頂点を見たかどうかのフラグを更新する
 for u in g[v]:
   if checked[u]==1: #vの子ノードuについて、まだ見ていない頂点であればcount[u]をcount[u]+=count[v]として更新する
     continue
   cnt[u]+=cnt[v]
   q.append(u) #スタックに子ノードuを積む
print(*cnt[1:]) #各頂点のcountが答えとなる
### BUGGY CODE ###

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

m=1000000007

def conbmod(a,b,m):
    ans=1
    bikkuri=1
    for i in range(b):
        ans*=(a-i)
        bikkuri*=i+1
        ans=ans%m
        bikkuri=bikkuri%m
    
    while ans%bikkuri!=0:
        ans+=m
    return int(ans/bikkuri)
    
    

if y<=2*x  and x<=2*y and (2*x-y)%3==0 and (2*y-x)%3==0:
    a=(2*y-x)//3
    b=(2*x-y)//3
    
    print(conbmod(a+b,b,m))
else:
    print(0)

### 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 )

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

m=1000000007

    

if y<=2*x  and x<=2*y and (2*x-y)%3==0 and (2*y-x)%3==0:
    a=(2*y-x)//3
    b=(2*x-y)//3
    
    print(cmb(a+b,b,m))
else:
    print(0)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
Q=int(input())
Gokei=[]

for _ in range(Q):
    B,C=map(int,input().split())
    A=[C if i==B else i for i in A]
    Gokei.append(sum(A))

for i in range(Q):
    print(Gokei[i])
    i+=1

### FIXED CODE ###

from collections import Counter
N = int(input())
A = list(map(int, input().split()))
Q = int(input())
 
ans = sum(A)
d = Counter(A) #Counterで要素をまとめる
 
for i in range(Q):
    b, c = map(int,input().split())
    tmp = d[b] #bの総数を記憶
    d[b] = 0 #bの総数を0にする
    d[c] += tmp #cの総数にbの総数を足す
    ans += (c-b)*tmp #合計の補正
    print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(114514)

n, z, w = map(int, input().split())
aa = list(map(int, input().split()))

memo = {}
def act(xlast, ylast, turn):
    x = z if xlast == -1 else aa[xlast]
    y = w if ylast == -1 else aa[ylast]

    if xlast == n - 1 or ylast == n - 1:
        return abs(x - y)
    
    if (xlast, ylast, turn) in memo:
        return memo[(xlast, ylast, turn)]
    
    if turn == 0:
        # x turn
        ans = 0
        for i in range(ylast + 1, n):
            ans = max(ans, act(i, ylast, 1))
    else:
        # y turn
        ans = 1 << 30
        for i in range(xlast + 1, n):
            ans = min(ans, act(xlast, i, 0))
    
    memo[(xlast, ylast, turn)] = ans
    return ans

print(act(-1, -1, 0))


### FIXED CODE ###

import sys
sys.setrecursionlimit(114514)

n, z, w = map(int, input().split())
aa = list(map(int, input().split()))

memo = {}
def act(last, turn):
    if (last, turn) in memo:
        return memo[(last, turn)]

    if turn == 0:
        # x turn
        y = w if last == -1 else aa[last]
        ans = abs(y - aa[n - 1])
        for i in range(last + 1, n - 1):
            ans = max(ans, act(i, 1))
    else:
        # y turn
        x = z if last == -1 else aa[last]
        ans = abs(x - aa[n - 1])
        for i in range(last + 1, n - 1):
            ans = min(ans, act(i, 0))
    
    memo[(last, turn)] = ans
    return ans


print(act(-1, 0))
### BUGGY CODE ###

k=int(input())
if k%2==0:exit(print(-1))
ans=0
x=k
for i in range(10**9):
  while x%10!=7:x+=k
  x//=10
  if x==0:exit(print(i+1))

### FIXED CODE ###

import time
start=time.time()
k=int(input())
if k%2==0:exit(print(-1))
ans=0
x=k
for i in range(10**9):
  while x%10!=7:
    x+=k
    if time.time()-start>=1.9:exit(print(-1))
  x//=10
  if x==0:exit(print(i+1))
### BUGGY CODE ###

n = int(input())
lst = list(map(int, input().split()))
ans = 0
a,b = 0,0
lst2=[0]
for i in range(n):
    lst2.append(sum(lst[:i+1]))

temp = set()

for i in range(n):
    l = lst2.count(i)
    if l > 1 and i not in temp:
        temp.add(i)
        ans += l*(l-1)//2
print(ans)


"""
6
1 3 -4 2 2 -2


7
1 -1 1 -1 1 -1 1

5
1 -2 3 -4 5


0 0 0 0 0
"""

### FIXED CODE ###

n = int(input())
lst = list(map(int, input().split()))
ans = 0
a,b = 0,0
lst2=[0]
d = {0:1}
for i in range(n):
    s = lst2[-1]+lst[i]
    lst2.append(s)
    if s not in d:
        d[s] = 1
    else:
        d[s] += 1

temp = set()

for i in d:
    l = d[i]
    if l > 1 and i not in temp:
        temp.add(i)
        ans += l*(l-1)//2
print(ans)


"""
6
1 3 -4 2 2 -2


7
1 -1 1 -1 1 -1 1

5
1 -2 3 -4 5


0 0 0 0 0
"""
### BUGGY CODE ###

def divisor(n): 
    i = 1
    table = []
    while i * i <= n:
        if n%i == 0:
            table.append(i)
            table.append(n//i)
        i += 1
    table = list(set(table))
    return table

def main():
    n = int(input())
    a = list(map(int, input().split()))
    
    ans = set(divisor(a[0]))
    for i in range(1, n):
        tmp = set(divisor(a[i]))
        ans = ans & tmp
    
    print(max(ans))

    
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    m = min(a)
    next_m = m
    count = 0
    while count != n:
        m = next_m
        count = 0
        pre = a[0]
        for i in range(n):
            if a[i] == pre:
                count += 1
            a[i] %= m
            if a[i] != 0:
                next_m = min(next_m, a[i])
            else:
                a[i] = m
            pre = a[i]
    print(m)
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

def gcd(p,q):
    r=max([p,q])
    s=min([p,q])
    if s==0:
        return 1
    elif r%s==0:
        return s
    else:
        return gcd(s,r%s)
def plus(a,b):
    c=a[0]*b[1]+b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)
def div(a,b):
    c=a[0]*b[1]
    d=a[1]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def times(a,b):
    c=a[1]*b[1]
    d=a[0]*b[0]
    g=gcd(c,d)
    return (c//g,d//g)
def minus(a,b):
    c=a[0]*b[1]-b[0]*a[1]
    d=a[1]*b[1]
    g=gcd(c,d)
    return (c//g,d//g)

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[(0,1) for i in range(N)]
a[0]=(1,1)
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    t=a[x[i]]
    a[x[i]]=minus(a[x[i]],div(t,(b[x[i]]+1,1)))
    a[y[i]]=plus(a[y[i]],div(t,(b[x[i]]+1,1)))
n=0
for i in range(N):
    if a[i][0]!=0:
        n+=1
print(n)


### FIXED CODE ###

N,M=map(int,input().split())
x=[0 for i in range(M)]
y=[0 for i in range(M)]
for i in range(M):
    x[i],y[i]=map(int,input().split())
    x[i]-=1
    y[i]-=1
a=[0 for i in range(N)]
a[0]=1
b=[1 for i in range(N)]
for i in range(M):
    b[x[i]]-=1
    b[y[i]]+=1
    if a[x[i]]==1:
        a[y[i]]=1
    if b[x[i]]==0:
        a[x[i]]=0
print(sum(a))
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N = int(input())
lst = []
for i in range(N):
    lst.append(int(input()))

n=0
for i in range(N):
    n,lst[i] = lst[i],n
    print(max(lst))
    n,lst[i] = lst[i],n


### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
    A.append(int(input()))
B = sorted(A, reverse = True)

for i in range(N):
    if A[i] == B[0]:
        print(B[1])
    else:
        print(B[0])
### BUGGY CODE ###

#!/usr/bin/python3

# main
q = int(input())
for a in range(q):
    X = input()
    Y = input()
    m = len(X)
    n = len(Y)
    c = [[0 for j in range(n + 1)] for i in range(m + 1)]
    for i in range(m + 1):
        c[i][0] = 0
    for j in range(n + 1):
        c[0][j] = 0
    for i in range(1, m + 1):
        for j in range(1, n + 1):
            if X[i - 1] == Y[j - 1]:
                c[i][j] = c[i - 1][j - 1] + 1
            else:
                c[i][j] = max(c[i][j - 1], c[i - 1][j])
    print(c[m][n])

### FIXED CODE ###

#!/usr/bin/python3
import itertools
# main
q = int(input())
for a in range(q):
    X = input()
    Y = input()
    cost = [0]
    for c in Y:
        for i in range(len(cost) - 1, -1, -1):
            index = X.find(c, cost[i]) + 1
            if index:
                if i + 1 < len(cost):
                    cost[i + 1] = min(cost[i + 1], index)
                else:
                    cost.append(index)
    print(len(cost) - 1)
### BUGGY CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W, D = map(int, readline().split())
    A = [list(map(int, readline().split())) for _ in range(H)]
    Q, *LR = map(int, read().split())

    vec = [0] * (H * W + 1)
    for i in range(H):
        for j in range(W):
            vec[A[i][j]] = (i + 1, j + 1)

    ans = [0] * Q
    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):
        res = 0
        for j in range(l, r, D):
            res += abs(vec[j + D][0] - vec[j][0]) + abs(vec[j + D][1] - vec[j][1])
        ans[i] = res

    print('\n'.join(map(str, ans)))
    return


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W, D = map(int, readline().split())
    A = [list(map(int, readline().split())) for _ in range(H)]
    Q, *LR = map(int, read().split())

    vec = [0] * (H * W + 1)
    for i in range(H):
        for j in range(W):
            vec[A[i][j]] = (i + 1, j + 1)
    vec[0] = vec[D]

    csum = [0] * D
    for i in range(D):
        N = (H * W - i) // D + 1
        csum[i] = [0] * N
        for j in range(N - 1):
            csum[i][j + 1] = (
                csum[i][j]
                + abs(vec[i + (j + 1) * D][0] - vec[i + j * D][0])
                + abs(vec[i + (j + 1) * D][1] - vec[i + j * D][1])
            )

    ans = [0] * Q
    for i, (l, r) in enumerate(zip(*[iter(LR)] * 2)):
        n, m = divmod(l, D)
        ans[i] = csum[m][(r - l) // D + n] - csum[m][n]

    print('\n'.join(map(str, ans)))
    return


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

# D - RGB Triplets

def get_rgb():
	i = 1
	
	for s in S:
		if s == 'R':
			r_list.append(i)
		elif s == 'G':
			g_list.append(i)
		else:
			b_list.append(i)
		
		i += 1
# -----------------------------


def fix_i_j():
	i = min(r, g)
	j = max(r, g)
	k = j * 2 - i
	
	global ans
	
	if k in b_list:
		ans -= 1


def fix_i_k():
	i = min(r, g)
	k = max(r, g)
	j = (i + k) / 2
	
	global ans
	
	if j in b_list:
		ans -= 1


def fix_j_k():
	j = min(r, g)
	k = max(r, g)
	i = j * 2 - k
	
	global ans
	
	if i in b_list:
		ans -= 1


N = int(input())
S = input()

r_list = []
g_list = []
b_list = []
get_rgb()

ans = len(r_list) * len(g_list) * len(b_list)

for r in r_list:
	for g in g_list:
		fix_i_j()
		fix_i_k()
		fix_j_k()
		 
print(ans)

### FIXED CODE ###

# D - RGB Triplets
	
N = int(input())
S = input()
	
r, g, b = 0, 0, 0
	
for s in S:
	if s == 'R':
		r += 1
	elif s == 'G':
		g += 1
	else:
		b += 1
	
ans = r * g * b
	
for i in range(N - 2):
	for j in range(i + 1, N - 1):
		k = j * 2 - i
			
		if k < N:
			if S[i] != S[j] and S[i] != S[k] and S[j] != S[k]:
				if j -i == k -j:
					ans -= 1
	
print(ans)
### BUGGY CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x

        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def members(self, x, candidate_list):
        root = self.find(x)
        return [i for i in candidate_list if self.find(i) == root]

def solve(uf, first_order_friends):
    ret = [0]
    for i in range(1, N + 1):
        ret.append(len(uf.members(i, higher_order_friends[i])) - 1)
    return ret

if __name__ == '__main__':
    N, M, K = map(int, input().split())
    higher_order_friends = [[i for i in range(N + 1)] for _ in range(N + 1)]
    uf = UnionFind(N + 1)

    for _ in range(M):
        a, b = map(int, input().split())
        higher_order_friends[a].remove(b)
        higher_order_friends[b].remove(a)
        uf.union(a, b)

    for _ in range(K):
        c, d = map(int, input().split())
        higher_order_friends[c].remove(d)
        higher_order_friends[d].remove(c)

    for ans in solve(uf, higher_order_friends)[1:]:
        print(ans, end=' ')

### FIXED CODE ###

class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x

        self.parents[x] = self.find(self.parents[x])
        return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def same(self, x, y):
        return self.find(x) == self.find(y)

    def size(self, x):
        return -self.parents[self.find(x)]

def solve(uf, except_list):
    ret = [0]
    for i in range(1, N + 1):
        ret.append(uf.size(i) - 1 - len(except_list[i]))
    return ret

if __name__ == '__main__':
    N, M, K = map(int, input().split())
    except_list = [[] for _ in range(N + 1)]
    uf = UnionFind(N + 1)

    for _ in range(M):
        a, b = map(int, input().split())
        except_list[a].append(b)
        except_list[b].append(a)
        uf.union(a, b)

    for _ in range(K):
        c, d = map(int, input().split())
        if not uf.same(c, d):
            continue
        except_list[c].append(d)
        except_list[d].append(c)

    for ans in solve(uf, except_list)[1:]:
        print(ans, end=' ')
### BUGGY CODE ###

import collections as c
d=c.defaultdict(list)
d2=c.defaultdict(list)
a,b=map(int,input().split())
l=[]
for s in range(b):
    g,j=map(int,input().split())
    d[g].append(j)
    d[g]=sorted(d[g])
    l.append([g,j])
for t in d.keys():
    for k,v in enumerate(d[t]):
        d2[t].append([v,k+1])
for sss in l:
    for ttt in d2[sss[0]]:
        if ttt[0]==sss[1]:
            print('{:06d}'.format(sss[0])+'{:06d}'.format(ttt[1]))

### FIXED CODE ###

a,b=map(int,input().split())
l=[]
for _ in range(b):
    c,d=map(int,input().split())
    l.append((c,d))
l2=sorted(sorted(l, key=lambda x:x[1]), key=lambda y:y[0])
m=1
count=0
dic={}
for t in l2:
    if t[0] !=m:
        m=t[0]
        count=1
    else:
        count+=1
    dic[t]=count
#print(dic)
for q in l:
    print('{:06d}'.format(q[0])+'{:06d}'.format(dic[q]))
### BUGGY CODE ###

from queue import Queue

N, Q = map(int, input().split())
G = [tuple(map(int, input().split())) for _ in range(N-1)]
W = [tuple(map(int, input().split())) for _ in range(Q)]


# 親に付いている重み
r = [0,] * (N+1)
for p, x in W:
    r[p] += x



# 木の隣接関係 (a<bは保証されている)
M = [[] for _ in range(N+1)]
for g in G:
    M[g[0]].append(g[1])

# print(M)

# 木の親子関係
P = [[] for _ in range(N+1)]
visited = [0,] * (N+1)

def bfs(start):
    q = Queue()
    q.put(start)
    while not q.empty():
        now = q.get()
        visited[now] = 1
        for child in M[now]:
            if not visited[child]:
                r[child] += r[now]
                q.put(child)


bfs(1)

print(*r[1:])


### FIXED CODE ###

N, Q = map(int, input().split())
G = [tuple(map(int, input().split())) for _ in range(N-1)]
W = [tuple(map(int, input().split())) for _ in range(Q)]


# 親に付いている重み
r = [0,] * (N+1)
for p, x in W:
    r[p] += x



# 木の隣接関係
M = [[] for _ in range(N+1)]
for g in G:
    M[g[0]].append(g[1])
    M[g[1]].append(g[0])

# print(M)

# 木の親子関係
P = [[] for _ in range(N+1)]
visited = [0,] * (N+1)

def dfs(start):
    q = []
    q.append(start)
    while q:
        now = q.pop()
        visited[now] = 1
        for child in M[now]:
            if not visited[child]:
                r[child] += r[now]
                q.append(child)


dfs(1)

print(*r[1:])
### BUGGY CODE ###

n = int(input())
s = input()
li = []
for i in range(0, n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            li.append(s[i]+s[j]+s[k])
print(len(set(li)))


### FIXED CODE ###

n = int(input())
s = input()
li = []
b_li1 = []
b_li2 = []
for i in range(0, n-2):
    if s[i] in b_li1:
        continue
    b_li1.append(s[i])
    for j in range(i+1, n-1):
        if s[i]+s[j] in b_li2:
            continue
        b_li2.append(s[i]+s[j])
        for k in range(j+1, n):
            li.append(s[i]+s[j]+s[k])
print(len(set(li)))
### BUGGY CODE ###

import fractions
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        tmp = fractions.gcd(i,j)
        for m in range(1,k+1):
            cnt += fractions.gcd(m,tmp)
print(cnt)



### FIXED CODE ###

from math import gcd
k = int(input())
cnt = 0
for i in range(1,k+1):
    for j in range(1,k+1):
        tmp = gcd(i,j)
        for m in range(1,k+1):
            cnt += gcd(m,tmp)
print(cnt)
### BUGGY CODE ###

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

ans = [0 for _ in range(N)]
for x in range(1, 151):
  for y in range(1, 151):
    for z in range(1, 151):
      k = (x+y)**2+(y+z)**2+(z+x)**2
      if k % 2 == 0 and k < 2*N:
        ans[((x+y)**2+(y+z)**2+(z+x)**2)//2-1] += 1

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

### FIXED CODE ###

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

ans = [0 for _ in range(N)]
for x in range(1, 101):
  for y in range(1, 101):
    for z in range(1, 101):
      k = (x+y)**2+(y+z)**2+(z+x)**2
      if k % 2 == 0 and k <= 2*N:
        ans[((x+y)**2+(y+z)**2+(z+x)**2)//2-1] += 1

for i in range(N):
  print(ans[i])
### BUGGY CODE ###

#abc160 d
from collections import deque
import itertools
n,x,y=map(int,input().split())
g=[[False]*n for _ in range(n)]

for i in range(n-1):
    g[i][i+1]=True
    g[i+1][i]=True
g[x-1][y-1]=True
g[y-1][x-1]=True

def bfs(s,e):
    color=[False]*n
    dis=[0]*n
    q=deque()
    q.append(s-1)
    color[s-1]=True

    while q:
        now=q.popleft()

        if now==(e-1):
            break
        for i in range(n):
            if g[now][i]==True and color[i]==False:
                dis[i]+=dis[now]+1
                color[i]=True
                q.append(i)
    return dis[e-1]
l=[i for i in range(1,n+1)]
c=itertools.combinations(l,2)
ans=[0]*n
for s,e in c:
    distance=bfs(s,e)
    ans[distance]+=1
for i in range(1,n):
    print(ans[i])

### FIXED CODE ###

n,x,y=map(int,input().split())
x,y=x-1,y-1

ans=[0]*(n+1)



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