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

from collections import deque


N, M = map(int, input().split())
ab_list = [ list(map(int, input().split())) for i in range(N)]

score_list = [[] for i in range(M+1)]


for ab in ab_list:
    if ab[0] <= M:
        score_list[ab[0]].append(ab[1])

scores = [deque() for i in range(M+1)]
for i in range(len(score_list)):
    scores[i] = deque(sorted(score_list[i], reverse=True))

ans = 0
for i in range(0, M+1):

    max_idx = -1
    max_n = -1
    for j in range(i+1):
        if len(scores[j]) == 0:
          continue
        if max_n < scores[j][0]:
            max_n = scores[j][0]
            max_idx = j

    if max_idx > 0:
        ans += scores[max_idx].popleft()

print(ans)

### FIXED CODE ###

import heapq


N, M = map(int, input().split())
ab_list = [ list(map(int, input().split())) for i in range(N)]

score_list = [[] for i in range(M+1)]


for ab in ab_list:
    if ab[0] <= M:
        score_list[ab[0]].append(ab[1])


ans = 0
candidates = []

for i in range(0, M+1):

    for s in score_list[i]:
        heapq.heappush(candidates, -s)
    if len(candidates) == 0:
        continue
    ans -= heapq.heappop(candidates)


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

import sys
input = sys.stdin.readline


def pack(C):
    bitmask = 0
    for c in C:
        d = 1 << (c-1)
        bitmask |= d
    return bitmask


def read():
    N, M = list(map(int, input().strip().split()))
    A = list()
    C = list()
    for i in range(M):
        a, b = list(map(int, input().strip().split()))
        A.append(a)
        c = map(int, input().strip().split())
        C.append(pack(c))
    return N, M, A, C


def solve(N, M, A, C, INF=10**9):
    # dp[state][i]: i本の鍵[0, i)を使って状態stateにするための最小コスト
    n_states = 1 << N
    end_state = n_states - 1
    dp = [[INF for j in range(2)] for state in range(n_states)]
    dp[0][0] = 0
    dp[0][1] = 0

    for j in range(M):
        m0 = j & 1
        m1 = 1 - m0
        for state in range(n_states):
            next_state = state | C[j]
            dp[state][m1] = min(dp[state][m1], dp[state][m0])
            if next_state > state:
                dp[next_state][m1] = min(dp[next_state][m1], dp[state][m0] + A[j])
    
    m0 = M & 1
    return dp[end_state][m0] if dp[end_state][m0] != INF else -1


