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

n, d, a = map(int, input().split())
XH = []
for i in range(n):
    x, h = map(int, input().split())
    XH.append((x, h))

XH.sort()
from collections import deque
q = deque()

ans = 0
import copy
for x, h in XH:
    nq = deque()
    while q:
        r, s = q.popleft()
        if r+d < x:
            continue
        else:
            h -= s
            nq.append((r, s))
    #print(x, h)
    if h > 0:
        if h%a == 0:
            b = h//a
            ans += b
            nq.append((x+d, a*b))
        else:
            b = h//a+1
            ans += b
            nq.append((x+d, a*b))
    q = copy.copy(nq)
    #print(q)
    #print(ans)
print(ans)


### FIXED CODE ###

n, d, a = map(int, input().split())
l = [[0, 0] for _ in range(n)]
for i in range(n):
  x, h = map(int, input().split())
  l[i][0] = x
  l[i][1] = h
  
l.sort()
from collections import deque
d = 2*d
q = deque([])
total = 0

ans = 0
for i in range(n):
  x = l[i][0]
  h = l[i][1]
  if q:
    while q[0][0] < x:
      total -= q[0][1]
      q.popleft()
      if not q:
        break
  h -= total
  if h > 0:
    num = (h+a-1)//a
    ans += num
    damage = num*a
    total += damage
    q.append([x+d, damage])

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

k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x + y + z == s:
                count += 1
print(count)

### FIXED CODE ###

k, s = map(int, input().split())
count = 0
for x in range(k+1):
    for y in range(k+1):
        z = s - x - y
        if 0 <= z <= k:
            count += 1
print(count)
### BUGGY CODE ###

S = input()
count = 0
for i in range(len(S)):
    for j in range(i+4,len(S)+1):
        if int(S[i:j]) % 2019 == 0:
            count += 1

print(count)

### FIXED CODE ###

S = input()
MOD =2019
count = [0]*MOD
r = 0
t = 1
for i in reversed(S):
    r += int(i) * t
    r %= MOD
    t *= 10
    t %= MOD
    count[r] += 1

count[0] += 1
print(int(sum(i*(i-1)/2 for i in count)))
### BUGGY CODE ###

