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

def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
ans = 0
const = 1000000007

n = i_in()
a = l_in(int)

for i in range(n):
    ans += sum(a[i+1:])*a[i]

ans %= const
print(ans)


### FIXED CODE ###

def l_in(type_): return list(map(type_, input().split()))
def i_in(): return int(input())
def m_in(type_): return map(type_, input().split())
def r_in(n, type_): return [type_(input()) for _ in range(n)]
const = 1000000007
ans = 0

n = i_in()
a = l_in(int)

ins = 0
for i in range(1, n):
    ins += a[i-1]
    ans += ins * a[i]

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

import sys
import itertools
n = int(input())
s = input()
s_list = [i for i in s]
a = list(itertools.combinations(s_list, 3))
print(len(list(set(a))))

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N,S = read().decode('utf-8').split()
count = 0
for i in range(1000):
  s = str(i).zfill(3)
  index_all = 0
  for j in range(3):
    index = S[index_all:].find(s[j])
    if index == -1:
      break
    index_all += index+1
    if j ==2:
      count += 1
print(count)
### BUGGY CODE ###

def main():
    s = input()
    t = input()
    S = len(s)
    T = len(t)
    dp = [[""]*(S+1) for _ in range(T+1)]

    for i in range(T):
        for j in range(S):
            if s[j] == t[i]:
                dp[i+1][j+1] = dp[i][j] + s[j]
            else:
                if len(dp[i+1][j]) >= len(dp[i][j+1]):
                    dp[i+1][j+1] = dp[i+1][j]
                else:
                    dp[i+1][j+1] = dp[i][j+1]
    print(dp[T][S])
if __name__ == '__main__':
    main()


### FIXED CODE ###

s = input()
t = input()
S = len(s)
T = len(t)
dp = [[0]*(T+1) for _ in range(S+1)]

for i in range(S):
    for j in range(T):
        if s[i] == t[j]:
            dp[i+1][j+1] = dp[i][j] + 1
        else:
            dp[i+1][j+1] = max(dp[i+1][j], dp[i][j+1])

ans = ""
while S and T:
    if dp[S][T] == dp[S-1][T]:
        S -= 1
    elif dp[S][T] == dp[S][T-1]:
        T -= 1
    else:
        ans = s[S-1]+ans
        S -= 1
        T -= 1
print(ans)
### BUGGY CODE ###

from collections import deque
from copy import copy

row, column = map(int, input().split())
map1 = [list(map(int, input().split())) for _ in range(row)]
map2 = [list(map(int, input().split())) for _ in range(row)]

n1 = map1[0][0]
n2 = map2[0][0]
queue = deque([(0, 0, n1, n2), (0, 0, n2, n1)])
ansque = deque()

def bfs(queue):
    while True:
        nextqueue = deque()
        while queue:
            posr, posc, red, blue = queue.popleft()
            if (posr, posc) == (row - 1, column - 1):
                ansque.append(abs(red - blue))
            for dr, dc in zip([1, 0], [0, 1]):
                nextr = posr + dr
                nextc = posc + dc
                if 0 <= nextr < row and 0 <= nextc < column:
                    n1 = map1[nextr][nextc]
                    n2 = map2[nextr][nextc]
                    nextqueue.append((nextr, nextc, red + n1, blue + n2))
                    nextqueue.append((nextr, nextc, red + n2, blue + n1))
        if nextqueue:
            queue = copy(nextqueue)
        else:
            return ansque

print(min(bfs(queue)))

### FIXED CODE ###

R, C = map(int, input().split())

A = [list(map(int, input().split())) for _ in range(R)]
B = [list(map(int, input().split())) for _ in range(R)]

dp = [0] * C
dp[0] = s = 1 << 6400

for row_a, row_b in zip(A, B):
    for i, (a, b) in enumerate(zip(row_a, row_b)):
        d = abs(a - b)
        if i > 0:
            dp[i] |= dp[i - 1]
        dp[i] = (dp[i] << d) | (dp[i] >> d)

g = dp[-1]
for i in range(6401):
    if g & (s << i) or g & (s >> i):
        print(i)
        quit()
