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

N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
ans = 0

for i in range(N):
  ans = (ans + A[i] * sum(A[i+1:])) % MOD

print(ans)


### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
MOD = 1000000007
x = sum(A)
ans = 0
 
for i in range(N):
  x -= A[i]
  y = x % MOD
  z = (A[i] * y) % MOD
  ans += z
  ans %= MOD

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

from itertools import product as pro


n = int(input())
s = str(input())

r = [i for i in range(n) if s[i] == 'R']
g = [i for i in range(n) if s[i] == 'G']
b = [i for i in range(n) if s[i] == 'B']
cnt = 0

for i,j,k in pro(r,g,b):
    num = [i, j, k]
    num.sort()
    if num[1]-num[0]==num[2]-num[1]:
        continue
    cnt += 1

print(cnt)


### FIXED CODE ###

from itertools import product as pro

n = int(input())
s = str(input())

r = [i for i in range(n) if s[i] == 'R']
g = [i for i in range(n) if s[i] == 'G']
b = [i for i in range(n) if s[i] == 'B']
cnt = len(r)*len(g)*len(b)

length = max(len(r), len(g), len(b))
if length == len(r):
    max1 = set(r)
    min1 = g
    min2 = b

if length == len(g):
    max1 = set(g)
    min1 = r
    min2 = b

if length == len(b):
    max1 = set(b)
    min1 = g
    min2 = r

for i, j in pro(min1, min2):
    if 2*j-i in max1:
        cnt -= 1
    if 2*i-j in max1:
        cnt -= 1
    if (i+j)/2 in max1:
        cnt -= 1

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

N = input().split()
N = [int(i) for i in N]

count = 0
for i in range(N[0]+1):
  for j in range(N[0]+1):
    for k in range(N[0]+1):
      s = i + j + k
      if(s == N[1]):
        count += 1
print(count)


### FIXED CODE ###

N = input().split()
N = [int(i) for i in N]
count = 0
for i in range(N[0]+1):
    for j in range(N[0]+1):
        k = N[1] - i - j
        if((k <= N[0])and(k>=0)):
            count += 1
print(count)
### BUGGY CODE ###

n, k = [int(i) for i in input().split()]
while abs(n - k) < n:
        n = abs(n-k)
print(n)


### FIXED CODE ###

n, k = [int(i) for i in input().split()]

if n >= k:
    result = min(n % k, k - (n % k))
elif 2 * n >= k > n:
    n = abs(k - n)
    result = n
else:
    result = n

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

# import sys
# import collections
# import numpy as np

# N:県, M:市
N, M = list(map(int, input().split()))
# od = collections.OrderedDict()

L = []
A = {}
B = {}

for i in range(M):
  x = tuple(map(int, input().split()))
  L.append(x)
  k = x[0]
  if k in A.keys():
    A[k].append(x[1])
  else:
    A[k] = [x[1]]  

#print(A)
# A: {県番号: {市1の年:市1のindex, 市2の年:市2のindex}}
 
#c = collections.OrderedDict([('Kuroda', 18), ('Ichiroh', 51), ('Matsui', 55)])
#print(c['Kuroda'])
 
# 県番号でソート
for k in A.keys():
  # keyでソート
  B[k] = (sorted(A[k]))

#print(B)

for x in L:
  # print(B[x[0]])
  # print(x[1])
  num = (B[x[0]].index(x[1])) + 1
  print("{:0>6}{:0>6}".format(x[0], num))
 
 

### FIXED CODE ###

# import sys
 
# N:県, M:市
N, M = list(map(int, input().split()))

A = {}
# {ken: [(city_no, city_year)],...}

res = [None] * M

for i in range(M):
  k, y = list(map(int, input().split()))
  if k in A.keys():
    A[k].append((i, y))
  else:
    A[k] = [(i, y)]

# print(A)
# A: {県番号: {市1の年:市1のindex, 市2の年:市2のindex}}

for k, v in A.items():
  # sort by year
  c_list = sorted(v, key=lambda x: x[1])
  counter = 1
  for c in c_list:
    res[c[0]] = (k, counter)
    counter += 1

for x in res:
  print("{:0>6}{:0>6}".format(x[0], x[1]))
### BUGGY CODE ###

S=raw_input()

M=10**9+7

a=0
ab=0
ans=0
all=1

for x  in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		ans+=ab
	if x=="?":
		ans = ans*3 + ab
		ab = ab*3 + a
		a = a*3 + all
		all *= 3

	ans%=M
	ab%=M
	a%=M
	all%M


