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

exec("def nWord(): nWord.cache = raw_input() if not hasattr(nWord, 'cache') or nWord.cache=='' else nWord.cache ; pos = nWord.cache.find(nWord.sep) ; ret, nWord.cache = (nWord.cache, '') if pos==-1 else (nWord.cache[:pos], nWord.cache[pos+1:].lstrip(nWord.sep)) ; return ret") ; exec("nWord.sep = ' '") ; exec("def ___nLine2(): ret, nWord.cache = (raw_input(), nWord.cache if hasattr(nWord, 'cache') else '') if not hasattr(nWord, 'cache') or nWord.cache=='' else (nWord.cache, '') ; return ret") ; exec('def nInt(): return int(nWord())') ; exec('def nFloat(): return float(nWord())') ; exec("def ___nAuto2():\n ret = nWord()\n try: return int(ret)\n except: pass\n try: return float(ret)\n except: return ret") ; exec("def nAuto(n=None): return ___nAuto2() if n is None else [___nAuto2() for i in range(n)]") ; exec("def nLine(n=None): return ___nLine2() if n is None else [___nLine2() for i in range(n)]")
 
N = nAuto()
S = nAuto(N)

def check(A):
    for i in range(N):
        for j in range(N):
            if S[(A+i) % N][j]!=S[(A+j) % N][i]:
                return 0
    return N
 
count = 0
for A in range(N):
    count += check(A)
print count


### FIXED CODE ###

exec("def nWord(): nWord.cache = raw_input() if not hasattr(nWord, 'cache') or nWord.cache=='' else nWord.cache ; pos = nWord.cache.find(nWord.sep) ; ret, nWord.cache = (nWord.cache, '') if pos==-1 else (nWord.cache[:pos], nWord.cache[pos+1:].lstrip(nWord.sep)) ; return ret") ; exec("nWord.sep = ' '") ; exec("def ___nLine2(): ret, nWord.cache = (raw_input(), nWord.cache if hasattr(nWord, 'cache') else '') if not hasattr(nWord, 'cache') or nWord.cache=='' else (nWord.cache, '') ; return ret") ; exec('def nInt(): return int(nWord())') ; exec('def nFloat(): return float(nWord())') ; exec("def ___nAuto2():\n ret = nWord()\n try: return int(ret)\n except: pass\n try: return float(ret)\n except: return ret") ; exec("def nAuto(n=None): return ___nAuto2() if n is None else [___nAuto2() for i in range(n)]") ; exec("def nLine(n=None): return ___nLine2() if n is None else [___nLine2() for i in range(n)]")
 
N = nAuto()
S = nAuto(N)
 
def check(A):
    for i in range(N):
        for j in range(N):
            if S[(A+i) % N][j]!=S[(A+j) % N][i]:
                return 0
    return N
 
count = 0
for A in range(N):
    count += check(A)
print count
### BUGGY CODE ###

import numpy as np
m = 10**9 + 7
n = int(input())
an = list(map(int, input().split()))
an_np = np.array(an)
summary = 0
for i in range(0, n-1):
    summary = (summary + sum(an_np[i] * an_np[i+1: n] % m)) % m
print(summary)

### FIXED CODE ###

m = 10**9 + 7
n = int(input())
an = list(map(int, input().split()))
wa = []
total = 0
for i in reversed(range(1, len(an))):
    total = total + an[i]
    wa.append(total)
wa = sorted(wa, reverse=True)
ans = 0
for i in range(0, n-1):
#     print(an[i] * wa[i])
    ans = ans + an[i] * (wa[i]%m)
    ans = ans % m
print(ans)
### BUGGY CODE ###

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


num = int(N // 2 + 1)
cnt = {}
for i in range(1, N + 1):
    cnt[i] = 0
A.reverse()
B = []

for i, a in enumerate(A):
    i = N - i
    if i >= num:
        if a == 1:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)
    else:
        if cnt[i] != a:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)

print(len(B))
B = list(map(str, B))
print(' '.join(B))