### BUGGY CODE ###

from sys import stdin

A, B = [int(x) for x in stdin.readline().rstrip().split()]

result = "0"

for d in range(A, B+1):
    # 排他的論理和
    result = (bin(int(result, 2) ^ d))

print(int(result, 2))

### FIXED CODE ###

from sys import stdin

A, B = [int(x) for x in stdin.readline().rstrip().split()]

def isOdd(num):
    if num % 2 == 0:
        return False
    else:
        return True

def solve(num):
    if isOdd(num):
        if (num // 2) % 2 == 0:
            return 1
        else:
            return 0
    else:
        return solve(num+1) ^ (num+1) 


print(solve(B) ^ solve(A-1))
### BUGGY CODE ###

def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n = I()
a = LI()
a.sort()
li = [True]*n
ans = 0
for i in range(n):
  for j in range(i+1,n):
    if a[j] == a[i]:
      li[i] = False
    if a[j]%a[i] == 0:
      li[j] = False
print(li.count(True))

### FIXED CODE ###


def I(): return int(input())
def LI(): return list(map(int,input().split()))
def MI(): return map(int,input().split())
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]

n = I()
inf = 10**6+1
a = LI()
a.sort()
ans = 0
li = [0]*inf
for x in a:
    p = li[x]
    if p != 0:
        li[x] = 2
        continue
    for i in range(x,inf,x):
        li[i] += 1
for i in a:
    if li[i] == 1:
        ans += 1
print(ans)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    for i in range(1,N+1):
        ans=P[:i]
        if i==1:
            count+=1
            #print(i)
        else:
            if min(ans)==ans[-1]:
                count+=1
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, P: "List[int]"):
    count=0
    mi=P[0]
    for i in range(1,N+1):
        if i==1:
            count+=1
            #print(i)
        else:
            if min(mi,P[i-1])==P[i-1]:
                count+=1
                mi=P[i-1]
                #print(i)
    print(count)

    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    P = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, P)

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

def main():
    N = int(input())
    A = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(N)]
    d = 0
    p = [0] * N
    r = N
    while r:
        matched = False
        d += 1
        m = [False] * N
        for i in range(N):
            if m[i]:
                continue
            if p[i] == N - 1:
                continue
            o = A[i][p[i]]
            if (not m[o]) and A[o][p[o]] == i:
                matched = True
                p[i] += 1
                p[o] += 1
                m[i] = True
                m[o] = True
                if p[i] == N - 1:
                    r -= 1
                if p[o] == N - 1:
                    r -= 1
        if not matched:
            return -1
    return d


print(main())


### FIXED CODE ###

def main():
    N = int(input())
    A = [list(reversed(list(map(lambda x: int(x) - 1, input().split())))) for _ in range(N)]
    d = 0
    r = N
    cur = list(range(N))
    w = [a.pop() for a in A]
    while r:
        d += 1
        nxt = []
        for i in cur:
            o = w[i]
            if o == -1:
                continue
            if w[o] == i:
                nxt.append(i)
                nxt.append(o)
                w[i] = -1
                w[o] = -1
        if not nxt:
            return -1
        cur = []
        for i in nxt:
            if A[i]:
                w[i] = A[i].pop()
                cur.append(i)
            else:
                r -= 1
    return d


print(main())
### BUGGY CODE ###

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Created: Jul, 14, 2020 09:41:55 by Nobody
# $Author$
# $Date$
# $URL$
__giturl__ = "$URL$"


from collections import defaultdict
from sys import stdin
input = stdin.readline


def main():
  N, Q = list(map(int, input().split()))
  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)
  PX = defaultdict(int)

  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  ans = [0]*(N+1)
  S = [1]
  visited = set()
  temp = PX[1]

  while len(S):
    now = S[-1]
    visited.add(now)
    is_leaf = True
    for next_ in G[now]:
      if next_ not in visited:
        S.append(next_)
        temp += PX[next_]
        is_leaf = False
        break
    # else:
    if is_leaf:
      S.pop()
      ans[now] = temp
      temp -= PX[now]

  print(*ans[1:], sep=' ')