print ans%M


### FIXED CODE ###

S=raw_input()

M=10**9+7

all=1
abc=0
ab=0
a=0

for x in S:
	if x=="A":
		a+=all
	if x=="B":
		ab+=a
	if x=="C":
		abc+=ab

	if x=="?":
		abc=abc*3+ab
		ab=ab*3+a
		a= a*3+all
		all*=3

	abc%=M
	ab%=M
	a%=M
	all%=M


print abc%M
### BUGGY CODE ###

from collections import defaultdict

N = int(input())
S = input()
D = defaultdict(int)

res = 0

for i in range(N):
    for j in range(i + 1, N + 1):
        s = S[i:j]
        if s in D and D[s] + (j - i) <= i:
            res = max(res, j - i)
        D[s] = i
        
print(res)

### FIXED CODE ###

n = int(input())
s = input()

ans = 0
right = 1

for left in range(n):
    while s[left:right] in s[right:]:
        ans = max(ans,right-left)
        right += 1
        
print(ans)
### BUGGY CODE ###

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

H, W = map(int, input().split())
dist_matrix = [[-1] * W for _ in range(H)]
#queue = []
queue = deque()
for i in range(H):
  line = input()
  for j,ch in enumerate(line):
    if ch == "#":
      dist_matrix[i][j] = 0
      queue.append([i,j])

#cnt = 0
#print(queue)
max_value = 0
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  i,j = queue.popleft()
  max_value = dist_matrix[i][j]
  #cnt += 1
  if i > 0 and dist_matrix[i-1][j] == -1:
    dist_matrix[i-1][j] = max_value + 1
    queue.append([i-1,j])
  if i < H-1 and dist_matrix[i+1][j] == -1:
    dist_matrix[i+1][j] = max_value + 1
    queue.append([i+1,j])
  if j > 0 and dist_matrix[i][j-1] == -1:
    dist_matrix[i][j-1] = max_value + 1
    queue.append([i,j-1])
  if j < W-1 and dist_matrix[i][j+1] == -1:
    dist_matrix[i][j+1] = max_value + 1
    queue.append([i,j+1])

#print(cnt)
#print(dist_matrix)
print(max_value)

### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
 
H, W = map(int, input().split())
mark_matrix = [[True]*(W+2)]
#mark_matrix.extend([[True]+[False]*(W)+[True] for _ in range(H)])
mark_matrix.extend([[True]+[x!='.' for x in input()] for _ in range(H)])
mark_matrix[H].append(True)
mark_matrix.append([True]*(W+2))
#queue = []
queue = deque()
for i in range(1,H+1):
  for j in range(1,W+1):
    if mark_matrix[i][j]:
      queue.append((i,j))
#  line = input()
#  for j,ch in enumerate(line):
#    if ch == "#":
#      mark_matrix[i+1][j+1] = True
#      queue.append((i+1,j+1))
#for i in range(1,H+1):
#  mark_matrix[i][0] = True
#  mark_matrix[i][W+1] = True
#for j in range(W+2):
#  mark_matrix[0][j] = True
#  mark_matrix[H+1][j] = True
#print(mark_matrix)
 
#cnt = 0
#print(queue)
max_value = 0
while(True):
  #print(len(queue))
  if len(queue) == 0:
    break
  
  new_queue = deque()
  for i,j in queue:
  
    if not mark_matrix[i-1][j]:
      mark_matrix[i-1][j] = True
      #queue.append((i-1,j))
      new_queue.append((i-1,j))
    if not mark_matrix[i+1][j]:
      mark_matrix[i+1][j] = True
      #queue.append((i+1,j))
      new_queue.append((i+1,j))
    if not mark_matrix[i][j-1]:
      mark_matrix[i][j-1] = True
      #queue.append((i,j-1))
      new_queue.append((i,j-1))
    if not mark_matrix[i][j+1]:
      mark_matrix[i][j+1] = True
      #queue.append((i,j+1))
      new_queue.append((i,j+1))
 
  if len(new_queue) == 0:
    break
  else:
    queue = new_queue
    max_value += 1
  
#print(cnt)
#print(dist_matrix)
print(max_value)
### BUGGY CODE ###

from collections import defaultdict
from itertools import product

n = int(input())
if n < 3:
    print(0)
