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

# -*- coding: utf-8 -*-
from sys import stdin

def reversi(s,a):
    if s == a:
        return "end"
    if s[-1] == a:
        return reversi(s[:-1],a)
    else:
        return s
    
s = stdin.readline().rstrip()
ans = 0

while True:
    if len(list(set(s))) == 1:
        break
    else:
        s = reversi(s,s[-1])
        ans += 1
print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-
from sys import stdin

s = stdin.readline().rstrip()
ans = 0

for i in range(1,len(s)):
    if s[i] != s[i-1]:
        ans += 1
print(ans)
### BUGGY CODE ###

N = int(input().split()[0])
aa = input().split()
bb = []

for i in range(1, N+1):
    for j in range(0, N):
        if int(aa[j]) == i:
            bb.append(j+1)

print(*bb)

### FIXED CODE ###

N = int(input().split()[0])
aa = input().split()
bb = [0]*N

for i in range(0, N):
    bb[int(aa[i]) - 1] = i + 1

print(*bb)
### BUGGY CODE ###

inpu=input().split()
s=[int(s) for s in inpu]
while True:
    if s[0]==0:
        break
    else:
        print("#"*s[1])
        for i in range(s[0]-2):
            print("#"+"."*(s[1]-2)+"#")
        print("#"*s[1])
        print()


### FIXED CODE ###

while True:
    s=input().split()
    t=[int(i) for i in s]
    H=t[0]
    W=t[1]
    if H==0:
        break
    else:
        print("#"*W)
        for i in range(H-2):
            print("#"+"."*(W-2)+"#")
        print("#"*W)
        print()
### BUGGY CODE ###

import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
max_k_list = [kv[0] for kv in c.items() if kv[1] == max(c.values())]
max_k_list.sort()
for max_k in max_k_list:
    print(max_k)

### FIXED CODE ###

import collections
N = int(input())
S = [input() for i in range(N)]
c = collections.Counter(S)
max_count = c.most_common()[0][1]
max_k_list = [kv[0] for kv in c.items() if kv[1] == max_count]
max_k_list.sort()
for max_k in max_k_list:
    print(max_k)
### BUGGY CODE ###

import array

n= int(input())

maxN = 1000000
a = list(map(int, input().split()))

def calculate_prime():
    primes = [True] * maxN
    primes[0] = primes[1] = False
    prim = []
    prime_map = dict()
    for i in range(2, maxN):
        if primes[i] == True:
            prime_map[i] = 0
            prim.append(i)
            j = i * i
            while j < maxN:
                primes[j]= False
                j+=i
    return prime_map, array.array('i',prim)

prime_map, prim = calculate_prime()

#print(prim)
for i in a:
    if i in prime_map:
        if prime_map[i] < 1:
            prime_map[i] = 1
    else:
        k = i
        for j in prim:
            if k % j == 0:
                tmp = 0
                while k % j == 0:
                    k = k // j
                    tmp += 1
                if tmp > prime_map[j]:
                    prime_map[j] = tmp
            if k == 1:
                break

lcm = 1
for k, v in prime_map.items():
    if v > 0:
        lcm = lcm * (k**v)

#print(lcm)
result = 0

for i in a:
    result += lcm // i
    if result >= 1000000007:
        result = result % 1000000007

print(result)


### FIXED CODE ###

import array

n= int(input())

maxN = 1000000
a = list(map(int, input().split()))

def calculate_prime():
    primes = [True] * maxN
    primes[0] = primes[1] = False
    prim = []
    prime_map = dict()
    for i in range(2, maxN):
        if primes[i] == True:
            prime_map[i] = 0
            prim.append(i)
            j = i * i
            while j < maxN:
                primes[j]= False
                j+=i
    return prime_map, array.array('i',prim)

prime_map, prim = calculate_prime()

pppp = []
#print(prim)
for i in list(set(a)):
    if i in prime_map:
        if prime_map[i] < 1:
            pppp.append(i)
            prime_map[i] = 1

    else:
        k = i
        for j in prim:
            if k % j == 0:
                tmp = 0
                while k % j == 0:
                    k = k // j
                    tmp += 1
                if tmp > prime_map[j]:
                    if prime_map[j] == 0:
                        pppp.append(j)
                    prime_map[j] = tmp
            if k in prime_map:
                if prime_map[k] < 1:
                    pppp.append(k)
                    prime_map[k] = 1
                    break
            if k == 1:
                break