if(__name__ == '__main__'):
  main()


### FIXED CODE ###

import sys
from collections import defaultdict
from collections import deque
from sys import stdin
sys.setrecursionlimit(10**7)
input = stdin.readline


def main():
  # input
  N, Q = list(map(int, input().split()))

  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)

  PX = defaultdict(int)
  for _ in range(Q):
    p, x = map(int, input().split())
    PX[p] += x

  # solve
  ans = [0]*(N+1)
  visited = set()
  # temp = PX[1]
  # S = [1] # Stack
  # S = deque([1])

  # while len(S):
  #   now = S[-1]
  #   visited.add(now)

  #   for next_ in G[now]:
  #     if next_ not in visited:
  #       S.append(next_)
  #       temp += PX[next_]
  #       break
  #   else:
  #     S.pop()
  #     ans[now] = temp
  #     temp -= PX[now]

  def dfs(now, sum_):
    visited.add(now)
    for next_ in G[now]:
      if next_ not in visited:
        sum_ += PX[next_]
        sum_ = dfs(next_, sum_)

    ans[now] = sum_
    sum_ -= PX[now]
    return sum_

  dfs(1, PX[1])

  print(*ans[1:], sep=' ')


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

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

lst = [True] * N
for i in range(M):
    L, R = map(int, input().split())
    L -= 1
    R -= 1
    for j in range(0, L):
        lst[j] = False
    for j in range(R+1, N):
        lst[j] = False
ans = 0
for i in lst:
    if i:
        ans += 1
print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
L = []
R = []
for i in range(M):
    tmp = list(map(int, input().split()))
    L.append(tmp[0])
    R.append(tmp[1])

ans = min(R) - max(L) + 1
if ans < 0: ans = 0
print(ans)
### BUGGY CODE ###

from collections import deque
s=deque(list(input()))
q=int(input())
for i in range(q):
    query=input()
    if query[0]=="1":
        s.reverse()
        continue
    if query[2]=="1":
        s.appendleft(query[4])
    else:
        s.append(query[4])
print(*s,sep="")

### FIXED CODE ###

from collections import deque
s=deque(list(input()))
q=int(input())
count=0
for i in range(q):
    query=input()
    if query=="1":
        count+=1
    elif query[2]=="1":
        if count%2==0:
            s.appendleft(query[-1])
        else:
            s.append(query[-1])
    else:
        if count%2==0:
            s.append(query[-1])
        else:
            s.appendleft(query[-1])
if count%2==1:
    s.reverse()
print(*s,sep="")
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
b = sorted(a)
for i in b:
  print(a.index(i) + 1,end=" ")

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n):
  ans[a[i]-1] = i+1
for j in range(n):
  print(ans[j],end=" ")
### BUGGY CODE ###

N=int(input())
A=input()
c=0
for i in range(N-2):
 B2=A[i+1]
 B1B=0
 B1R=0
 B1G=0
 for j in range(i+1):
  if A[j]=="B":
   B1B+=1
  elif A[j]=="R":
   B1R+=1
  else:
   B1G+=1
 for k in range(N-i-2):
  B3=A[i+2+k]
  if (B2=="B" and B3=="R")or (B2=="R" and B3=="B"):
   c+=B1G
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="G":
     c-=1
  if (B2=="G" and B3=="R")or (B2=="R" and B3=="G"):
   c+=B1B
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="B":
     c-=1
  if (B2=="B" and B3=="G")or (B2=="G" and B3=="B"):
   c+=B1R
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="R":
     c-=1
print(c)

### FIXED CODE ###

N=int(input())
A=input()
c=0
B1B=0
B1R=0
B1G=0
if A[0]=="B":
 B1B+=1
elif A[0]=="R":
 B1R+=1
else:
 B1G+=1