else:
    rt = int(n ** 0.5)
    if n // rt != rt:
        rt = 0
    factors = defaultdict(int)
    N = n
    n_div = 2
    while n > 1:
        while not n % n_div:
            factors[n_div] += 1
            n = n // n_div
        n_div += 1
    lis = [1]
    for k, v in factors.items():
        facts = [k ** i for i in range(v + 1)]
        it = product(lis, facts)
        lis = [a * b for a, b in it]
    nums = [l - 1 for l in lis if l - 1]
    nums = [i for i in nums if (N //i) == (N % i)]
    print(sum(nums))

### FIXED CODE ###

from collections import defaultdict
from itertools import product

n = int(input())
if n < 3:
    print(0)
else:
    rt = int(n ** 0.5)
    factors = defaultdict(int)
    N = n
    n_div = 2
    while n > 1:
        if n_div == int(n ** 0.5) + 2:
            factors[n] += 1
            break
        while not n % n_div:
            factors[n_div] += 1
            n = n // n_div
        n_div += 1
    lis = [1]
    for k, v in factors.items():
        facts = [k ** i for i in range(v + 1)]
        it = product(lis, facts)
        lis = [a * b for a, b in it]
    nums = [l - 1 for l in lis if l - 1]
    nums = [i for i in nums if (N //i) == (N % i)]
    print(sum(nums))
### BUGGY CODE ###

N = int(input())
ans = 0
for i in range(1, N):
    ans += i
print(ans)

### FIXED CODE ###

N = int(input())
print(int(N*(N-1)//2))
### BUGGY CODE ###

N,Y=map(int, input().split())
ichiman=0
gosen=0
sen=0
a=0
for i in range(N+1):
  for j in range(N+1-i):
    for k in range(N+1-i-j):
      if 10000*i+5000*j+1000*k==Y and i+j+k==N:
        a=1
        ichiman=i
        gosen=j
        sen=k
        print(str(i)+' '+str(j)+' '+str(k))
        exit()
    
print('-1 -1 -1')

### FIXED CODE ###

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

for i in range(N+1):
  for j in range(N+1-i):
    if 10000*i+5000*j+1000*(N-i-j)==Y:
      print(str(i)+' '+str(j)+' '+str(N-i-j))
      exit()
        
    
print('-1 -1 -1')
### BUGGY CODE ###

import itertools
import copy

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

com0 = None
while True:
    com = list(itertools.combinations(A,2))
    if com0 == com:
        break
    com0 = copy.copy(com)
    for q in com:
        if q[0] != 0 and q[1] != 0:
            a = 0
            if q[0] > q[1]:
                a = q[0] % q[1]
            else:
                a = q[1] % q[0]
            if a != 0:
                A.add(a)
print(min(A))


### FIXED CODE ###

def gcm(a,b):
    while b != 0:
        a, b = b, a % b
    return a

def gcm_list(a):
    ans = a[0]
    l = len(a)
    for i in range(1, l):
        ans = gcm(ans, a[i])
    return ans

N = int(input())
A = list(map(int, input().split()))
print(gcm_list(A))
### BUGGY CODE ###

while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    a = []
    for i in range(1, n+1):
        for j in range(1, n+1):
            for k in range(1, n+1):
                if i == j == k\
                or i == j\
                or j == k\
                or i ==k:
                    continue
                if i + j + k == x:
                    sort = sorted([i, j, k])
                    if sort not in a:
                        a.append(sort)
    print(len(a))

### FIXED CODE ###

import itertools
while True:
    n, x = map(int, input().split())
    if n == 0\
    and x == 0:
        break

    a = [i for i in range(1, n+1)]
    b = [i for i in itertools.combinations(a, 3)]
    c = 0
    cnt = 0
    for i in range(len(b)):
        for j in range(3):
            c += b[i][j]
        if c == x:
            cnt += 1
        c = 0
    print(cnt)
### BUGGY CODE ###

N = int(input())
A = []
for i in range(N):
  As = list(map(int, input().split()))
  As = list(reversed(list(map(lambda a: a-1, As))))
  A.append(As)
#print(A)
d = 0
n = 0
while True:
  s = set()
  gs = []
  for i in range(N):
    if A[i] == []:
      continue
    j = A[i][-1]
    if i in s or j in s:
      continue
    if A[j] == []:
      continue
    if A[j][-1] == i:
      gs.append((i, j))
      n += 1
      A[i].pop()
      A[j].pop()
      s.add(i)
      s.add(j)
  if gs == []:
    if n == N*(N-1)//2:
      break
    print(-1)
    exit()
  d += 1
print(d)


### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
  As = list(map(int, input().split()))
  As = list(reversed(list(map(lambda a: a-1, As))))
  A.append(As)
#print(A)
d = 0
n = 0
l = list(range(N))
while True:
  n2 = 0
  l2 = []
  s2 = set()
  for i in l:
    if A[i] == []:
      continue
    j = A[i][-1]
    if A[j] == []:
      continue
    if i in s2 or j in s2:
      continue
    if A[j][-1] == i:
      n += 1
      n2 += 1
      s2.add(i)
      s2.add(j)
      l2.append(i)
      l2.append(j)
      A[i].pop()
      A[j].pop()
  if n2 == 0:
    if n == N*(N-1)//2:
      break
    print(-1)
    exit()
  l = l2
  d += 1
print(d)
### BUGGY CODE ###

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

ans_set = set()

def is_triangle(a, b, c):
    if a < b + c and b < c + a and c < a + b:
        return True
    return False

for i, item1 in enumerate(l):
    for j, item2 in enumerate(l):
        for k, item3 in enumerate(l):
            if i == j or j == k or k == i:
                continue
            if is_triangle(item1, item2, item3):
                ans_set.add(frozenset([i, j, k]))

print(len(ans_set))

### FIXED CODE ###

import bisect

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

l.sort()
ans_set = set()
ans = 0

for i in range(n):
    if i + 1 == n:
        break
    for j in range(i+1, n):
        ans += max(bisect.bisect_left(l, l[i]+l[j]) - j-1, 0)

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

from collections import defaultdict

MOD = 10 ** 9 + 7

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

def factorize(n):
    res = []
    d = 2
    while d * d <= n:
        while n % d == 0:
            n //= d
            res.append(d)
        d += 1
    if n > 1:
        res.append(n)
    return res

factors = []
for val in a:
    d = defaultdict(int)
    for factor in factorize(val):
        d[factor] += 1
    factors.append(d)
lcm = defaultdict(int)
for d in factors:
    for num, cnt in d.items():
        lcm[num] = max(lcm[num], cnt)

ret = 0
for i, d in enumerate(factors):
    val = 1
    for num, cnt in lcm.items():
        val *= max(1, num ** (cnt - d[num]))
    ret += val
    ret %= MOD
print(ret)

### FIXED CODE ###

from functools import reduce

MOD = 10 ** 9 + 7

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

def getLcm(a, b):
    return a * b // gcd(a, b)

def lcmArr(a):
    return reduce(getLcm, a)

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

lcm = lcmArr(a)
lcm %= MOD
ret = 0
for val in a:
    ret += lcm * pow(val, MOD - 2, MOD)
    ret %= MOD
print(ret)
### BUGGY CODE ###

num = int(input())
data = input().split(' ')
n = 1
key = 0
while(str(n) in data):
    key = 1
    data = data[data.index(str(n)):]
    n += 1
if(key == 0):
    print(-1)
else:
    print(num - n + 1)


### FIXED CODE ###

num = int(input())
input_data = input().split(' ')
if("1" in input_data):
    input_data = input_data[input_data.index('1'):]
    ref = 1
    for i in range(len(input_data)):
        if(int(input_data[i]) - ref == 1):
            ref += 1

    print(num - ref)
else:
    print('-1')
### BUGGY CODE ###

def make_list(L, R):
    mod_list = list()

    for i in range(L, R):
        for j in range(i + 1, R + 1):
            mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


if __name__ == "__main__":
    main()


### FIXED CODE ###

def make_list(L, R):
    mod_list = list()

    if R - L <= 2019:
        for i in range(L, R):
            for j in range(i + 1, R + 1):
                mod_list.append((i * j) % 2019)
    else:
        for i in range(L, L + 2020):
            for j in range(i + 1, i + 2021):
                mod_list.append((i * j) % 2019)

    return mod_list


def main():
    L, R = map(int, input().split())

    mod_list = make_list(L, R)

    print(min(mod_list))

    return


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

# C - Linear Approximation
# https://beta.atcoder.jp/contests/abc102/tasks/arc100_a

# C_Linear_Approximation.py

# 7
# 1 1 1 1 2 3 4
#import sys

N = int(input())
a = list(map(int, input().strip().split(" ")))

sum = 0
max = a[0]-1
min = a[0]-1
for i in range(N):
    a[i] = a[i] - (i+1)
    sum += a[i]
    if a[i] > max:
        max = a[i]
    if a[i] < min:
        min = a[i]


for b in range(min, max + 1):
    sadness = 0
    for i in range(N):
        if a[i] > b:
            sadness += a[i] - b
        else:
            sadness += b - a[i]
    if b == min:
        min_sadness = sadness
    elif min_sadness > sadness:
        min_sadness = sadness

print(min_sadness)


### FIXED CODE ###

# C - Linear Approximation
# https://beta.atcoder.jp/contests/abc102/tasks/arc100_a

# C_Linear_Approximation.py

# 7
# 1 1 1 1 2 3 4
#import sys

N = int(input())
a = list(map(int, input().strip().split(" ")))

for i in range(N):
    a[i] = a[i] - (i+1)

a.sort()
if N % 2 != 0:
    mid = (N-1)//2
else:
    mid = N // 2 -1
b = a[mid]

sadness_left = b * mid - sum(a[:mid])
sadness = sum(a) - b * N + sadness_left * 2

print(sadness)
### BUGGY CODE ###

import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b, k = map(int, input().split())

    l = [i for i in range(a, b+1)]
    ans = sorted(set(l[:k] + l[-k:]))

    [print(i) for i in ans]


### FIXED CODE ###

import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b, k = map(int, input().split())

    mid = (a + b) // 2

    if a + (k - 1) >= mid:
        [print(i) for i in range(a, b+1)]
    else:
        [print(i) for i in range(a, a+k)]
        [print(i) for i in range(b-(k-1), b+1)]
### BUGGY CODE ###

N=int(input())
a=input().split()
A=[int(number) for number in a]
pluss=[]
minuss=[]
number=1
for a in A:
    plus=a+number
    minus=number-a
    pluss.append(plus)
    minuss.append(minus)
    number+=1
answer=0
suuji=0
for n in pluss:
    answers=minuss[suuji:]
    answer+=answers.count(n)
    suuji+=1


print(answer)



### FIXED CODE ###

import collections
from collections import Counter
N=int(input())
a=input().split()
A=[int(number) for number in a]
pluss=[]
minuss=[]
number=1
for a in A:
    plus=a+number
    minus=number-a
    pluss.append(plus)
    minuss.append(minus)
    number+=1

m=Counter(minuss)

answer=0
for p in pluss:
    if p in m.keys():
        answer+=m[p]
print(answer)
### BUGGY CODE ###

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

H_now = 1
for i in range(K):
    H_now *= A[i]

for j in range(K, N):
    H_next = H_now * A[j] / A[j-K]
    if H_next > H_now:
        print('Yes')
    else:
        print('No')


### FIXED CODE ###

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

for j in range(K, N):
    if A[j] > A[j-K]:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

k,s=map(int,input().split())
ans=0
for i in range(k+1):
  for j in range(i,k+1):
    for l in range(j,k+1):
      if i+j+l==s:
        if i==j and j==l:
          ans+=1
        elif i==j or j==l or l==i:
          ans+=3
        else:
          ans+=6
print(ans)


### FIXED CODE ###

k,s=map(int,input().split())
ans=0
if s<=k:
  print((s+1)*(s+2)//2)
  exit()
for i in range(k+1):
  for j in range(k+1):
    if 0<=s-i-j<=k:
      ans+=1
print(ans)
### BUGGY CODE ###

n = int(input())
a = [int(input()) for _ in range(n)]

paper = []
for i in a:
    if i in paper:
        paper.remove(i)
    else:
        paper.append(i)
print(len(paper))

### FIXED CODE ###

from collections import Counter

n = int(input())
a = [int(input()) for _ in range(n)]

a_c = Counter(a).most_common() 
ans = 0
for i in a_c: 
    if i[1] % 2 == 1:
        ans += 1
print(ans)
### BUGGY CODE ###

from collections import deque
import numpy as np

num_r,num_c = list(map(int,input().split()))
field = [list(input()) for i in range(num_r)]
q_r = deque([])
q_c = deque([])
seen = np.zeros((num_r,num_c))
step_r = [1,0,-1,0]
step_c = [0,1,0,-1]

for i in range(num_r):
  for j in range(num_c):
    if field[i][j] == "#":
      q_r.append(i)
      q_c.append(j)
      g_r = 0
      g_c = 0

while q_r:
  r = q_r.popleft()
  c = q_c.popleft()

  for i in range(4):
    next_r = r + step_r[i]
    next_c = c + step_c[i]
    
    if (next_r<0) or (num_r<=next_r) or (next_c<0) or (num_c<=next_c) or (field[next_r][next_c] == "#"):
      continue
    
    field[next_r][next_c] = "#"
    q_r.append(next_r)
    q_c.append(next_c)
    seen[next_r][next_c] = seen[r][c] + 1
#    print(seen[next_r][next_c],next_r,next_c)
    g_r = next_r
    g_c = next_c

print(int(seen[g_r][g_c]))

### FIXED CODE ###

def main():
    h,w = map(int,input().split())
    a = []
    for i in range(h):
        a.append(input())

    used = [True]*(h*w)

    p = []
    for i in range(h):
        for j in range(w):
            if a[i][j] == '#':
                p.append(i*w+j)
                used[i*w+j] = False


    
    res = 0
    while p:
        tank = []
        for e in p:
            if e>w-1 and used[e-w]:
                tank.append(e-w)
                used[e-w] = False
            if e%w > 0 and used[e-1]:
                tank.append(e-1)
                used[e-1] = False
            if e<(h-1)*w and used[e+w]:
                tank.append(e+w)
                used[e+w] = False
            if e%w<w-1 and used[e+1]:
                tank.append(e+1)
                used[e+1] =  False
        p = tank
        res += 1
    print(res-1)

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

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
 
n = int(input())
league=[list(map(int, input().split()))[::-1] for _ in range(n)]

total_match=n*(n-1)//2
match=0
day=0


for _ in range(total_match):
    day+=1
    today_match=[]

    for i in range(n):
        try:
            m=league[i][-1]-1
            if not i in today_match and not m in today_match:
                if league[m][-1]-1==i:
                    today_match.extend((i,m))
                    league[i].pop()
                    league[m].pop()
        except:
            continue
    if not today_match:
        day=-1
        break
    match+=len(today_match)//2
    if match>=total_match:
        break

print(day)

### FIXED CODE ###

import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 7)

N = int(input())
pair = N * (N - 1) // 2
ptoi = dict()

i = 0
for x in range(1, N):
    for y in range(x + 1, N + 1):
        ptoi[(x, y)] = i
        ptoi[(y, x)] = i
        i += 1

edge = [[] for _ in range(pair)]
indeg = [0] * pair
for i in range(1, N+1):
    inp = list(map(int, input().split()))
    for s, t in zip(inp[:-1], inp[1:]):
        edge[ptoi[(i, s)]].append(ptoi[(i, t)])
        indeg[ptoi[(i, t)]] += 1


now = [i for i, d in enumerate(indeg) if d == 0]
day = 0
while now:
    nxt = []
    while now:
        s = now.pop()
        for t in edge[s]:
            if indeg[t] <= 0:
                continue
            indeg[t] -= 1
            if indeg[t] == 0:
                nxt.append(t)
    day += 1
    now = nxt

if all(i <= 0 for i in indeg):
    print(day)
else:
    print(-1)
### BUGGY CODE ###

from collections import defaultdict, Counter

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

d = defaultdict(int)

all = 0
for i, a in enumerate(A):
    # i=1;val=A[i]
    cnt = Counter(A[i + 1:])
    all += cnt[a]

val_cnt = Counter(A)
for a in A:
    # a=1
    print(all - (val_cnt[a] - 1))


### FIXED CODE ###

from collections import defaultdict, Counter

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

d = defaultdict(int)
for a in A:
    d[a] += 1

all = 0
for val in d.values():
    all += val * (val - 1) / 2

all = int(all)
val_cnt = Counter(A)
for a in A:
    print(all - (val_cnt[a] - 1))
### BUGGY CODE ###

N,X,Y = map(int,input().split())
for k in range(1,N):
    S = 0
    for i in range(1,N):
        for j in range(i+1,N+1):
            if j-i <= abs(X-i)+abs(Y-j)+1:
                if j-i == k:
                    S += 1
            else:
                if abs(X-i)+abs(Y-j)+1 == k:
                    S += 1
    print(S)

### FIXED CODE ###

N,X,Y = map(int,input().split())
A = [0 for i in range(N)]
for i in range(N-1):
    a = i+1
    for j in range(i+1,N):
        b = j+1
        A[min([b-a,abs(X-a)+abs(Y-b)+1])] += 1
for i in range(1,N):
    print(A[i])