lcm = 1
for k in list(set(pppp)):
    lcm = lcm * (k**prime_map[k])

#print(lcm)
result = 0

for i in a:
    result += lcm // i

if result >= 1000000007:
    result = result % 1000000007
print(result)
### BUGGY CODE ###

H,W = map(int,input().split())
A = ['' for i in range(H)]
colors = [[-2 for j in range(W)] for i in range(H)]
q = []
for i in range(H):
    A[i] = list(input())
    for j,color in enumerate(A[i]):
        colors[i][j] = 0 if color == '#' else -1
        if '#' == color:
            q.append([i,j,0])
            colors[i][j] = 0
# for i in colors:
#     print(i)
mx = 0
direction = [[1,0],[0,1],[-1,0],[0,-1]]

while len(q) > 0:
    # print(q)
    tmp = [y,x,op] = q.pop(0)
    mx = max(mx,op)
    if colors[y][x] >= 0 and mx > 0: continue
    for [dx,dy] in direction:
        ny,nx = y + dy , x + dx
        if  0 <= ny and ny < H and 0 <= nx and nx < W:
            if A[ny][nx] == '#' or colors[ny][nx] >= 0:
                continue
            q.append([ny,nx,op+1])
            colors[y][x] = op+1
print(mx)

### FIXED CODE ###

from sys import stdin
from collections import deque
def main():
    readline = stdin.readline
    H,W = map(int,readline()[:-1].split())
    A = ['' for i in range(H)]
    visited = [[False] * W for i in range(H)]
    q = deque()
    for i in range(H):
        A[i] = readline()[:-1]
        # print(A[i])
        for j,color in enumerate(A[i]):
            if '#' == color:
                q.append([i,j,0])
                visited[i][j] = True
            # for i in visited:
            #     print(i)
    mx = 0
    direction = [[1,0],[0,1],[-1,0],[0,-1]]
    op = -1
    while len(q) > 0:
        # print(q)
        tmp = [y,x,op] = q.popleft()
        # print(tmp)
        mx = mx if mx > op else op
        for [dx,dy] in direction:
            ny,nx = y + dy , x + dx
            if  0 <= ny and ny < H and 0 <= nx and nx < W:
                if A[ny][nx] == '#' or visited[ny][nx] == True:
                    continue
                q.append([ny,nx,op+1])
                visited[ny][nx] = True
    print(op)

main()
### BUGGY CODE ###

def lcs_len(x, y):
    ly = len(y)
    tcsl = [0 for i in range(ly + 1)]
    for x_i in x:
        pre_tcsl = list(tcsl)
        for j in range(ly):
            if x_i == y[j]:
                tcsl[j] = pre_tcsl[j - 1] + 1
            else:
                tcsl[j] = max(pre_tcsl[j], tcsl[j - 1])
    print(tcsl[j])


import sys

q = int(sys.stdin.readline())

for i in range(q):
    ax = sys.stdin.readline()[:-1]
    ay = sys.stdin.readline()[:-1]
    lcs_len(ax, ay)

### FIXED CODE ###

def lcs_len(x, y):
    indices = [0]
    for y_i in y:
        t_index = 0
        for i, index in enumerate(indices, 1):
            c_index = x.find(y_i, t_index) + 1
            if c_index:
                if i < len(indices):
                    t_index = indices[i]
                    indices[i] = min(c_index, t_index)
                else:
                    indices.append(c_index)
                    break
    print(len(indices) - 1)


q = int(input())

for i in range(q):
    ax = input()
    ay = input()
    lcs_len(ax, ay)
### BUGGY CODE ###

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

tree = []
for _ in range(n):
    tree.append(int(input()))

tree.sort()
ans = 10**9
for i in range(n-k+1):
    ans = min(ans, max(tree[i:i+k])-min(tree[i:i+k]))
print(ans)


### FIXED CODE ###

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

hl = []
for _ in range(n):
    hl.append(int(input()))

hl.sort()

ans = 10**9+1
for i in range(len(hl)-k+1):
    ans = min(ans, hl[i+k-1]-hl[i])

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

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

### FIXED CODE ###

import numpy as np
n=int(input())
s=list(map(int,input().split()))
x=np.argsort(s)
print(*x+1)
### BUGGY CODE ###

import numpy as np


def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = np.array(read_input(), dtype="int")
B = np.zeros(N, dtype="int")
coordinate = np.arange(1, N+1)