def prime_factors(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            while temp%i == 0:
                temp //= i
            arr.append(i)

    if temp != 1:
        arr.append(temp)

    return arr

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

nums = [0]*(max(A)+1)

for a in A:
    for x in prime_factors(a):
        nums[x] += 1

y = max(nums)

if y < 2:
    print('pairwise coprime')
elif y < N:
    print('setwise coprime')
else:
    print('not coprime')

### FIXED CODE ###

from collections import defaultdict

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

Ones = A.count(1)
R = max(A)
nums = [0]*(R+1)

# 素因数テーブルの作成
D = [0]*(R+1)
for i in range(2, R+1):
    if D[i]:
        continue
    n = i
    while n < R+1:
        if D[n] == 0:
            D[n] = i
        n += i

# 素因子をカウント
for a in A:
    tmp = a
    while tmp > 1:
        prime_factor = D[tmp]
        nums[prime_factor] += 1
        while tmp%prime_factor == 0:
            tmp //= prime_factor
y = max(nums)
if y < 2:
    print('pairwise coprime')
elif y-Ones < N:
    print('setwise coprime')
else:
    print('not coprime')
### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


def bellman_ford(s, n):
    d = [inf]*n # 各頂点への最小コスト
    d[s] = 0 # 自身への距離は0
    for i in range(n):
        update = False # 更新が行われたか
        for x, y, z in g:
            if d[y] > d[x] + z:
                d[y] = d[x] + z
                update = True
        if not update:
            break
        # 負閉路が存在
        if i == n - 1:
            return -1
    return d

N = ni()
g = []
for _ in range(N-1):
    a, b, c = na()
    g.append([a-1, b-1, c])
    g.append([b-1, a-1, c])

Q, K = na()
ans = []
d = bellman_ford(K-1, N)
for i in range(Q):
    x, y = na()
    x -= 1
    y -= 1
    ans.append(d[x] + d[y])
for i in range(Q):
    print(ans[i])



### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time, copy,bisect
from operator import itemgetter
from heapq import heappush, heappop

sys.setrecursionlimit(10**7)
inf = 10**20
mod = 10**9 + 7

stdin = sys.stdin

ni = lambda: int(ns())
nf = lambda: float(ns())
na = lambda: list(map(int, stdin.readline().split()))
nb = lambda: list(map(float, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces


def dijkstra(s, n): # (始点, ノード数)
    dist = [inf] * n
    hq = [(0, s)] # (distance, node)
    dist[s] = 0
    seen = [False] * n # ノードが確定済みかどうか
    while hq:
        v = heappop(hq)[1] # ノードを pop する
        seen[v] = True
        for to, cost in adj[v]: # ノード v に隣接しているノードに対して
            if seen[to] == False and dist[v] + cost < dist[to]:
                dist[to] = dist[v] + cost
                heappush(hq, (dist[to], to))
    return dist

N = ni()
adj = [[] for _ in range(N)]
for _ in range(N-1):
    a, b, c = na()
    adj[a-1].append((b-1, c))
    adj[b-1].append((a-1, c))

Q, K = na()
ans = []
d = dijkstra(K-1, N)

for i in range(Q):
    x, y = na()
    x -= 1
    y -= 1
    ans.append(d[x] + d[y])

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

acgt = ['A','C','G','T']
N, Q = map(int, input().split())
S = list(input())
for _ in range(Q):
    cnt = 0
    li, ri = map(int, input().split())
    tmpS = S[li-1:ri]
    i = 1
    while i < len(tmpS):
        t = tmpS[i]
        if t == 'A':
            i += 1
        elif t == 'C':
            if tmpS[i-1] == 'A':
                cnt += 1
            i += 2
        else:
            i += 2
    print(cnt)


### FIXED CODE ###

N, Q = map(int, input().split())
S = input()

cnt = 0
tmpS = S
i = 1
L = [0]
lapp = L.append
while i < N:
    t = tmpS[i]
    if t == 'A':
        lapp(cnt)
        i += 1
    elif t == 'C':
        if tmpS[i-1] == 'A':
            cnt += 1
        lapp(cnt)
        lapp(cnt)
        i += 2
    else:
        lapp(cnt)
        lapp(cnt)
        i += 2
for _ in range(Q):
    li, ri = map(int, input().split())
    print(L[ri - 1] - L[li - 1])
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
for i in range(n+1):
  m=0
  b1=sorted(a[:n+i])[i:]
  b2=sorted(a[n+i:])[:n]
  m=sum(b1)-sum(b2)
  if ans<m or i==0:
    ans=m
print(ans)

### FIXED CODE ###

import heapq
n=int(input())
a=list(map(int,input().split()))
ans=[0 for i in range(n+1)]
ans[0]=sum(a[:n])
b=a[:n]
heapq.heapify(b)
sb=sum(b)
for i in range(n):
  sb+=a[n+i]
  c=heapq.heappushpop(b,a[n+i])
  sb-=c
  ans[i+1]=sb
b=a[2*n:]
for i in range(n):
  b[i]=-b[i]
heapq.heapify(b)
ans[n]+=sum(b)
sb=sum(b)
for i in range(n-1,-1,-1):
  sb-=a[n+i]
  c=heapq.heappushpop(b,-a[n+i])
  sb-=c
  ans[i]+=sb
print(max(ans))
### BUGGY CODE ###

n,x,y=map(int,input().split())
x+=-1
y+=-1
k=[]
z=0
for i in range(n):
  k.append(0)
for i in range(n-1):
  for j in range(i+1,n):
    z=min(abs(x-i)+1+abs(j-y),abs(x-i)+abs(j-x),abs(y-i)+abs(j-y),j-i)
    k[z]+=1
    z=0
for i in range(1,n):
  print(k[i])

### FIXED CODE ###

n,x,y=map(int,input().split())
x+=-1
y+=-1
k=[]
z=0
for i in range(n):
  k.append(0)
for i in range(n-1):
  for j in range(i+1,n):
    z=min(abs(x-i)+1+abs(j-y),abs(y-i)+1+abs(j-x),j-i)
    k[z]+=1
    z=0
for i in range(1,n):
  print(k[i])
### BUGGY CODE ###

# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    n = int(input())
    a = list(map(int, input().split()))
    count = 0

    for i in range(n):
        for j in range(i, n):
            if sum(a[i:j + 1]) == 0:
                count += 1

    print(count)


### FIXED CODE ###

# -*- coding: utf-8 -*-

# AtCoder Grand Contest
# Problem A


if __name__ == '__main__':
    from collections import Counter

    n = int(input())
    a = [0] + list(map(int, input().split()))
    s = [0] * len(a)

    for i in range(1, n + 1):
        s[i] += s[i - 1] + a[i]

    print(sum([si * (si - 1) // 2 for si in Counter(s).values()]))
### BUGGY CODE ###

import sys
sys.setrecursionlimit((10 ** 6))
input = sys.stdin.readline
N, M, P = map(int, input().split())
INF = float('inf')
G = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a, b, c = a - 1, b - 1, c - P
    G[a].append((b, -c))

check = [False] * N


def dfs(u, used):
    if used[u]:
        return
    used[u] = True
    for w, c in G[u]:
        dfs(w, used)


def dfs2(u, dest):
    used = [False] * N
    dfs(u, used)
    check[u] = used[dest]


dist = [INF] * N
for i in range(N):
    dfs2(i, N - 1)

dist[0] = 0
for i in range(N):
    update = False
    for e in range(N):
        if not check[e]:
            continue
        for w, c in G[e]:
            if not check[w] or dist[e] == INF:
                continue
            if dist[w] > dist[e] + c:
                dist[w] = dist[e] + c
                update = True

    if not update:
        break
    if i == N - 1:
        print(-1)
        exit()

print(max(0, -dist[N - 1]))

### FIXED CODE ###

import sys
sys.setrecursionlimit((10 ** 6))
input = sys.stdin.readline
N, M, P = map(int, input().split())
INF = float('inf')
G = [[] for i in range(N)]
for i in range(M):
    a, b, c = map(int, input().split())
    a, b, c = a - 1, b - 1, c - P
    G[a].append((b, -c))
dist = [INF] * N
dist[0] = 0
for i in range(N):
    for e in range(N):
        for w, c in G[e]:
            if dist[e] != INF and dist[w] > dist[e] + c:
                dist[w] = dist[e] + c

ans = -dist[N - 1]
is_negative = [False] * N
for i in range(N):
    for e in range(N):
        for w, c in G[e]:
            if dist[e] != INF and dist[w] > dist[e] + c:
                dist[w] = dist[e] + c
                is_negative[w] = True

            if is_negative[e]:
                is_negative[w] = True

if is_negative[N - 1]:
    print(-1)
else:
    print(max(ans, 0))
### BUGGY CODE ###

N, W = map(int, input().split())
WV = [list(map(int, input().split())) for _ in range(N)]

dp = [0] * (W + 1)
for n in range(N):
	w, v = WV[n]
	for sumw in range(W, w - 1, -1):
		dp[sumw] = max([dp[sumw], dp[sumw - w] + v])
	#for x in dp:
	#	print("{:4d}".format(x), end="")
	#print()
print(max(dp))


### FIXED CODE ###

def dp():
  N, W = map(int, input().split())
  WV = (map(int, input().split()) for _ in range(N))

  DP = [0] * (W+1)
  for w, v in WV:
    for j in range(W, w-1, -1):
      dp = DP[j-w] + v 
      if DP[j] < dp:
        DP[j] = dp
  return max(DP)
print(dp())
### BUGGY CODE ###

n,k=map(int,input().split())
k=min(k,n-1)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
fact=[1]*(n+1)
for i in range(2,n+1):
  fact[i]=(fact[i-1] *i)%mod
def nCr(n,r):
  if r==0 or r==n:
    return 1
  val=((fact[n]*mpow(fact[r],mod-2))%mod*mpow(fact[n-r],mod-2))%mod
  return val
ans=0
for h in range(k+1):
  ans=(ans+(nCr(n,h)*nCr(n-1,n-h-1))%mod)%mod
print(ans)


### FIXED CODE ###

n,k=map(int,input().split())
k=min(k,n-1)
mod=10000*100000+7
def mpow(a,b,m=100000*10000+7):#returns a**b%m
  ret=1
  while b>0:
    if b&1:
      ret=(ret*a)%m
    a=(a*a)%m
    b>>=1
  return ret
fact=[1]*(n+1)
ifact=[1]*(n+1)
for i in range(2,n+1):
  fact[i]=(fact[i-1] *i)%mod
ifact[n]=mpow(fact[n],mod-2)
for i in range(n-1,1,-1):
  ifact[i]=((i+1)*ifact[i+1])%mod
def nCr(n,r):
  if r==0 or r==n:
    return 1
  val=(fact[n]*ifact[r])%mod
  return (val*ifact[n-r])%mod
ans=0
for h in range(k+1):
  ans=(ans+(nCr(n,h)*nCr(n-1,n-h-1))%mod)%mod
print(ans)
### BUGGY CODE ###

n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    for i in range(n):
        yield pow(f[i], p-2, p)

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(n, f, p))
perm = 0

for k in range((n+1)//2, n):
    b = m - k
    a = (m - 1) - (2 * b)
    perm_ = f[a+b] * rf[a] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

print(ans)

### FIXED CODE ###

n = int(input())
p = 10**9 + 7

def fact(n):
    n_ = 1
    yield n_
    for i in range(1, n+1):
         n_ = (n_*i) % p
         yield n_

def invfact(n, f, p):
    m = pow(f[n], p-2, p)
    yield m
    for i in range(n, 0, -1):
        m = m * i % p
        yield m

ans = 0
m = n - 1
f = list(fact(m))
rf = list(invfact(m, f, p))
rf.reverse()
perm = 0

for k in range((n+1)//2, n):
    b = m - k
    a = (m - 1) - (2 * b)
    perm_ = f[a+b] * rf[a] %p * f[k] % p
    ans += (perm_ - perm) %p * k % p
    ans %= p
    perm = perm_

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

[n,m] = [int(i) for i in input().split()]
a = []
for i in range(m):
    a.append(int(input()))
dp = [0] * (n+1)
dp[0] = 1
if n > 1:
    for i in range(1,n+1):
        if i not in a:
            if i == 1:
                dp[i] = 1
            else:
                dp[i] = (dp[i-2]+dp[i-1])%(10**9+7)
        else:
            dp[i] = 0
    print((dp[n])%(10 ** 9 + 7))
else:
    if 1 in a:
        print(0)
    else:
        print(1)


### FIXED CODE ###

[n,m] = [int(i) for i in input().split()]
a = []
for i in range(m):
    a.append(int(input()))
ok = [0] * (n+1)
for i in range(m):
    ok[a[i]] = 1
dp = [0] * (n+1)
dp[0] = 1
if n > 1:
    for i in range(1,n+1):
        if ok[i] != 1:
            if i == 1:
                dp[i] = 1
            else:
                dp[i] = (dp[i-2]+dp[i-1])%(10**9+7)
        else:
            dp[i] = 0
    print((dp[n])%(10 ** 9 + 7))
else:
    if 1 in a:
        print(0)
    else:
        print(1)
### BUGGY CODE ###

import numpy as np

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

ok=max(alst)
ng=0

while abs(ok-ng)>0.01:
    cen=(ok+ng)/2

    cnt=0

    for a in alst:
        cnt+=(a+cen-1)//cen-1

    if cnt<=k:
        ok=cen
    else:
        ng=cen+0.01

print(int(np.ceil(ok)))


### FIXED CODE ###

n,k=list(map(int,input().split()))
alst=list(map(lambda x:int(x)*100,input().split()))

ok=max(alst)
ng=0

while abs(ok-ng)>1:
    cen=(ok+ng)//2

    cnt=0

    for a in alst:
        cnt+=(a+cen-1)//cen-1

    if cnt<=k:
        ok=cen
    else:
        ng=cen+1

if ok%100==0:
    print(ok//100)
else:
    print(ok//100+1)
### BUGGY CODE ###

def main():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    t = input().rstrip()

    n = len(s)
    m = len(t)

    dp = [[[] for _ in range(m + 1)] for _ in range(n + 1)]

    for i in range(1, n + 1):
        s_ = s[i - 1]
        for j in range(1, m + 1):
            t_ = t[j - 1]
            if s_ != t_:
                if len(dp[i - 1][j]) >= len(dp[i][j - 1]):
                    dp[i][j] = dp[i - 1][j]
                else:
                    dp[i][j] = dp[i][j - 1]
            else:
                dp[i][j] = dp[i - 1][j - 1][:]
                dp[i][j].append(s_)

    print("".join(dp[-1][-1]))
if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    input = sys.stdin.readline

    s = input().rstrip()
    t = input().rstrip()

    n = len(s)
    m = len(t)

    dp = []
    for _ in range(n + 1):
        dp.append([0] * (m + 1))

    for i in range(1, n + 1):
        s_ = s[i - 1]
        for j in range(1, m + 1):
            t_ = t[j - 1]
            if s_ != t_:
                dp[i][j] = max(dp[i - 1][j], dp[i][j - 1])
            else:
                dp[i][j] = dp[i - 1][j - 1] + 1
    ans = []
    while n > 0 and m > 0:
        if dp[n][m] == dp[n][m - 1]:
            m -= 1
        elif dp[n][m] == dp[n - 1][m]:
            n -= 1
        else:
            ans.append(s[n - 1])
            n -= 1
            m -= 1
    print("".join(ans[::-1]))


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

import math
X=int(input())

A=int(X**(1/5))
Bp=0
Bm=0
for i in range(X):
    if(A**5-Bp**5==X):
        print(A,Bp)
        break
    if(A**5-Bm**5==X):
        print(A,Bm)
        break
    Bp+=1
    Bm-=1



### FIXED CODE ###

import math
X=int(input())

for A in range(-200,200):
    for B in range(-200,200):
        if(A**5-B**5==X):
            print(A,B)
            break
    else:
        continue
    break
### BUGGY CODE ###

import sys
sys.setrecursionlimit(2 ** 30)

def fact(n):
    if n == 0: return 1
    return n * fact(n-1)

N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=fact(M%1000000007)*fact(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)

### FIXED CODE ###

import sys
sys.setrecursionlimit(2 ** 30)

def fact(n):
    if n == 0: return 1
    return n * fact(n-1)%1000000007

N, M=map(int,input().split())
if(abs(N%1000000007-M%1000000007)>1):
    i=0
else:
    i=fact(M%1000000007)*fact(N%1000000007)
if(N==M):
    i=i*2
ans=i%1000000007
print(ans)
### BUGGY CODE ###

n = int(input())
s = input()
ans = 0
for i in range(n-2):
    for j in range(i+1, n-1):
        for k in range(j+1, n):
            if j - i == k - j:
                continue
            else:
                if (s[i] != s[j]) and (s[j] != s[k]) and (s[i] != s[k]):
                    ans += 1
print(ans)


### FIXED CODE ###

n = int(input())
s = input()
r, g, b = set(), set(), set()
for i in range(n):
    if s[i] == "R":
        r.add(i)
    elif s[i] == "G":
        g.add(i)
    else:
        b.add(i)

ans = len(r)*len(b)*len(g)
for i in r:
    for j in g:
        chk = j - i
        if chk + j in b:
            ans -= 1
        if i - chk in b:
            ans -= 1
        if (i + j)/2  in b:
            ans -= 1

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

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

A=set(list(range(int(P[0][0]), int(P[0][1])+1)))

for i in range (1, M):
	B = set(list(range(int(P[i][0]), int(P[i][1])+1)))
	A = A.intersection(B)

print(len(A))

### FIXED CODE ###

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

P = [0]*(N+1)

for i in range (0, M):
	A, B = map(int, input().split())
	P[A-1]+=1
	P[B]-=1
    
for i in range (1, N+1):
	P[i]+=P[i-1]
    
P = sorted(P, reverse = True)

count = 0

for i in range (0, N+1):
	if P[i] == M:
		count+=1
	else:
		print(count)
		exit()
### BUGGY CODE ###

from itertools import combinations

def main():
    EPS = 1e-8

    N, K, *XYC = map(int, open(0).read().split())
    PC = [(complex(x, y), c) for x, y, c in zip(*[iter(XYC)] * 3)]


    def intersection(A, r, B, s):
        D = B - A
        d = abs(D)

        cos_t = (d * d + r * r - s * s) / (2 * d * r)
        sin_t = max(1 - cos_t * cos_t, 0.0) ** 0.5

        R = r * complex(cos_t, sin_t)
        D /= d

        return (
            A + D * R,
            A + D * R.conjugate(),
        )


    def is_ok(T):
        if any(K <= sum(1 for p, c in PC if c * abs(a - p) < T + EPS) for a, _ in PC):
            return True

        for (p1, c1), (p2, c2) in combinations(PC, 2):
            q1, q2 = intersection(p1, T / c1, p2, T / c2)
            if K <= sum(1 for p, c in PC if c * abs(q1 - p) < T + EPS):
                return True
            if K <= sum(1 for p, c in PC if c * abs(q2 - p) < T + EPS):
                return True

        return False

    ng, ok = 0, 1000000
    for _ in range(100):
        md = (ng + ok) / 2
        if is_ok(md):
            ok = md
        else:
            ng = md

    print(ok)

main()

### FIXED CODE ###

from math import hypot
from collections import deque

N, K, *XYC = map(int, open(0).read().split())
XYC = list(zip(*[iter(XYC)] * 3))

Q = deque([(0, 0, 1000.0)])

ans = float("inf")
while Q:
    X, Y, r = Q.popleft()
    if ans * 0.9999995 > sorted(c * hypot(max(abs(X - x) - r, 0), max(abs(Y - y) - r, 0)) for x, y, c in XYC)[K - 1]:
        ans = min(ans, sorted(c * hypot(X - x, Y - y) for x, y, c in XYC)[K - 1])
        for dx, dy in [(-0.5, -0.5), (-0.5, 0.5), (0.5, -0.5), (0.5, 0.5)]:
            Q.append((X + dx * r, Y + dy * r, r / 2))

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

# -*- coding: utf-8 -*-
import numpy as np
N, X, Y = list(map(int, input().split()))

distance_lis = [0]*(N-1)
for i in range(1, N + 1):
    for j in range(i+1, N + 1):
        # XYを使わない場合
        a = j - i
        b = np.abs(X - i) + np.abs(Y - j) + 1
        distance = min(a, b)
        distance_lis[distance-1] += 1
for dis in distance_lis:
    print(dis)


### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
N, X, Y = list(map(int, input().split()))

distance_lis = [0]*(N-1)
for i in range(1, N + 1):
    for j in range(i+1, N + 1):
        # XYを使わない場合
        a = j - i
        b = abs(X - i) + abs(Y - j) + 1
        distance = min(a, b)
        distance_lis[distance-1] += 1
for dis in distance_lis:
    print(dis)
### BUGGY CODE ###

from collections import Counter
from itertools import combinations

n = int(input())

counters = []
for _ in range(n):
    counters.append(Counter(input().rstrip()))

ans = 0
for c1, c2 in combinations(counters, 2):
    ck1 = sorted(c1.keys())
    ck2 = sorted(c2.keys())
    if len(ck1) != len(ck2):
        continue
    for k1, k2 in zip(ck1, ck2):
        if k1 != k2:
            break
        elif c1[k1] != c2[k2]:
            break
    else:
        ans += 1

print(ans)

### FIXED CODE ###

from collections import Counter

n = int(input())
ans = 0
k = set()
c = Counter()

for _ in range(n):
    s = ''.join(sorted(list(input().rstrip())))
    if s in k:
        c[s] += 1
    k.add(s)

ans = 0
for ck in c.keys():
    ans += c[ck] * (c[ck] + 1) // 2

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

n = int(input())
a = list(map(int, input().split()))
s = set(a)
ans = 0
for i in s:
    c = a.count(i)
    if c >= i:
        ans += c - i
    else:
        ans += c
print(ans)

### FIXED CODE ###

import collections
n=int(input())
c=collections.Counter(list(map(int,input().split()))).most_common()
a=0
for i in c:
 if i[0]>i[1]:a+=i[1]
 else:a+=i[1]-i[0]
print(a)
### BUGGY CODE ###

import itertools
import numpy as np
import math

def main():
    N = int(input())

    coordinate = np.array([[]])
    for _ in range(N):
        x, y = map(int, input().split())
        coordinate = np.append(coordinate, [x, y])
    coordinate = coordinate.reshape((N, 2))
    #print(coordinate)

    sum = 0

    for i in itertools.permutations(coordinate):
        v_1 = i[0]
        for j in range(1, len(i)):
            v_2 = i[j]
            sum += np.linalg.norm(v_1 - v_2)
            v_1 = v_2

    print(sum/math.factorial(N))
    return 0
if __name__ == '__main__':
    main()

### FIXED CODE ###

import itertools
import numpy as np
import math

def main():
    N = int(input())

    coordinate = []
    for _ in range(N):
        coordinate.append(tuple(map(int, input().split())))

    distance = [[None]*N for _ in range(N)]

    for i in range(N):
        x1, y1 = coordinate[i]
        for j in range(N):
            x2, y2 = coordinate[j]
            distance[i][j] = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)

    C = [i for i in range(N)]

    sum = 0
    for c in itertools.permutations(C):
        c_1 = c[0]
        for j in range(1, len(c)):
            c_2 = c[j]
            sum += distance[c_1][c_2]
            c_1 = c_2
    print(sum/math.factorial(N))

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

S = input()
N = len(S)
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        if int(S[i: j + 1] ) % 2019 == 0:
            ans += 1
print(ans)

### FIXED CODE ###

import collections
S = input()[::-1]
N = len(S)
mod = 2019

ans = 0
x = [0] * N
x[0] = int(S[0]) % mod
ruijo = 10

for i in range(1, N):
    x[i] = (ruijo * int(S[i]) + x[i - 1]) % mod
    if x[i] % mod == 0:
        ans += 1
    ruijo *= 10
    ruijo %= mod
    
d = collections.Counter(x)

for i in d.values():
    ans += i * (i - 1) // 2
    
print(ans)