if __name__ == "__main__":
    inputs = read()
    print("%s" % solve(*inputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline


def pack(C):
    bitmask = 0
    for c in C:
        d = 1 << (c-1)
        bitmask |= d
    return bitmask


def read():
    N, M = list(map(int, input().strip().split()))
    A = list()
    C = list()
    for i in range(M):
        a, b = list(map(int, input().strip().split()))
        A.append(a)
        c = map(int, input().strip().split())
        C.append(pack(c))
    return N, M, A, C


def solve(N, M, A, C, INF=10**9):
    # dp[state][i]: i本の鍵[0, i)を使って状態stateにするための最小コスト
    n_states = 1 << N
    end_state = n_states - 1
    dp = [[INF for j in range(2)] for state in range(n_states)]
    dp[0][0] = 0
    dp[0][1] = 0

    for j in range(M):
        m0 = j & 1
        m1 = 1 - m0
        for state in range(n_states):
            next_state = state | C[j]
            dp[state][m1] = min(dp[state][m1], dp[state][m0])
            if next_state > state:
                dp[next_state][m1] = min(dp[next_state][m1], dp[state][m0] + A[j])
    
    m0 = M & 1
    return dp[end_state][m0] if dp[end_state][m0] != INF else -1


if __name__ == "__main__":
    inputs = read()
    print("%s" % solve(*inputs))
### BUGGY CODE ###

A = list(input())
N = len(A)
uq_list = []

count = 1
for i in range(0, N):
    tempstr = A[i]
    for j in range(i+1, N):
        if A[j] != tempstr:
            count += 1

print(count)


### FIXED CODE ###

from collections import Counter
A = input()
N = len(A)
counter = Counter(A)
count = 1


for i in range(0, len(A)):
    counter[A[i]] -= 1
    count += (len(A[(i+1):N]) - counter[A[i]])

print(count)
### BUGGY CODE ###

n = int(input())
p = list(map(float,input().split()))
dp = [[0 for x in range(n+1)] for x in range(n+1)]
dp[0][0] = 1
for y in range(n):
    for x in range(n):
        dp[y+1][x] += dp[y][x]*(1-p[y])
        dp[y+1][x+1] += dp[y][x]*p[y]
print(sum(dp[n][n//2+1:n+1]))


### FIXED CODE ###

n = int(input())
p = list(map(float,input().split()))
dp = [[0 for x in range(n+1)] for x in range(n+1)]
dp[0][0] = 1
for y in range(n):
    for x in range(n):
        dp[y+1][x] += dp[y][x]*(1-p[y])
        dp[y+1][x+1] += dp[y][x]*p[y]
print(sum(dp[n][n//2+1:n+1]))
### BUGGY CODE ###

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

MOD = 10 ** 9 + 7

b = [0] * 60
for x in a:
    for i, temp in enumerate(list(map(int, reversed(bin(x)[2:])))):
        b[i] += temp

ans = 0
d = 1
for x in b:
    ans = (ans + ((x * (n-x)) % MOD) * d) % MOD
    d = d * 2 % MOD

print(ans)


### FIXED CODE ###

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

MOD = 10 ** 9 + 7

ans = 0
d = 1
for _ in range(60):
    x = 0
    for i in range(n):
        x += a[i] % 2
        a[i] //= 2
    ans = (((x * (n-x)) % MOD) * d % MOD + ans) % MOD
    d = d * 2 % MOD

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

str_len = int(input().rstrip())
str = input().rstrip()

rgb_nums_dict = {'R':str.count('R'), 'G':str.count('G'), 'B':str.count('B')}
total = 0
for i in range(str_len-2):
    for j in range(i+1,str_len-1):
        first_str = str[i]
        second_str = str[j]
        if first_str==second_str:
            continue
        else:
            if 2*j-i<str_len and second_str!=str[2*j-i]!=first_str:
                total-=1
                


for i in range(str_len):
    first_str = str[i]
    if first_str=='R':
        total += rgb_nums_dict['G']*rgb_nums_dict['B']
        
    elif first_str=='G':
        total += rgb_nums_dict['R']*rgb_nums_dict['B']
        
    else:#'B'
        total += rgb_nums_dict['R']*rgb_nums_dict['G']
        
    rgb_nums_dict[first_str]-=1
    if rgb_nums_dict[first_str]==0:
        break
    
print(total)


### FIXED CODE ###

str_len = int(input().rstrip())
str = input().rstrip()

rgb_nums_dict = {'R':str.count('R'), 'G':str.count('G'), 'B':str.count('B')}
total = 0
for i in range(str_len-2):
    for j in range(i+1,str_len-1):
        first_str = str[i]
        second_str = str[j]
        if first_str==second_str:
            continue
        else:
            if 2*j-i<str_len and second_str!=str[2*j-i]!=first_str:
                total-=1
                


for i in range(str_len):
    first_str = str[i]
    if first_str=='R':
        total += rgb_nums_dict['G']*rgb_nums_dict['B']
        
    elif first_str=='G':
        total += rgb_nums_dict['R']*rgb_nums_dict['B']
        
    else:#'B'
        total += rgb_nums_dict['R']*rgb_nums_dict['G']
        
    rgb_nums_dict[first_str]-=1
    if rgb_nums_dict[first_str]==0:
        break
    
print(total)
### BUGGY CODE ###

from collections import defaultdict


def dfs_list(start, adjacency_list):
    unvisited = [start]
    visited = []

    while len(unvisited) > 0:
        cv = unvisited.pop()
        visited.append(cv)
        for nv in adjacency_list[cv]:
            if nv in visited:
                continue
            if nv in unvisited:
                continue
            unvisited.append(nv)

    return visited


N, M, K = map(int, input().split(' '))
deg = defaultdict(list)
to = defaultdict(list)

for _ in range(M):
    a, b = map(int, input().split(' '))
    a -= 1
    b -= 1
    deg[a].append(b)
    deg[b].append(a)

for _ in range(K):
    c, d = map(int, input().split(' '))
    c -= 1
    d -= 1
    to[c].append(d)
    to[d].append(c)


for i in range(N):
    group = dfs_list(i, deg)
    ans = len(group) - 1 - len(deg[i])
    for u in to[i]:
        if u in group:
            ans -= 1
    print(ans, end=' ' if i != (N - 1) else '\n')


### FIXED CODE ###

from collections import defaultdict


class UnionFind:
    def __init__(self, n=0):
        self.d = {i: -1 for i in range(n)}

    def find(self, x):
        if self.d[x] < 0:
            return x
        else:
            self.d[x] = self.find(self.d[x])
            return self.d[x]

    def unite(self, x, y):
        x, y = self.find(x), self.find(y)
        if (x == y):
            return False
        if (self.d[x] > self.d[y]):
            x, y = y, x
        self.d[x] += self.d[y]
        self.d[y] = x
        return True

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

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


N, M, K = map(int, input().split(' '))
deg = defaultdict(int)
to = defaultdict(list)
uf = UnionFind(N)

for _ in range(M):
    a, b = map(int, input().split(' '))
    a -= 1
    b -= 1
    deg[a] += 1
    deg[b] += 1
    uf.unite(a, b)

for _ in range(K):
    c, d = map(int, input().split(' '))
    c -= 1
    d -= 1
    to[c].append(d)
    to[d].append(c)

for i in range(N):
    ans = uf.size(i) - 1 - deg[i]
    for u in to[i]:
        if uf.same(i, u):
            ans -= 1
    print(ans, end=' ' if i != (N - 1) else '\n')
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
l=[0 for i in range(10**6+1)]
for i in range(n):
  l[a[i]]+=1
ans2=[-1 for i in range(10**6+1)]
ans=0
for i in range(n):
  x=a[i]
  if ans2[x]==-1:
    if l[a[i]]==1:
      flag=1
      for j in range(1,int(x**0.5)+2):
        if x%j==0:
          if x!=j and l[j]>0:
            flag=0
            break
          if x!=x//j and x%(x//j)==0 and l[x//j]>0:
            flag=0
            break
      if flag==1:
        ans+=1
        ans2[x]=1
      else:
        ans2[x]=0
  else:
    ans+=ans2[x]
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
if n!=1 and len(set(a))==1:
  print(0)
  exit()
l=[0 for i in range(10**6+1)]
for i in range(n):
  l[a[i]]+=1
if n!=1 and min(a)>max(a)/2:
  ct=0
  for i in range(len(l)):
    if l[i]==1:
      ct+=1
  print(ct)
  exit()
d={}
ans=0
for i in range(n):
  x=a[i]
  if x not in d:
    if l[a[i]]==1:
      flag=1
      for j in range(1,int(x**0.5)+2):
        if x%j==0:
          if x!=j and l[j]>0:
            flag=0
            break
          if x!=x//j and x%(x//j)==0 and l[x//j]>0:
            flag=0
            break
      if flag==1:
        ans+=1
        d[x]=1
      else:
        d[x]=0
  else:
    ans+=d[x]
print(ans)
### BUGGY CODE ###

from sys import stdin
#import numpy as np

readline = input

N, Q = map(int, readline().split()) 
C = list(map(int, readline().split())) 
S = [list(map(int, readline().split())) for _ in range(Q)] 
#print(S)
def main(N, Q, C, S):    
  # Binary Indexed Tree 
  # https://juppy.hatenablog.com/entry/2018/11/17/%E8%9F%BB%E6%9C%AC_python_Binary_Indexed_Tree_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0
  b = [0 for _ in range(N+1)]
  def BIT_query(idx): #idxまでの和(1からスタート)
    res_sum = 0
    while idx > 0:
      res_sum += b[idx]
      idx -= idx&(-idx) #一番下の位を減らす（例：13=1011 → 1010 → 1000） 
    return res_sum
  def BIT_update(idx,x): #idxをx増やした時
    while idx <= N:
      b[idx] += x
      idx += idx&(-idx) #一番下の位を繰り上げる（例：13=1011 → 1100 → 10000 ※N=16のとき） 
    return

  loc = [0 for _ in range(N)] #各種類の玉のうちの最右端の所在地
  S = [(S[i], i) for i in range(Q)] #クエリ
  S.sort(key = lambda s: s[0][1]) #区間の右端でソート
  #S = np.array(S, dtype = np.int64)
  #print(S)
  ans = [0 for _ in range(Q)]
  k = 0
  for j in range(N):
    if loc[C[j]-1] > 0: #玉の更新
      BIT_update(loc[C[j]-1], -1)
    loc[C[j]-1] = j+1
    BIT_update(j+1, 1)  
    
    if S[k][0][1] == j+1:
      t = BIT_query(j+1)
    while k < len(S) and S[k][0][1] == j+1: #クエリへの返答
      ans[S[k][1]] = t - BIT_query(S[k][0][0]-1)
      k += 1
    if k == len(S):
      break
  return ans

ans = main(N, Q, C, S)
print(*ans, sep='\n')

### FIXED CODE ###

from sys import stdin
#import numpy as np

readline = stdin.readline

N, Q = map(int, readline().split()) 
C = list(map(int, readline().split())) 
S = [list(map(int, readline().split())) for _ in range(Q)] 
#print(S)
def main(N, Q, C, S):    
  # Binary Indexed Tree 
  # https://juppy.hatenablog.com/entry/2018/11/17/%E8%9F%BB%E6%9C%AC_python_Binary_Indexed_Tree_%E7%AB%B6%E6%8A%80%E3%83%97%E3%83%AD%E3%82%B0%E3%83%A9%E3%83%9F%E3%83%B3%E3%82%B0
  b = [0 for _ in range(N+1)]
  def BIT_query(idx): #idxまでの和(1からスタート)
    res_sum = 0
    while idx > 0:
      res_sum += b[idx]
      idx -= idx&(-idx) #一番下の位を減らす（例：13=1011 → 1010 → 1000） 
    return res_sum
  def BIT_update(idx,x): #idxをx増やした時
    while idx <= N:
      b[idx] += x
      idx += idx&(-idx) #一番下の位を繰り上げる（例：13=1011 → 1100 → 10000 ※N=16のとき） 
    return

  loc = [0 for _ in range(N)] #各種類の玉のうちの最右端の所在地
  S = [(S[i], i) for i in range(Q)] #クエリ
  S.sort(key = lambda s: s[0][1]) #区間の右端でソート
  #S = np.array(S, dtype = np.int64)
  #print(S)
  ans = [0 for _ in range(Q)]
  k = 0
  for j in range(N):
    if loc[C[j]-1] > 0: #玉の更新
      BIT_update(loc[C[j]-1], -1)
    loc[C[j]-1] = j+1
    BIT_update(j+1, 1)  
    
    if S[k][0][1] == j+1:
      t = BIT_query(j+1)
    while k < len(S) and S[k][0][1] == j+1: #クエリへの返答
      ans[S[k][1]] = t - BIT_query(S[k][0][0]-1)
      k += 1
    if k == len(S):
      break
  return ans

ans = main(N, Q, C, S)
print(*ans, sep='\n')
### BUGGY CODE ###

import sys

num_list = int(sys.stdin.readline())
lines = sys.stdin.readlines()
nums = map(int, lines)

max_diff = -sys.maxint -1
for i in range(num_list) :
    for j in range(i+1, num_list) :
        diff = nums[j] - nums[i]
        if diff > max_diff :
            max_diff = diff

print max_diff

### FIXED CODE ###

import sys

num_list = int(sys.stdin.readline())
lines = sys.stdin.readlines()
nums = map(int, lines)

max_diff = -sys.maxint - 1
min_val = nums.pop(0)
for num in nums :
    diff = num - min_val
    if diff > max_diff :
        max_diff = diff
    if num < min_val :
        min_val = num

print max_diff
### BUGGY CODE ###

import math
def bicomb(n):
    return math.factorial(n) // (math.factorial(n - 2) * math.factorial(2))

from collections import Counter
cnt = Counter()
    
N = int(input())
A = list(map(int,input().split()))
for i in range(N):
    cnt[A[i]] += 1
ans = 0
for v in cnt.values():
    if v==1:
        continue
    else:
        ans += bicomb(v)
ans2 = ans
for i in A:
    if cnt[i]==1:
        pass
    elif cnt[i]==2:
        ans -= 1
    else:
        ans -= bicomb(cnt[i]) - bicomb(cnt[i]-1)
    print(ans)
    ans = ans2

### FIXED CODE ###

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

from collections import Counter
cnt = Counter(A)

ans = 0
for v in cnt.values():
    ans += v*(v-1)//2

for a in A:
    k = cnt[a]
    print(ans - (k*(k-1)//2) + (k-1)*(k-2)//2)
### BUGGY CODE ###

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

if K == 0:
    a = sum([[i, i] for i in range(2 ** M)], [])

elif 2 <= M and K < 2 ** M:
    a  = [K] + [i for i in range(2 ** M - 1, -1, -1) if i != K]
    a += [K] + [i for i in range(2 ** M) if i != K]

else:
    a = [-1]

print(' '.join(map(str, a)))


### FIXED CODE ###

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

if K == 0:
    a  = [i for i in range(2 ** M - 1, -1, -1)]
    a += [i for i in range(2 ** M)]
elif 2 <= M and K < 2 ** M:
    a  = [K] + [i for i in range(2 ** M - 1, -1, -1) if i != K]
    a += [K] + [i for i in range(2 ** M) if i != K]

else:
    a = [-1]

print(' '.join(map(str, a)))
### BUGGY CODE ###

def resolve():
    N, K = list(map(int, input().split()))
    h = [int(input()) for _ in range(N)]
    ans = 10 ** 18
    h.sort()

    for i in range(N - K + 1):
        res = h[i:K + i]
        ans = min(ans, res[-1] - res[0])
    print(ans)
    return


resolve()

### FIXED CODE ###

def resolve():
    N, K = list(map(int, input().split()))
    h = [int(input()) for _ in range(N)]
    ans = 10 ** 10
    h.sort()

    for i in range(N - K + 1):
        res = h[i+K-1] - h[i]
        ans = min(ans, res)
    print(ans)
    return


resolve()
### BUGGY CODE ###

MOD = int(1e9 + 7)
n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(62):
    cnt = 0
    for a in A:
        if a & 1<<i:
            cnt += 1
    ans += (1<<i % MOD) * cnt * (n - cnt) % MOD
print(ans % MOD)


### FIXED CODE ###

MOD = int(1e9 + 7)
n = int(input())
A = list(map(int, input().split()))
ans = 0
for i in range(62):
    cnt = 0
    for a in A:
        if a & 1<<i:
            cnt += 1
    ans += (1<<i % MOD) * cnt % MOD * (n - cnt) % MOD
print(ans % MOD)
### BUGGY CODE ###

N, K = map(int, input().split())
h = list(map(int, input().split())) #1-index

dp = [float('inf')]*(N)

def chmin(a,b):
    if a >= b:
        return b
    else:
        return a

dp[0] = 0
for i in range(1,N):
    dp[i] = chmin(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    
    for k in range(2, K+1):
        if i - k >= 0:
            dp[i] = chmin(dp[i], dp[i-k] + abs(h[i] - h[i-k]))
    
print(dp[N-1])

### FIXED CODE ###

import math

N, K = map(int, input().split())
h = list(map(int, input().split()))
dp = [float('INF')] * (10**5 + 10)

def chmin(a, b):
    if a >= b:
        return b
    else:
        return a

dp[0] = 0 #初期値 = 0
for i in range(N-1):
    for j in range(K+1):
        if i+j < N:
            dp[i+j] = chmin(dp[i+j], dp[i] + abs(h[i] - h[i+j]))
print(dp[N-1])
### BUGGY CODE ###

n,m,k=map(int,input().split())
par=[-1]*n

# this par & rank are initialized lists
def find(x):
    global par
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
        
def unite(x,y):
    x,y=find(x),find(y)
    global par
    if x==y:return False
    else:
        if par[x]>par[y]:x,y=y,x
        par[x]+=par[y]
        par[y]=x
        return True

def size(x):
    return -par[find(x)]
def same(x,y):
    return find(x)==find(y)
from sys import stdin 
input=stdin.readline
friend=[set() for i in range(n)]
for i in range(m):
    a,s=map(int,input().split())
    a-=1;s-=1
    unite(a,s)
    friend[a].add(s)
    friend[s].add(a)
anti=[set() for i in range(n)]
for i in range(k):
    a,b=map(int,input().split())
    a-=1;b-=1
    anti[a].add(b)
    anti[b].add(a)
friends=[set() for i in range(n)]
for i in range(n):
    friends[find(i)].add(i)

print(*[len(friends[find(i)]-(anti[i]|friend[i]|{i})) for i in range(n)],sep=" ")


### FIXED CODE ###

n,m,k=map(int,input().split())
par=[-1]*n

# this par & rank are initialized lists
def find(x):
    global par
    if par[x]<0:
        return x
    else:
        par[x]=find(par[x])
        return par[x]
        
def unite(x,y):
    x,y=find(x),find(y)
    global par
    if x==y:return False
    else:
        if par[x]>par[y]:x,y=y,x
        par[x]+=par[y]
        par[y]=x
        return True

def size(x):
    return -par[find(x)]
def same(x,y):
    return find(x)==find(y)
from sys import stdin 
input=stdin.readline
friend=[0]*n
for i in range(m):
    a,s=map(int,input().split())
    a-=1;s-=1
    unite(a,s)
    friend[a]+=1
    friend[s]+=1
anti=[set() for i in range(n)]
for i in range(k):
    a,b=map(int,input().split())
    a-=1;b-=1
    anti[a].add(b)
    anti[b].add(a)

print(*[size(i)-1-sum(same(i,b) for b in anti[i])-friend[i] for i in range(n)],sep=" ")
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

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

import queue
# FIFOキューの作成
q = queue.Queue()

dst = [[10**18 for i in range(n+1)] for j in range(n+1)]

kyori = [0] * (n+1)

for i in range(n):
    dst[i+1][i+1] = 0

#num = 1

for i in range(1,n):
    #num = 1
    q.put([i,0])
    while not q.empty():
        
        kari = q.get()
        tmp = kari[0]
        tmp_dst = kari[1]
        #print(tmp[0])
        #exit()
        if tmp >= n+1:
            continue
        if tmp < 1:
            continue
        if tmp == x:
            if dst[i][y] == 10**18:
                #kyori[tmp_dst+1] += 1
                dst[i][y] = tmp_dst+1
                q.put([y,tmp_dst+1])
                
        if tmp == y:
            if dst[i][x] == 10**18:
                #kyori[tmp_dst+1] += 1
                dst[i][x] = tmp_dst+1
                q.put([x,tmp_dst+1])
        if tmp+1 <= n:
            if dst[i][tmp+1] == 10**18:
                q.put([tmp+1,tmp_dst+1])
                #kyori[tmp_dst+1] += 1
                dst[i][tmp+1] = tmp_dst+1
        if tmp-1 >= 1:
            if dst[i][tmp-1] == 10**18:
                q.put([tmp-1,tmp_dst+1])
                #kyori[tmp_dst+1] += 1
                dst[i][tmp-1] = tmp_dst+1
        
        #num += 1
        #print(dst[i])
    #exit()
    #print(dst[i])
    for j in range(i+1,n+1):
        kyori[dst[i][j]] += 1
"""
#print(kyori)
print(dst)
exit()

kyori = [0] * (n+1)

for i in range(1,n):
    #print(dst[i],i)
    for j in range(i+1,n+1):
        #print(i,j,dst[i][j])
        kyori[dst[i][j]] += 1
"""
#print(kyori)
#exit()

for i in range(1,n):
    print(kyori[i])

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

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

dst = [0] * n

#print(dst)

for i in range(1,n+1):
    for j in range(i+1,n+1):
        kyori = min(j-i,abs(x-i)+abs(y-j)+1)
        dst[kyori] += 1
        #print(i,j,kyori)
        
for i in range(n-1):
    print(dst[i+1])
#print(dst)
### BUGGY CODE ###

a, op, b = (input().split())

a = int(a)
b = int(b)
while True:
    if op == "+":
        print(a +b)
    elif op == "-":
        print(a - b)
    elif op == "*":
        print(a * b)
    elif op == "/":
        print(a / b)
    else:
        break

### FIXED CODE ###

while True:
    a, op, b = (input().split())
    x = int(a)
    y = int(b)
    if op == "?":
        break
    elif op == "-":
        print(x - y)
    elif op == "+":
        print(x + y)
    elif op =="*":
        print (x * y)
    elif op == "/":
        print (x // y)
### BUGGY CODE ###

from fractions import gcd
from functools import reduce 
def lcm_base(x, y):
  return(x * y) // gcd(x, y)
def lcm_list(numbers):
  return reduce(lcm_base, numbers, 1)

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

mod = 10**9 + 7
min = lcm_list(a)
sum = 0
for i in range(n):
  sum = sum + (min//a[i])%mod 
  
print(sum%mod)



### FIXED CODE ###

from fractions import gcd
from functools import reduce
     
mod = 10 ** 9 + 7
     
def lcm_base(x, y):
    return (x * y) // gcd(x, y)
     
def lcm(numbers):
    return reduce(lcm_base, numbers, 1)
     
    # print('input >>')
N = int(input())
A = list(map(int,(input().split())))
     
lcmn = lcm(A)
    
ans = 0
for i in range(len(A)):
    ans += lcmn // A[i]
     
    # print('-----output-----')
print(int(ans%mod))
### BUGGY CODE ###

def main():
    N = int(input())
    S = input().rstrip()
    u = len(set(list(S)))
    first = set()
    tmp = set()
    ans = 0
    for index, i in enumerate(range(N - 2)):
        if i in first:
            continue
        first.add(i)
        for j in range(index+1, N-1):
            if S[i] + S[j] not in tmp:
                tmp.add(S[i] + S[j])
                ans += len(set(list(S[j + 1:])))
                if len(tmp) == u ** 2:
                    print(ans)
                    quit()
    print(ans)


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
# sys.setrecursionlimit(100000)


def main():
    N = int(input())
    S = input().rstrip()
    ans = 0
    for i in range(1000):
        i = str(i).zfill(3)
        prev = -1
        for s in i:
            pos = S.find(s, prev + 1)
            if pos > prev:
                prev = pos
            else:
                break
        else:
            ans += 1
    print(ans)


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

b = input()
l = list(map(int, input().split()))
plus = 0
a = len(l)-1
for i in range (a):
	if l.count(l[i])>1:
		plus += 1
        
if plus > 0:
  	print('NO')
else:
	print('YES')

### FIXED CODE ###

b = input()
l = list(map(int, input().split()))
ldistinct = set(l)

if len(ldistinct) < len(l):
	print('NO')
else:
	print('YES')