limit_count = 0
limit = np.log(N)
for _ in range(K):
    for i in range(N):
        c = coordinate[i]
        B[i] = (A >= np.abs(coordinate - c)).sum()
    A = B.copy()
    if limit_count > limit_count:
        break


print(" ".join(map(str, A.tolist())))


### FIXED CODE ###

def read_input(trans=int):
    return list(map(trans, input().split()))


N, K = read_input()
A = read_input()
K = min(K, 41)

for _ in range(K):
    B = [0]*N
    for i in range(N):
        start = max(i-A[i], 0)
        end = min(i+A[i], N-1)

        B[start] += 1
        if end+1 < N:
            B[end+1] -= 1
    for i in range(1, N):
        B[i] += B[i-1]
    A = B.copy()


print(" ".join(map(str, A)))
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
A_set = set(A)
cnt = 0
for i in A_set:
	if A.count(i) % 2 == 1:
		cnt+=1
print(cnt)

### FIXED CODE ###

import collections
N = int(input())
A = [int(input()) for i in range(N)]
cnt = 0
collection = collections.Counter(A)
for i in collection.values():
	if i % 2 == 1:
		cnt+=1
print(cnt)
### BUGGY CODE ###

import sys
import math

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a,m):
    x = extgcd(a,m)[0]
    return (m+x%m)%m

input = sys.stdin.readline
n,a,b = map(int,input().split())
MOD = 10 ** 9 + 7
x1 = 1

a = min(a,n-a)
b = min(b,n-b)
if a > b:
    a,b = b,a

for i in range(n-a+1,n+1):
    x1 = x1 * i % MOD
for i in range(1,a+1):
    x1 = x1 * mod_inv(i,MOD)

x2 = x1
for i in range(n-b+1,n-a+1):
    x2 = x2 * i % MOD
for i in range(a+1,b+1):
    x2 = x2 * mod_inv(i,MOD)
    x2 = x2 % MOD

t = bin(n)
x0 = 1
for i in t:
    x0 = x0 ** 2
    x0 = x0 % MOD
    if i == '1':
        x0 *= 2
        x0 = x0 % MOD
print ((x0 - x1 - x2 - 1) % MOD)


### FIXED CODE ###

import sys
import math
MOD = 10 ** 9 + 7

def extgcd(a,b):
    r = [1,0,a]
    w = [0,1,b]
    while w[2]!=1:
        q = r[2]//w[2]
        r2 = w
        w2 = [r[0]-q*w[0],r[1]-q*w[1],r[2]-q*w[2]]
        r = r2
        w = w2
    #[x,y]
    return [w[0],w[1]]

def mod_inv(a):
    x = extgcd(a,MOD)[0]
    return (MOD+x%MOD)%MOD

input = sys.stdin.readline
n,a,b = map(int,input().split())
x1 = 1

a = min(a,n-a)
b = min(b,n-b)
if a > b:
    a,b = b,a

for i in range(n-a+1,n+1):
    x1 = x1 * i % MOD
x11 = 1
for i in range(1,a+1):
    x11 = x11 * i % MOD
x1 = x1 * mod_inv(x11) % MOD

x2 = x1
for i in range(n-b+1,n-a+1):
    x2 = x2 * i % MOD
x21 = 1
for i in range(a+1,b+1):
    x21 = x21 * i % MOD
x2 = x2 * mod_inv(x21) % MOD

t = []
nn = n
while nn > 0:
    t.append(nn % 2)
    nn //= 2
x0 = 1
for i in range(len(t)):
    x0 = x0 ** 2
    x0 = x0 % MOD
    if t[len(t)-i-1] == 1:
        x0 *= 2
        x0 = x0 % MOD
print ((x0 - x1 - x2 - 1) % MOD)
### BUGGY CODE ###

import sys
from bisect import bisect_left, bisect, insort_left, insort
A = []
for s in sys.stdin:
    if s[2] == "s":
        insort(A, int(s[7:]))
    elif s[2] == "t":
        print(A.pop())
    else:
        break



### FIXED CODE ###

import sys
from heapq import heapify, heappush, heappop
hq = []
S = []
for s in sys.stdin:
    if s[2] == "s":
        heappush(hq, -int(s[7:]))
    elif s[2] == "t":
        S.append(-heappop(hq))
    else:
        break
print("\n".join(map(str, S)))
### BUGGY CODE ###