for i in range(N-2):
 B2=A[i+1]
 for k in range(N-i-2):
  B3=A[i+2+k]
  if (B2=="B" and B3=="R")or (B2=="R" and B3=="B"):
   c+=B1G
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="G":
     c-=1
  if (B2=="G" and B3=="R")or (B2=="R" and B3=="G"):
   c+=B1B
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="B":
     c-=1
  if (B2=="B" and B3=="G")or (B2=="G" and B3=="B"):
   c+=B1R
   if (i+2+k)<=(i+1)*2:
    if A[(i+1)*2-(i+2+k)]=="R":
     c-=1
 if B2=="B":
  B1B+=1
 elif B2=="R":
  B1R+=1
 else:
  B1G+=1
print(c)
### BUGGY CODE ###

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

b_L = []
for i in range(n):
    b_L.append(a_L[i])
    b_L = list(reversed(b_L))

print(*b_L)

### FIXED CODE ###

from collections import deque

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

ans = deque()

if n %2 == 0:
    for i in range(0,n):
        if i %2 != 0:
            ans.appendleft(a_L[i])
        else:
            ans.append(a_L[i])
else:
    for i in range(0,n):
        if i %2 == 0:
            ans.appendleft(a_L[i])
        else:
            ans.append(a_L[i])

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

n = int(input())
s = input()
q = int(input())
for _ in range(q):
    i,x,y = input().split()
    if (i == "1"):
        x = int(x)
        li = list()
        for b in s:
            li.append(b)
        li[x-1] = y
        s = ""
        for b in li:
            s += b
    if (i == "2"):
        x = int(x)
        y = int(y)
        ans = s[x-1:y]
        st = set()
        for b in ans:
            st.add(b)
        print(len(st))

### FIXED CODE ###

def ctoi(x):
    return ord(x)-ord("a")
n = int(input())
s = list(input())
q = int(input())
bit = [[0]*(n+1) for _ in range(26)]

def update(pos,a,x):
    while pos<=n:
        bit[a][pos] += x
        pos += pos&(-pos)

def query(pos):
    ret=[0]*26
    for i in range(26):
        tmp=0
        p=pos
        while p>0:
            tmp+=bit[i][p]
            p-=p&(-p)
        ret[i]=tmp
    return ret

for i in range(n):
    update(i+1,ctoi(s[i]),1)

for _ in range(q):
    flag,a,b = input().split()
    flag=int(flag)
    a=int(a)
    if flag==1:
        if s[a-1]==b:
            continue
        else:
            update(a,ctoi(s[a-1]),-1)
            update(a,ctoi(b),1)
            s[a-1]=b
    else:
        b=int(b)
        c1 = query(b)
        c2 = query(a-1)
        ans = 0
        for i in range(26):
            if c1[i]-c2[i]>0:
                ans += 1
        print(ans)
### BUGGY CODE ###

m_d = list()    # 魔法移動距離
for i in range(-2, 3):
    for j in range(-2, 3):
        if (i,j) not in [(0,0),(-1,0),(0,-1),(1,0),(0,1)]:
            m_d += [(i,j)]

h, w = list(map(int, input().split()))
si, sj = list(map(int, input().split()))
ti, tj = list(map(int, input().split()))
s = [None] * h
for i in range(h):
    s[i] = input()

# 距離情報を一番遠い値で初期化
#import numpy as np
INF = int(1e9)
#dist = np.full((h+4, w+4), INF)
dist = [[INF for j in range(w+4)] for i in range(h+4)]

# マップ境界を壁で囲む
S = ['##{}##'.format(s_row) for s_row in s]
S = ['##{}##'.format('#' * (w+4))]*2 + S
S = S + ['##{}##'.format('#' * (w+4))]*2

# BFS探索用キュー
from collections import deque
q_a = deque() # 徒歩
q_b = deque() # ワープ

# 開始位置、終了位置を調整
si, sj = si+1, sj+1
ti, tj = ti+1, tj+1
dist[si][sj] = 0
q_a.append([si,sj])