### FIXED CODE ###

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


def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    return divisors


num = int(N // 2 + 1)
cnt = {}
for i in range(1, N + 1):
    cnt[i] = 0
A.reverse()
B = []

for i, a in enumerate(A):
    i = N - i
    if i >= num:
        if a == 1:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)
    else:
        if cnt[i] != a:
            for p in make_divisors(i):
                cnt[p] = (cnt[p] + 1) % 2
            B.append(i)

print(len(B))
B = list(map(str, B))
print(' '.join(B))
### BUGGY CODE ###

N = int(input())
A = list(map(int, input().split()))
res = 1
for i in range(N):
    res *= A[i]
if res > 10**18:
    print(-1)
else:
    print(res)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A = sorted(A)
res = A[0]
for i in range(1,N):
    res *= A[i]
    if res > 10**18:
        print(-1)
        exit()
print(res)
### BUGGY CODE ###

n = int(input())
s = input()
tmp = set()
for i in range(n-2):
  for j in range(i+1,n-1):
    for k in range(j+1, n):
      tmp.add(s[i] + s[j] + s[k])
print(len(tmp))

### FIXED CODE ###

n = int(input())
s = input()
tmp = set()
si = set()
for i in range(n-2):
  if s[i] in si:
    continue
  else:
    si.add(s[i])
    sj = set()
    for j in range(i+1,n-1):
      if s[j] in sj:
        continue
      else:
        sj.add(s[j])
        sk = set()
        for k in range(j+1, n):
          if k in sk:
            continue
          else:
            sk.add(s[k])
       	    tmp.add(s[i] + s[j] + s[k])
print(len(tmp))
### BUGGY CODE ###

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

for i in range(n):
    ary.append(a[i]-1)
    ary.append(a[i])
    ary.append(a[i]+1)

maxcount = 1
for i in range(10**5):
    if ary.count(i) > maxcount:
        maxcount = ary.count(i)

print(maxcount)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ary = [0 for _ in range(10**5)]

for i in range(n):
    if a[i] > 1:
        ary[a[i]-2] += 1
        ary[a[i]-1] += 1
    ary[a[i]] += 1

print(max(ary))
### BUGGY CODE ###

#!/usr/bin/env python3
#ABC117 C

n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
#print(x)
if n >= m:
    print(0)
    quit()
y = [x[i+1]-x[i] for i in range(m-1)]
#print(y)
for i in range(n-1):
    y.remove(max(y))
print(sum(y))


### FIXED CODE ###

#!/usr/bin/env python3
#ABC117 C

n,m = map(int,input().split())
x = list(map(int,input().split()))
x.sort()
#print(x)
if n >= m:
    print(0)
    quit()
y = [x[i+1]-x[i] for i in range(m-1)]
y.sort()
y.reverse()
#print(y)
print(sum(y[n-1:]))
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input() 
data = [ tuple(map(int, input().split())) for _ in range(Q) ] 

indexList = [0 for _ in range(N)]
index = -1
while True:
	index = S.find("AC", index+1)

	if index == -1:
		break
	
	indexList[index] = 1

# print(indexList)

for (l, r) in data:
	# print(indexList[l-1: r-1])
	print(sum(indexList[l-1: r-1]))

### FIXED CODE ###

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

t = [0] * (N + 1) 

for i in range(N):
	t[i+1] = t[i] + (1 if S[i:i+2] == "AC" else 0)

for i in range(Q):
	l, r = map(int, input().split())
	print(t[r-1] - t[l-1])
### BUGGY CODE ###

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

ans = 0
# 各ビット独立で考える
for i in range(60):
    bit = 1 << i
    cnt1 = 0
    for a in A:
        # このビットが立っている場所を数える
        if a & bit:
            cnt1 += 1
    cnt0 = N - cnt1
    # 0ビットの数 * 1ビットの数 で1になるペア数
    cnt = cnt0 * cnt1 % MOD
    ans += cnt * bit % MOD