def comb(a, b):
    b = min(b, a - b)

    res = 1
    for i in range(b):
        res *= (a - i)
        res %= MOD

    for div in range(1, b + 1):
        res = res * pow(div, MOD - 2, MOD) % MOD
    return res


def prime_factorization(x):
    res = []
    i = 2
    left = x + 0
    while True:
        if (i * i > x) and (left == 1):
            break
        cnt = 0
        while left % i == 0:
            left /= i
            cnt += 1
        if cnt > 0:
            res.append(cnt)
        # print(i, res)
        i += 1
    return res


n, m = map(int, input().split())

MOD = 10 ** 9 + 7

ans = 1
for power in prime_factorization(m):
    ans *= comb(n - 1 + power, power)
    ans %= MOD

print(ans)

### FIXED CODE ###

MOD = 10 ** 9 + 7


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


def comb(a, b):
    b = min(b, a - b)
    if b < 0:
        return 0
    elif b == 0:
        return 1
    elif b == 1:
        return a
    else:
        return (a % MOD) * pow(b, MOD - 2, MOD) % MOD * comb(a - 1, b - 1) % MOD


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

ans = 1
for power in prime_factorization(M):
    ans *= comb(N - 1 + power, power)
    ans %= MOD

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

from math import factorial
mod= 998244353