while (len(q_a)>0):
    i, j = ij = q_a.popleft()
    d = dist[i][j]
    for di, dj in [(-1,0),(0,-1),(1,0),(0,1)]:
        ni, nj = di+i, dj+j
        if (S[ni][nj]=='#'):
            q_b.append(ij)
            continue # 壁
        if (dist[ni][nj]<=d):
            continue # 探索済みコスト以上
        dist[ni][nj] = d
        q_a.append([ni,nj])

    if len(q_a) == 0:
        while (len(q_b)>0):
            i, j = q_b.popleft()
            d = dist[i][j]
            for di, dj in m_d:
                ni, nj = di+i, dj+j
                if (S[ni][nj]=='#'):
                    continue # 壁
                if (dist[ni][nj]<=d):
                    continue # 探索済みコスト以上
                dist[ni][nj] = d+1
                q_a.append([ni,nj])

ans = dist[ti][tj]
if ans == INF:
    ans = -1
print(ans)


### FIXED CODE ###

h, w = list(map(int, input().split()))
si, sj = list(map(int, input().split()))
ti, tj = list(map(int, input().split()))
s = [None] * h
for i in range(h):
    s[i] = input()

# 移動Aで探索する方向
d_a = [(-1,0), (0,-1),(1,0),(0,1)]
# 移動Bで探索する方向
d_b = [ (i, j) for j in range(-2, 3) for i in range(-2, 3)]

# 距離情報を一番遠い値で初期化
#import numpy as np
INF = int(1e9)
#dist = np.full((h+2, w+2), INF)
dist = [[INF for j in range(w+2)] for i in range(h+2)]

# マップ境界と壁を距離0にして探索させない
for i in range(h+2):
    dist[i][0] = 0
    dist[i][-1] = 0
for j in range(w+2):
    dist[0][j] = 0
    dist[-1][j] = 0
for i in range(h):
    for j in range(w):
        if s[i][j]=='#': dist[i+1][j+1] = 0
#dist = [[INF for j in range(w)] for i in range(h)]

# 01-BFS探索用キュー
from collections import deque
q = deque()

# 開始位置
dist[si][sj] = 0
q.append((si,sj))

while (len(q)>0):
    i, j = q[0]
    d = dist[i][j]
    q.popleft()
    # 移動Aによるコスト
    for v in range(len(d_a)):
        di, dj = d_a[v][0]+i, d_a[v][1]+j
        if (di, dj) == (ti, tj):
            print(d)
            exit(0)
        if (dist[di][dj]<=d):
            continue # 探索済みコスト以上
        dist[di][dj] = d
        q.appendleft((di, dj))
    # 移動Bによるコスト
    for v in range(len(d_b)):
        # マップ境界で2以上移動したときに、反対の境界に向かうように剰余を取る
        di, dj = (d_b[v][0]+i)%(h+2), (d_b[v][1]+j)%(w+2)
        if (dist[di][dj]<=d):
            continue # 探索済みコスト以上
        dist[di][dj] = d+1
        q.append((di, dj))

ans = dist[ti][tj]
if ans == INF:
    ans = -1
print(ans)
### BUGGY CODE ###

from itertools import permutations


def solve(n, m, r):
    ans = 10**18
    d = [[10**18]*n for _ in range(n)]
    rx = list(i-1 for i in map(int, input().split()))

    for i in range(m):
        s, t, length = map(int, input().split())
        d[s-1][t-1] = length
        d[t-1][s-1] = length

    for i in range(n):
        d[i][i] = 0

    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

    for p in permutations(rx, r):
        from_p1_to_pr = 0
        for p_j,  p_next in zip(p, p[1:]):
            from_p1_to_pr += d[p_j][p_next]
        ans = min(ans, from_p1_to_pr)

    return ans


if __name__ == '__main__':
    n, m, r = map(int, input().split())
    print(solve(n, m, r))


### FIXED CODE ###

from itertools import permutations


def solve(n, m, r):
    ans = 10**18
    d = [[10**18]*n for _ in range(n)]
    rx = list(i-1 for i in map(int, input().split()))

    for i in range(m):
        s, t, length = map(int, input().split())
        d[s-1][t-1] = length
        d[t-1][s-1] = length

    for i in range(n):
        d[i][i] = 0

    for k in range(n):
        for i in range(n):
            for j in range(n):
                dt = d[i][k] + d[k][j]
                if dt < d[i][j]:
                    d[i][j] = dt

    for p in permutations(rx):
        from_p1_to_pr = 0
        for p_j,  p_next in zip(p, p[1:]):
            from_p1_to_pr += d[p_j][p_next]
        if from_p1_to_pr < ans:
            ans = from_p1_to_pr

    return ans