print(ans%MOD)


### FIXED CODE ###

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

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

ans = 0
# 各ビット独立で考える
for i in range(60):
    bit = 1 << i
    cnt1 = 0
    for a in A:
        # このビットが立っている場所を数える
        if a & bit:
            cnt1 += 1
    cnt0 = N - cnt1
    # 0ビットの数 * 1ビットの数 で1になるペア数
    cnt = cnt0 * cnt1 % MOD
    ans += cnt * bit % MOD
print(ans%MOD)
### BUGGY CODE ###

n = int(input())
ans = 1
for i in range(1, n+1):
    ans *= i
print(ans % 1000000007)


### FIXED CODE ###

n = int(input())
ans = 1
for i in range(1, n+1):
    ans = (ans*i) % 1000000007
print(ans)
### BUGGY CODE ###

qt = int(input())
sl = [input() for i in range(qt)]
ls = []
count = 0

for s in sl:
    s = "".join(sorted(s))
    ls.append(s)

i = 0
j = 0
key = ""

while len(ls) > i:
    while len(ls) > (j + 1):
        j += 1
        if ls[i] == ls[j]:
            count += 1
    i += 1
    j = i

print(count)


### FIXED CODE ###

import math as m

qt = int(input())
sl = [input() for i in range(qt)]
d = {}
count = 0

for s in sl:
    s = "".join(sorted(s))
    if s in d:
        d[s] += 1
    else:
        d[s] = 1

for e in d.values():
    if e > 1:
        count += m.factorial(e) // (m.factorial(e - 2) * 2)

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

import sys

sys.setrecursionlimit(5001)
MOD = 10 ** 9 + 7

n = int(input())
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    links[x].add(y)
    links[y].add(x)