def combinations_count(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

n,m,k=map(int,input().split())

ans=0
for i in range(n-k-1,n):
    X=factorial(n-1)*pow(factorial(i),mod-2,mod)*pow(factorial(n-1-i),mod-2,mod)
    X%=mod
    ans+=X*m*pow(m-1,i,mod)
    ans%=mod
print(ans)


### FIXED CODE ###

mod= 998244353

n,m,k=map(int,input().split())

ans=0
cmb=1
for i in range(k+1):
    ans+=cmb*m*pow(m-1,n-1-i,mod)
    ans%=mod
    cmb*=(n-1-i)*pow(i+1,mod-2,mod)
    cmb%=mod
print(ans)
### BUGGY CODE ###

from statistics import median

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

for i in range(N):
    Xx = [X[k] for k in range(N) if k != i]
    print(median(Xx))


### FIXED CODE ###

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

Xs = sorted(X)
median1 = Xs[int(N/2)-1]
median2 = Xs[int(N/2)]

for i in range(N):
    if X[i] >= median2:
        print(median1)
    else:
        print(median2)
### BUGGY CODE ###

N,K=map(int, input().split())
A = list(map(int, input().split()))
B=0
for i in range(N-K+1):
    S = (sum(A[i:i+K])+K)/2
    if B<S:
        B=S
print(B)

### FIXED CODE ###

def main():
    N,K=map(int, input().split())
    A = list(map(int, input().split()))
    S = (sum(A[0:K])+K)/2
    S_max=S
    for i in range(K,N):
        S +=  A[i]/2
        S -= A[i-K]/2
        if S_max<S:
            S_max=S
    print(S_max)

main()
### BUGGY CODE ###

n,m,k = map(int,input().split())
mod = 998244353
def pascal(n):
    line = [1]
    for k in range(n):
        line.append(int(line[k] * (n-k) // (k+1)) )
    return line
line = pascal(n-1)
#print(line)

mm1 = [1]

for i in range(1, n+1):
    mm1 += [(mm1[-1] * (m-1)) % mod]

mm = [1]
for i in range(1, n+1):
    mm += [(mm[-1] * (m)) % mod]

ans = 0
for i in range(k+1):
    if i == 0:
        ans += (mm1[n-1] * m ) % mod
        continue
    if i == n-1:
        ans += (m)
        break
    ans += (mm1[n-1-i] * line[i] * m) % mod

ans = (ans)%mod
print(ans)



### FIXED CODE ###

max_n=2 * 10**5
mod=998244353
fact, inv_fact = [0] * (max_n + 1), [0] * (max_n + 1)
fact[0] = 1
for i in range(max_n):
    fact[i + 1] = fact[i] * (i + 1) % mod

inv_fact[-1] = pow(fact[-1], mod - 2, mod)
for i in reversed(range(max_n)):
    inv_fact[i] = inv_fact[i + 1] * (i + 1) % mod

def nCr_mod(n, r):
    res = 1
    while n or r:
        a, b = n % mod, r % mod
        if a < b:
            return 0
        res = res * fact[a] % mod * inv_fact[b] % mod * inv_fact[a - b] % mod
        n //= mod
        r //= mod
    return res
n,m,k = map(int,input().split())


mm1 = [1]

for i in range(1, n+1):
    mm1 += [(mm1[-1] * (m-1)) % mod]

mm = [1]
for i in range(1, n+1):
    mm += [(mm[-1] * (m)) % mod]

ans = 0
for i in range(k+1):
    if i == 0:
        ans += (mm1[n-1] * m ) % mod
        continue
    if i == n-1:
        ans += (m)
        break
    ans += (mm1[n-1-i] * nCr_mod(n-1,i) * m) % mod

ans = (ans)%mod
print(ans)
### BUGGY CODE ###

S=input()
Q=int(input())
for i in range(Q):
    q=list(input().split())
    if q[0]=="1":
        S=S[::-1]
    else:
        if q[1]=="1":
            S=q[2]+S
        else:
            S=S+q[2]
print(S)


### FIXED CODE ###

S=input()
Q=int(input())
T=""
for i in range(Q):
    q=input().split()
    if q[0]=="1":
        T,S=S,T
    else:
        if q[1]=="1":
            T+=q[2]
        else:
            S+=q[2]
print(T[::-1]+S)
### BUGGY CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if a[0] != 0:
    print("-1")
else:
    x = [0] * len(a)
    b = 9999
    c = 0
    for i in range(len(a) - 1, 0, -1):
        if a[i] == x[i]:
            continue
        if i - a[i] < 0:
            break 
        for j in range(1, a[i]+1):
            x[i - a[i] + j] = j
            c += 1
    if a == x:
        print(c)
    else:
        print("-1")

### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))
if a[0] != 0:
    print("-1")
else:
    x = [0] * len(a)
    d = [0] * len(a)
    dd = [0] * len(a)

    c = 0
    s = 10**6
    #0 1 1 0 1 2 2 2 3
    wala = False
    for i in range(len(a) - 1, 0, -1):
        #print("-")
        if i <= s and a[i] == 0:
            #print("X")
            continue
        if i - a[i] < 0 or i - a[i] > s:
            #print("Y")
            wala = True
            break
        if s + a[i] == i:
            continue
        s = min(s, i - a[i])
        c += a[i]
    if wala:
        print("-1")
    else:
        print(c)
### BUGGY CODE ###

def getCalc(NUM):
    sum = 0
    for i in range(len(NUM)):
        sum += i * NUM[i]

    return sum


N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = list(map(int, input().split()))
    B.append(b)
    C.append(c)

max_num = max(max(A), max(B), max(C))

NUM = [0]*(max_num + 1)

for i in range(max_num+1):
    NUM[i] = A.count(i)

for i in range(Q):
    NUM[B[i]], NUM[C[i]] = 0, NUM[B[i]] + NUM[C[i]]

    print(getCalc(NUM))


### FIXED CODE ###


N = int(input())
A = list(map(int, input().split()))
Q = int(input())
B = []
C = []
for i in range(Q):
    b, c = list(map(int, input().split()))
    B.append(b)
    C.append(c)

max_num = max(max(A), max(B), max(C))

NUM = [0] * (max_num + 1)

num_list = []

for a in A:
    NUM[a] += 1

total = sum(A)

for i in range(Q):

    total += (C[i] - B[i]) * NUM[B[i]]
    NUM[B[i]], NUM[C[i]] = 0, NUM[B[i]] + NUM[C[i]]

    print(total)
### BUGGY CODE ###

L = []
for _ in range(int(input())):
    A = int(input())
    if A not in L:
        L.append(A)
    else:
        L.remove(A)
print(len(L))
    

### FIXED CODE ###

S = set()
for _ in range(int(input())):
    A = int(input())
    if A not in S:
        S.add(A)
    else:
        S.remove(A)
print(len(S))
### BUGGY CODE ###

import collections
S=input()[::-1]
l=len(S)
T=0
A=[0]*2019
A[0]=1
for i in range(l):
    T+=int(S[i])*(10**i)
    A[T%2019]+=1
ans=0
for cnt in A:
    ans+=cnt*(cnt-1)//2
print(ans)
















### FIXED CODE ###

s = input()[::-1] # 入力文字列を逆順でsに格納

counts = [0] * 2019
counts[0] = 1

num, d = 0, 1

for char in s:
    num += int(char) * d
    num %= 2019
    d *= 10
    d %= 2019
    counts[num] += 1

ans = 0
for cnt in counts:
    ans += cnt * (cnt - 1) // 2

print(ans) # 答えの出力
### BUGGY CODE ###

m = input().split()
Q = int(m[0])
H = int(m[1])
S = int(m[2])
D = int(m[3])

ans = 0
N = int(input())

for d in range((N // 2) + 1 ):
  s_set = N - (2*d)
  for s in range(s_set + 1):
    h_set = N - (2*d + 1*s)
    for h in range(h_set * 2 +1):
      q = int( 4 * (N - (2*d + 1 * s + 0.5 * h)))
      money = d*D + s*S + h*H + q*Q

      if (ans == 0) or (ans > money):
        ans = money

print(ans)

### FIXED CODE ###

Q,H,S,D = map(int,input().split())
N = int(input())
h = min(2*Q,H)
s = min(2*h,S)
d = min(2*s,D)
print((N//2)*d + (N%2)*s)
### BUGGY CODE ###


import numpy as np

def main():
    SpotNum = int(input())
    SpotCoodinate = [int(i) for i in input().split()]
    
    SpotCoodinate.insert(0, 0)
    SpotCoodinate.append(0)
    
    for i in range(SpotNum):
        RmSpotCoodinate = SpotCoodinate[:i+1] + SpotCoodinate[i+2:]
#        print(RmSpotCoodinate)
        print(sum(abs(np.diff(RmSpotCoodinate))))
#        print(result)
if __name__=="__main__":
    main()

### FIXED CODE ###

import numpy as np

def main():
    SpotNum = int(input())
    SpotCoordinate = [int(i) for i in input().split()]
    
    SpotCoordinate.insert(0, 0)
    SpotCoordinate.append(0)
    
    DiffSpotCoordinate = abs(np.diff(SpotCoordinate))
#    print(DiffSpotCoordinate)
    
#    SumTable = [0 for i in range(100000)]
##    print(SumTable)
#    
#    Diff = abs(SpotCoordinate[0] - SpotCoordinate[2] )
#    result = Diff + sum(DiffSpotCoordinate[2:])
#    print(result)
#    
#    for i in range(1,SpotNum):
#        if(SumTable == []):
#            SumTable[i-1] = sum(DiffSpotCoordinate[:i])
##            print(SumTable[i-1])
#        else:
#            SumTable[i-1] = SumTable[i-2] + sum(DiffSpotCoordinate[i-1:i])
##            print(SumTable[i-1])
#            
#        Diff = abs(SpotCoordinate[i] - SpotCoordinate[i+2] )
##        print(Diff)
#        
#        result = Diff + SumTable[i-1] + sum(DiffSpotCoordinate[i+2:])
##        print(RmSpotCoodinate)
##        print(sum(abs(np.diff(RmSpotCoordinate))))
#        print(result)
    
    SumDiffSpotCoordinate = sum(DiffSpotCoordinate)
    for i in range(1,SpotNum+1):
        result = SumDiffSpotCoordinate - DiffSpotCoordinate[i-1] - DiffSpotCoordinate[i] + abs(SpotCoordinate[i-1] - SpotCoordinate[i+1])
        print(result)
        
if __name__=="__main__":
    main()
### BUGGY CODE ###

n = int(input())

ll = [[0]*i for i in range(n)]
for i in range(n):
  x, l =map(int, input().split())
  ll[i] = [x-l, x+l]
ll = sorted(ll)

l = [1] * n

for i in range(n-1):
  for j in range(i+1, n):
    if l[i] == 1 and ll[i][1] > ll[j][0]:
      l[j] = 0

print(sum(l)) 

### FIXED CODE ###

n = int(input())
ll = []
for i in range(n):
  x, l = map(int, input().split())
  ll.append([x-l, x+l])
ll = sorted(ll)

ans = n
r = ll.pop()[0]

while ll:
  while ll and ll[-1][1] > r:
    ans -= 1
    ll.pop()
  if ll:
    r = ll.pop()[0]

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

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    for i in range(N):
        H-=max(A)
        A.remove(max(A))
        if H<=0:
            print(YES)
            break
    else:
        print(NO)
    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()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys

YES = "Yes"  # type: str
NO = "No"  # type: str


def solve(H: int, N: int, A: "List[int]"):
    A.sort()
    for i in range(N):
        H-=A[-1]
        del A[-1]
        if H<=0:
            print(YES)
            break
    else:
        print(NO)
    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()
    H = int(next(tokens))  # type: int
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(H, N, A)

if __name__ == '__main__':
    main()