if __name__ == '__main__':
    n, m, r = map(int, input().split())
    print(solve(n, m, r))
### BUGGY CODE ###

memo = {0:0, 1:1, 2:1}
def calc(x):
  global memo
  if x in memo:
    return memo[x]
  c = bin(x).count('1')
  y = x % c
  res = calc(y) + 1
  memo[x] = res
  return res

for i in range(3, 2*10**5+1):
  calc(i)

N = int(input())
X = input()
c = X.count('1')
X_int = int(X, 2)
Xmodp = X_int % (c+1)
Xmodm = X_int % (c-1) if c > 1 else 0

ans = []
digit = 1 << (N - 1)
for x in X:
  if x == '0':
    ans.append(
      memo[(Xmodp + digit%(c+1)) % (c+1)] + 1
    )
  else:
    if c == 1:
      ans.append(0)
    else:
      ans.append(
        memo[(Xmodm - digit%(c-1)) % (c-1)] + 1
      )  
  digit >>= 1

print(*ans, sep='\n')

### FIXED CODE ###

N = int(input())
X = input()
c = X.count('1')
if c == 0:
  for i in range(N):
    print(1)
  quit()
if c == 1:
  if int(X[-1]):
    for i in range(N-1):
      print(2)
    print(0)
  else:
    for i in range(N-1):
      if int(X[i]):
        print(0)
      else:
        print(1)
    print(2)
  quit()

memo = {0:0, 1:1, 2:1}
def calc(x):
  global memo
  if x in memo:
    return memo[x]
  c = bin(x).count('1')
  y = x % c
  res = calc(y) + 1
  memo[x] = res

for i in range(3, 2*10**5+1):
  calc(i)

Xmodp = Xmodm = 0
digit_p = digit_m = 1
digit = {}
for i in range(N):
  if int(X[-i-1]):
    Xmodp += digit_p
    Xmodp %= c + 1
    Xmodm += digit_m
    Xmodm %= c - 1
  digit[i] = [digit_p, digit_m]
  digit_p = (digit_p * 2) % (c+1)
  digit_m = (digit_m * 2) % (c-1)

ans = []
for i in range(N):
  x = int(X[-i-1])
  if x:
    ans.append(memo[(Xmodm - digit[i][1]) % (c-1)] + 1)
  else:
    ans.append(memo[(Xmodp + digit[i][0]) % (c+1)] + 1)

ans = ans[::-1]
print(*ans, sep='\n')
### BUGGY CODE ###

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
l = nl()

l = sorted(l)[::-1]

ans = 0


for a in range(n):
    fl = 0
    for b in range(a+1,n):
        if a > b*2:
            break
        for c in range(b+1,n):
            A = l[a]
            B = l[b]
            C = l[c]

            if A >= B + C:
                break

            ans += 1

print(ans)

### FIXED CODE ###

import bisect

ni = lambda: int(input())
nm = lambda: map(int, input().split())
nl = lambda: list(map(int, input().split()))

n = ni()
l = nl()

l = sorted(l)

ans = 0

for a in range(n):
    fl = 0
    A = l[a]
    for b in range(a+1,n):
        B = l[b]

        idx = bisect.bisect_left(l, A+B)
        ans += max(0,idx-b-1)

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

n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1, n+1):
    for j in range(1, n+1):
        r = min(
            abs(i-j),
            abs(x-i) + 1 + abs(y-j),
            abs(y-i) + 1 + abs(x-j)
        )
        if r > n-1:
            continue
        ans[r] += 1

for r in ans[1:]:
    print(r//2)

### FIXED CODE ###

n, x, y = map(int, input().split())
ans = [0] * n
for i in range(1, n+1):
    for j in range(i, n+1):
        r = min(
            abs(i-j),
            abs(x-i) + 1 + abs(y-j),
            abs(y-i) + 1 + abs(x-j)
        )
        ans[r] += 1

print("\n".join(map(str, ans[1:])))