double_factorial_odd = [0] * (n // 2)
prev = 1
for i in range(n // 2):
    prev = double_factorial_odd[i] = (2 * i + 1) * prev % MOD


def dfs(v, p):
    ret = [0, 1]
    for u in links[v]:
        if u == p:
            continue
        res = dfs(u, v)
        lt, ls = len(ret), len(res)
        mrg = [0] * (lt + ls - 1)
        for i in range(1 - lt % 2, lt, 2):
            c = ret[i]
            for j in range(1 - ls % 2, ls, 2):
                mrg[i + j] = (mrg[i + j] + c * res[j]) % MOD
        ret = mrg

    if len(ret) % 2 == 1:
        ret[0] = -sum(pattern * df % MOD for pattern, df in zip(ret[2::2], double_factorial_odd)) % MOD

    return ret


print(MOD - dfs(0, -1)[0])


### FIXED CODE ###

import sys

sys.setrecursionlimit(5001)
MOD = 10 ** 9 + 7

n = int(input())
links = [set() for _ in range(n)]
for line in sys.stdin.readlines():
    x, y = map(int, line.split())
    x -= 1
    y -= 1
    links[x].add(y)
    links[y].add(x)

double_factorial_odd = [0] * (n // 2)
prev = 1
for i in range(n // 2):
    prev = double_factorial_odd[i] = (2 * i + 1) * prev % MOD


def dfs(v, p):
    ret = [0, 1]
    for u in links[v]:
        if u == p:
            continue
        res = dfs(u, v)
        lt, ls = len(ret), len(res)
        mrg = [0] * (lt + ls - 1)
        for i in range(1 - lt % 2, lt, 2):
            c = ret[i]
            for j in range(1 - ls % 2, ls, 2):
                mrg[i + j] = (mrg[i + j] + c * res[j]) % MOD
        ret = mrg

    if len(ret) % 2 == 1:
        ret[0] = -sum(pattern * df % MOD for pattern, df in zip(ret[2::2], double_factorial_odd)) % MOD

    return ret


print(MOD - dfs(0, -1)[0])
### BUGGY CODE ###

a,b,m=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t=[[0,0,0] for i in range(m)]
for i in range(m):
    a, b,c = map(int, input().split())
    t[i][0]=a
    t[i][1]=b
    t[i][2]=c
k=A[0]+B[0]
for i in range(a):
    for j in range(b):
        if A[i]+B[j]<k:
            k=A[i]+B[j]
for i in range(m):
    if A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]<k:
        k=A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]
print(k)

### FIXED CODE ###

a,b,m=map(int,input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
t=[[0,0,0] for i in range(m)]
for i in range(m):
    a, b,c = map(int, input().split())
    t[i][0]=a
    t[i][1]=b
    t[i][2]=c
k=min(A)+min(B)
for i in range(m):
    if A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]<k:
        k=A[t[i][0]-1]+B[t[i][1]-1]-t[i][2]
print(k)
### BUGGY CODE ###

from collections import defaultdict

s = input()
K = int(input())

seq_dic = defaultdict(list)
cnt_dic = defaultdict(int)
l = len(s)

for i, x in enumerate(s):
    target = s[i:]

    cnt = 0
    if x not in seq_dic:
        cnt += len(target)
    else:
        for r in seq_dic[x]:
            for j in range(min(len(target), len(r))):
                if target[j] != r[j]:
                    cnt += len(target) - j
                    break

    seq_dic[x].append(target)
    cnt_dic[x] += cnt

cnt = 0
prev_cnt = 0
moji = ''
for i in range(26):
    moji = chr(97 + i)
    c = cnt_dic[moji]
    cnt += c

    if K <= cnt:
        break

    prev_cnt = cnt


seq = set()
for i, n in enumerate(s):
    if n == moji:
        for j in range(i + 1, l + 1):
            seq.add(s[i:j])

seq = list(seq)
seq.sort()

print(seq[K - prev_cnt - 1])

### FIXED CODE ###

s = input()
K = int(input())

seq = set()
l = len(s)
for i in range(l):
    for j in range(1, K + 1):
        seq.add(s[i:i + j])

seq = list(seq)
seq.sort()
print(seq[K - 1])
### BUGGY CODE ###

def main():
    n = int(input())
    s = input().rstrip()
    dp = [[0]*(i+1) for i in range(n)]
    for i in range(n):
        for j in range(i+1):
            if s[i] == s[j]:
                dp[i][j] += 1
                if 0 < i and 0 < j:
                    dp[i][j] += dp[i-1][j-1]
                dp[i][j] = min(i-j, dp[i][j])
    print(max(max(dp, key=lambda x: max(x))))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def check(x, N, S):
    candidate = set()
    for i in range(N - 2*x + 1):
        candidate.add(S[i:i+x])
        if S[i+x:i+2*x] in candidate:
            return True
    return False

def main():
    n = int(input())
    s = input().rstrip()
    l = 0
    r = n
    while l < r:
        mid = (l+r+1) // 2
        if check(mid, n, s):
            l = mid
        else:
            r = mid-1
    print((l+r+1)//2)

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

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

	A = [0]

	for i in range(N):
		A.append(int(input()))

	counter = 1
	index = 1
	judge = [1]
	if A[index] == 2:
		print(counter)
		return
	counter += 1
	index = A[index]
	for i in range(N):
		if A[index] in judge:
			print("-1")
			return
		if A[index] == 2:
			print(counter)
			return
		counter += 1
		judge.append(A[index])
		index = A[index]
	

training()
	

### FIXED CODE ###

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

	A = [0]

	for i in range(N):
		A.append(int(input()))

	counter = 1
	index = 1
	#judge = [1]
	if A[index] == 2:
		print(counter)
		return
	counter += 1
	index = A[index]
	for i in range(N):
		#if A[index] in judge:
			#print("-1")
			#return
		if A[index] == 2:
			print(counter)
			return
		counter += 1
		#judge.append(A[index])
		index = A[index]
	print("-1")
	

training()
### BUGGY CODE ###

s = input()
k=int(input())
def ss(s,k):
    M=len(s)
    l=[]
    for i in range(M):
        for j in range(i+1,M+1):
            tmp = s[i:j]
            l.append(tmp)
    l.sort()
    l=f7(l)
    #print(l)
    ret = l[k-1]
    return(ret)

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

print(ss(s,k))

### FIXED CODE ###

s = input()
k = int(input())

M=len(s)
sss=set()
for i in range(M):
    for j in range(i+1,i+k+1):
        tmp = s[i:j]
        sss.add(tmp)
l = list(sss)
l.sort()
print(l[k-1])
### BUGGY CODE ###

def main():
    n = int(input())
    ans = 0
    for i in range(n):
        x = int(input())
        flag = True
        for j in range(2, x):
            if x % j == 0:
                flag = False
                break
        if flag:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import math


def main():
    n = int(input())
    ans = 0
    for i in range(n):
        x = int(input())
        if x == 2:
            ans += 1
        elif x % 2 == 0:
            pass
        else:
            flag = True
            j = 3
            while j <= math.sqrt(x):
                if x % j == 0:
                    flag = False
                    break
                j += 2
            if flag:
                ans += 1
    print(ans)


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

n,m = map(int,input().split())
a = ([int(input()) for i in range(m)])
inf = 1000000007

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
else:
    dp[1] = 0

for i in range(2,n+1):
    if i in a:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= inf

print(dp[n])

### FIXED CODE ###

n,m = map(int,input().split())
a = set([int(input()) for i in range(m)])
inf = 1000000007

dp = [0] * (n+1)
dp[0] = 1

if 1 not in a:
    dp[1] = 1
else:
    dp[1] = 0

for i in range(2,n+1):
    if i in a:
        continue
    dp[i] = dp[i-1] + dp[i-2]
    dp[i] %= inf

print(dp[n])
### BUGGY CODE ###

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

# 隣接リスト
A = [[] for _ in range(N)]
# 根
root = -1
R = [True]*N

for i in range(N-1+M):
    a,b = map(int,input().split())
    # a -> b
    A[a-1].append(b-1)
    # a -> b のため、bには親がいる
    R[b-1] = False

# 親判定
for i in range(N):
    if R[i]:
        root = i
        break

# 出力すべき木の親を確定させる
P = [-1]*N
P[root] = -1

Q = [root]
while Q!=[]:
    tmpQ = []
    for q in Q:
        for i in A[q]:
            # 親の更新
            P[i] = q
            # 自身をtmpQに
            tmpQ.append(i)
    Q = tmpQ

for i in range(N):
    print(P[i]+1)





### FIXED CODE ###

N,M = map(int,input().split())
AB = [tuple(map(int,input().split())) for _ in range(N-1+M)]

A = [[] for _ in range(N)]
P = [0]*N
C = [0]*N
root = -1

for (a,b) in AB:
    # a -> b
    A[a-1].append(b-1)
    C[b-1] += 1

for i in range(N):
    if C[i]==0:
        root = i
P[root] = -1

from collections import deque
que = deque((a,root) for a in A[root])
while que:
    n,par = que.popleft()
    C[n] -= 1
    if C[n]==0:
        P[n] = par
        for i in A[n]:
            que.append((i,n))

for p in P:
    print(p+1)
### BUGGY CODE ###

from collections import deque
h,w = map(int,input().split())
ch,cw = map(int,input().split())
dh,dw = map(int,input().split())
s = [list(input()) for _ in range(h)]

stack = deque()
stack.append([ch-1,cw-1])
INF=10**12
cost = [[INF]*w for _ in range(h)]
cost[ch-1][cw-1]=0

dxdy = [[1,0],[-1,0],[0,1],[0,-1]]
warp = []
for m in range(-2,3):
    for n in range(-2,3):
        if [m,n] not in [[0,0] + dxdy]:
            warp += [[m,n]]

while stack:
    x,y = stack.pop()
    for dx,dy in dxdy:
        nx,ny = x+dx,y+dy
        if -1<nx<h and -1<ny<w and s[nx][ny]!="#" and cost[x][y]<cost[nx][ny]:
            cost[nx][ny]=cost[x][y]
            stack.append([nx,ny])
            #[print(*cost[l]) for l in range(h)]
            #print("---------------")

    for dx,dy in warp:
        nx,ny = x+dx,y+dy
        if -1<nx<h and -1<ny<w and s[nx][ny]!="#" and cost[x][y]+1<cost[nx][ny]:            
            cost[nx][ny]=cost[x][y]+1
            stack.append([nx,ny])
            #[print(*cost[l]) for l in range(h)]
            #print("---------------")


if cost[dh-1][dw-1]<INF:
    print(cost[dh-1][dw-1])
else:
    print(-1)


### FIXED CODE ###

from collections import deque
h,w = map(int,input().split())
ch,cw = map(int,input().split())
dh,dw = map(int,input().split())
s = [list(input()) for _ in range(h)]
INF=10**7

queue = deque()

cost = [[INF]*w for _ in range(h)]
cost[ch-1][cw-1]=0

dxdy = [[1,0],[-1,0],[0,1],[0,-1]]
warp = []
for m in range(-2,3):
    for n in range(-2,3):
        if [m,n] not in [[0,0],[1,0],[-1,0],[0,1],[0,-1]]:
            warp += [[m,n]]

queue.append([ch-1,cw-1,0])

while queue:
    x,y,d = queue.popleft()
    for dx,dy in dxdy:
        nx,ny = x+dx,y+dy
        if -1<nx<h and -1<ny<w and s[nx][ny]!="#" and d<cost[nx][ny]:
            cost[nx][ny]=d
            queue.appendleft([nx,ny,d])
            #[print(*cost[l]) for l in range(h)]
            #print("---------------")

    for dx,dy in warp:
        nx,ny = x+dx,y+dy
        if -1<nx<h and -1<ny<w and s[nx][ny]!="#" and d+1<cost[nx][ny]:            
            cost[nx][ny]=d+1
            queue.append([nx,ny,d+1])
            #[print(*cost[l]) for l in range(h)]
            #print("---------------")


if cost[dh-1][dw-1]<INF:
    print(cost[dh-1][dw-1])
else:
    print(-1)
### BUGGY CODE ###

N,M = map(int,input().split())
root1 = []
root2 = []
for i in range(M):
    ai,bi = map(int,input().split())
    if ai==1:
        tmp = [ai,bi]
        root1.append(tmp)
    else:
        tmp = [ai,bi]
        root2.append(tmp)
for i in range(len(root1)):
    for j in range(len(root2)):
        if root1[i][1]==root2[j][0]:
            if root2[j][1]==N:
                print('POSSIBLE')
                exit()
print('IMPOSSIBLE')

### FIXED CODE ###

N,M = map(int,input().split())
root1 = set()
root2 = set()
for i in range(M):
    ai,bi = map(int,input().split())
    if ai==1:
        root1.add(bi)
    if bi==N:
        root2.add(ai)
if set(root1) & set(root2):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

N=int(input())
numbers=[]
for _ in range(N):
    X,L=map(int,input().split())
    left=X-L
    right=X+L
    numbers.append([right,left])
numbers=sorted(numbers)
answer=1
for  _ in range(len(numbers)-1):
    if numbers[answer][0]>numbers[answer-1][0] and numbers[answer][1]>=numbers[answer-1][0]:
        answer+=1
    else:
        del numbers[answer]
print(answer)


### FIXED CODE ###

N=int(input())
numbers=[]
for _ in range(N):
    X,L=map(int,input().split())
    left=X-L
    right=X+L
    numbers.append([right,left])
numbers=sorted(numbers)
answer=1
large=numbers[0][0]
for  _ in range(len(numbers)-1):
    if numbers[answer][0]>large and numbers[answer][1]>=large:
        large=numbers[answer][0]
        answer+=1
    else:
        del numbers[answer]
print(answer)