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

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

b = a[1] - a[0]
for i in range(n):
    for j in range(i+1 , n):
        if b < a[j] - a[i]:
            b = a[j] - a[i]

print(b)




### FIXED CODE ###

n = int(input())
a = []
for i in range(n):
    a.append(int(input()))

mini = a[0]
b = -10000000000
del a[0]
for i in a:
    if b < i - mini:
        b = i - mini
    if mini > i:
        mini = i

print(b)
### BUGGY CODE ###

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

count1 = 0
for i in range(N):
    for j in range(i + 1, N):
        if A[i] == minA:
            continue
        if A[i] > A[j]:
            count1 += 1

A2 = A + A[::]
# count2 = 0
# for i in range(N * 2):
#     for j in range(i + 1, N * 2):
#         if A2[i] > A2[j]:
#             count2 += 1

count2 = count1
for i in range(N):
    for j in range(i + 1, N * 2):
        if A2[i] == minA:
            continue
        if A2[i] > A2[j]:
            count2 += 1

A3 = A + A[::] + A[::]
# count3 = 0
# for i in range(N * 3):
#     for j in range(i + 1, N * 3):
#         if A3[i] > A3[j]:
#             count3 += 1

count3 = count2
for i in range(N):
    for j in range(i + 1, N * 3):
        if A3[i] == minA:
            continue
        if A3[i] > A3[j]:
            count3 += 1

diff1 = count2 - count1
diff2 = count3 - count2
diffx = diff2 - diff1

bn_last = diff1 + diffx * (K - 2)
bn_sum = ((diff1 + bn_last) * (K - 1)) // 2
an_sum = count1 + bn_sum

if K == 1:
    print(count1)
elif K == 2:
    print(count2)
else:
    print(an_sum % ((10 ** 9) + 7))


### FIXED CODE ###

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

count1 = 0
for i in range(N):
    for j in range(i + 1, N):
        if A[i] > A[j]:
            count1 += 1

count2 = 0
for i in range(N):
    for j in range(N):
        if A[i] > A[j]:
            count2 += 1

# print(count1)
# print(count2)

ans = K * count1 + (count2 * K * (K - 1)) // 2
ans = ans % ((10 ** 9) + 7)
print(ans)
### BUGGY CODE ###

N, M = map(int, input().split())
L = [list(input().split()) for i in range(M)]
P = []
S = [0] * (N + 1)
for i in L:
  s, p = int(i[0]), i[1]
  if s not in P:
    if p == 'AC':
      P.append(s)
    else:
      S[s] += 1
A = sum([S[i] for i in P])
print(len(P), A)

### FIXED CODE ###

N, M = map(int, input().split())
P = [0] * (N + 1)
S = [0] * (N + 1)
for i in range(M):
  x, p = input().split()
  s = int(x)
  if P[s] == 0:
    if p == 'AC':
      P[s] = 1
    else:
      S[s] += 1
A = sum([S[i] for i in range(N + 1) if P[i] == 1])
print(P.count(1), A)
### BUGGY CODE ###

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

m = max(p)
cnt = 1
for i in range(1,n):
	if m > min(p[0:i]):
		m = min(p[0:i])
	if m >= p[i]:
		cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 1
m = p[0]
for i in range(1,n):
	if m > p[i-1]:
		m = p[i-1]
	if m >= p[i]:
		cnt += 1
	#print(cnt,i)
	#print(p[0:i],p[i])
print(cnt)
### BUGGY CODE ###

def road(n):
  for _ in range(n):
    A,B = map(int,input().split())
    yield A,B
  
def main():
  N,M = map(int,input().split())
  h = list(map(int,input().split()))
  num = list(range(1,N+1))
  X = list(road(M))
  for A,B in X:
    if B in num and h[A-1] > h[B-1] :
      num.remove(B)
    elif A in num and h[A-1] < h[B-1] :
      num.remove(A)
    elif h[A-1] == h[B-1]:
      if A in num and B in num:
        num.remove(A)
        num.remove(B)
      elif A in num and not B in num:
        num.remove(A)
      elif B in num and not A in num:
        num.remove(B)
  return len(num)

print(main())

### FIXED CODE ###

n,m = map(int,input().split())
h = list(map(int,input().split()))
cnt = [0]*n
chk = [0]*n
ans = 0

for i in range(m):
  a,b = map(int, input().split())
  if h[a-1] > h[b-1]:
    cnt[a-1] += 1
  elif h[a-1] < h[b-1]:
    cnt[b-1] += 1
  chk[a-1] += 1
  chk[b-1] += 1
  
for i in range(n):
  if cnt[i] == chk[i]:
    ans += 1
    
print(ans)
### BUGGY CODE ###

n=int(input())
s=0
for i in range(n):
    a=int(input())
    c=0
    for j in range(2,a+1):
        if a%j==0:
            break
        c+=1
    if c==a-2:
       s+=1
print(s)

### FIXED CODE ###

import math
n=int(input())
s=0
for i in range(n):
    a=int(input())
    b=math.ceil(a**0.5)
    if a==2:
        s+=1
    elif a%2==0 or a < 2:
        continue
    else:
        c=0
        for j in range(3,b+1,2):
            if a%j==0:
                c+=1
                break
        if c==0:
            s+=1
print(s)
### BUGGY CODE ###

import sys
input = sys.stdin.readline


def read():
    N, K = map(int, input().strip().split())
    P = [0] + list(map(int, input().strip().split()))
    C = [0] + list(map(int, input().strip().split()))
    return N, K, P, C


def solve(N, K, P, C):
    max_score = -10**9
    # スコアの累積和
    for i in range(1, N+1):
        # スコアの累積和
        D = [0 for i in range(N+1)]
        # 1周の長さ
        size = 0
        # 1周のスコアの最大値: D[size]
        j = i
        score = 0
        while True:
            size += 1
            j = P[j]
            D[size] = D[size-1] + C[P[j]]
            if i == j:
                break
        round_score = D[size]
        for i in range(1, min(K, size)+1):
            max_score = max(max_score, D[i])
        # 周回してみる
        if D[size] > 0 and K > size:
            base_score = round_score * ((K // size)-1)
            max_score = max(max_score, base_score)
            for i in range(1, size+1):
                max_score = max(max_score, base_score + D[i])
            base_score = round_score * (K // size)
            for i in range(1, min(K%size, size)+1):
                max_score = max(max_score, base_score + D[i])
    return max_score


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))


### FIXED CODE ###

import sys
input = sys.stdin.readline


def read():
    N, K = map(int, input().strip().split())
    P = [0] + list(map(int, input().strip().split()))
    C = [0] + list(map(int, input().strip().split()))
    return N, K, P, C


def solve(N, K, P, C):
    max_score = -10**9
    # スコアの累積和
    for i in range(1, N+1):
        # スコアの累積和
        D = [0 for i in range(N+1)]
        # 1周の長さ
        size = 0
        # 1周のスコアの最大値: D[size]
        j = i
        score = 0
        while True:
            size += 1
            j = P[j]
            D[size] = D[size-1] + C[P[j]]
            if i == j:
                break
        round_score = D[size]
        for i in range(1, min(K, size)+1):
            max_score = max(max_score, D[i])
        # 周回してみる
        if D[size] > 0 and K > size:
            base_score = round_score * ((K // size)-1)
            max_score = max(max_score, base_score)
            for i in range(1, size+1):
                max_score = max(max_score, base_score + D[i])
            base_score = round_score * (K // size)
            for i in range(1, min(K%size, size)+1):
                max_score = max(max_score, base_score + D[i])
    return max_score


if __name__ == '__main__':
    inputs = read()
    outputs = solve(*inputs)
    if outputs is not None:
        print("%s" % str(outputs))
### BUGGY CODE ###

N = int(input())
S = [input() for _ in range(N)]
list = []
for i in range(N):
    if not S[i] in list:
        list.append(S[i])
print(len(list))

### FIXED CODE ###

N = int(input())
S = [input() for _ in range(N)]
dict = {}
for i in range(N):
    if S[i] not in dict:
        dict[S[i]] = 1
print(len(dict))
### BUGGY CODE ###

n = int(input())
frag = 10**18
a = list(map(int,input().split()))
  
ans = 1

for i in range(n):
  if(a[i] == 0):
    ans = 0
    break
  ans = ans * a[i]
    
if(ans > frag):
    ans = -1

print(ans)

### FIXED CODE ###

n = int( input() )
A = list( map( int,input().split() ) )
 
if 0 in A:
  print( 0 )
else:
  ret = 1
  for a in A:
    ret = ret * a
    if ret > 10 ** 18:
      ret = -1
      break
  print( ret )
### BUGGY CODE ###

import heapq
n,m=map(int,input().split())
a=list(map(int,input().split()))
heapq.heapify(a)
for i in range(m):
  b,c=map(int,input().split())
  for j in range(b):
    x=a[0]
    if x<c:
      heapq.heappop(a)
      heapq.heappush(a, c)
    else:
      break
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c=map(int,input().split())
  d.append([b,c])
d=sorted(d, key=lambda x: x[1], reverse=True)
i=0
j=d[0][1]
k=0
while a[i]<j:
  a[i]=j
  d[k][0]-=1
  if d[k][0]==0:
    k+=1
    if k==m:
      break
    else:
      j=d[k][1]
  i+=1
  if i==n:
    break
print(sum(a))
### BUGGY CODE ###

a ,b, k = map(int,input().split())
ans = []

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

### FIXED CODE ###

a ,b, k = map(int,input().split())
ans = []
if (b - a) // 2 < k:
    for i in range(a , b + 1):
        print(i)
else:
    for i in range(k):
        ans.append(a + i)
    for i in range(k):
        i = k - i -1
        ans.append(b - i)
    ans = sorted(set(ans))
    for i in ans:
        print(i)
### BUGGY CODE ###

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

def zenbu(m, B):
    if m == 1:
        return B[0]
    elif m == 2:
        return max(B[0],B[1])
    elif m == 3:
        return max(B[0],B[1],B[2])
    elif m%2 == 0: #偶数の場合
        temp = 0
        for i in range(m//2-1):
            temp += B[i*2]
        return max(temp+ max(B[m-2],B[m-1]), zenbu(m-2, B)+ B[m-1])
    else:#奇数の場合
        temp = 0
        for i in range((m-1)//2):
            temp += B[i*2]
        return max(temp, zenbu(m-2,B)+ B[m-1], zenbu(m-3,B)+ max(B[m-2],B[m-1]))

ans = zenbu(n,A)

print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
N = int(input())
A = list(map(int,input().split()))
if N%2 == 0:
  dp = [[0]*2 for _ in range(N)] #0index
  dp[0][0] = A[0]
  dp[1][1] = A[1]
  for i in range(2,N):
    dp[i][0] = dp[i-2][0]+A[i]
    if i-3>=0:
      dp[i][1] = max(dp[i-2][1],dp[i-3][0])+A[i]
    else:
      dp[i][1] = max(dp[i-2][1],0)+A[i]
  ans = max(dp[-2][0],dp[-1][1])
  print(ans)
#i個目を使ってj(0-2)回多く飛んでいる。
else: #N%2 == 1:
  dp = [[0]*3 for _ in range(N)] #0index
  dp[0][0] = A[0]
  dp[1][1] = A[1]
  dp[2][2] = A[2]
  dp[2][0] = A[0]+A[2]
  #print(dp)
  for i in range(3,N):
    dp[i][0] = dp[i-2][0]+A[i]
    if i-3 >= 0:
      dp[i][1] = max(dp[i-2][1],dp[i-3][0])+A[i]
    else:
      dp[i][1] = max(dp[i-2][1],0)+A[i]
    if i-4 >= 0:
      dp[i][2] = max(dp[i-2][2],dp[i-3][1],dp[i-4][0])+A[i]
    elif i-3 >= 0:
      dp[i][2] = max(dp[i-2][2],dp[i-3][1],0)+A[i]
  #else:
  #  dp[i][2] = max(dp[i-2][2],0,0)+A[i]
  #print(dp[-1],dp[-2],dp[-3])

  ans = max(dp[-3][0],dp[-2][1],dp[-1][2])
  print(ans)
  exit()
### BUGGY CODE ###

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

import sys
from collections import deque

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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H,W=MAP()

que = deque()
# 右左上下
directions = [(0,1),(0,-1),(1,0),(-1,0)]
# 四方に一回り大きいグリッドを作る
grid = list2d(H+2, W+2, '*')
for i in range(1,H+1):
    row = list(input())
    for j in range(1, W+1):
        grid[i][j] = row[j-1]
        if grid[i][j]=='#':
            que.append((i, j))

cnt=0
while len(que)!=0:
    ln=len(que)
    for i in range(ln):
        cur=que.popleft()
        # 4方向見る
        for direction in directions:
            nxt = list(map(lambda x,y: x+y, cur, direction))
            # 壁と黒はスキップ
            if grid[nxt[0]][nxt[1]]=='*' or grid[nxt[0]][nxt[1]]=='#':
                continue
            # 白を埋める
            if grid[nxt[0]][nxt[1]]=='.':
                grid[nxt[0]][nxt[1]]='#'
                que.append(nxt)
    cnt+=1
print(cnt-1)


### FIXED CODE ###

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

import sys
from collections import deque

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 ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

H,W=MAP()

que = deque()
# 右左上下  
directions = [(0,1),(0,-1),(1,0),(-1,0)]
# 四方に一回り大きいグリッドを作る
grid = list2d(H+2, W+2, '*')
for i in range(1,H+1):
    row = list(input())
    for j in range(1, W+1):
        grid[i][j] = row[j-1]
        if grid[i][j] == '#':
            que.append((i, j, 0))

# 移動距離メモ
memo=[[-1]*(W+2) for i in range(H+2)]
while len(que):
    cur=que.popleft()
    if memo[cur[0]][cur[1]]!=-1:
        continue
    memo[cur[0]][cur[1]]=cur[2]
    # 4方向見る
    for direction in directions:
        x=cur[0]+direction[0]
        y=cur[1]+direction[1]
        # 壁と黒はスキップ
        if grid[x][y]=='*' or grid[x][y]=='#':
            continue
        # 白を埋める
        if grid[x][y]=='.':
            grid[x][y]='#'
            que.append((x, y, cur[2]+1))
ans=0
for i in range(1, H+1):
        ans=max(ans, max(memo[i]))
print(ans)
### BUGGY CODE ###

N = int(input())
L = list(map(int, input().split()))
A = []
ans = 1

if N % 2 == 0:
  for i in range (N//2):
    A.append(L[i]*L[-1-i])
  for j in range(N//2):
    ans *= A[j]
  
else:
  for i in range(N//2):
    A.append(L[i]*L[-1-i])
  for j in range(N//2):
    ans *= A[j]
  ans *= L[N//2+1]
  
if ans > 10**18:
  print(-1)
else:
  print(ans)
    

### FIXED CODE ###

N = int(input())
L = list(map(int, input().split()))
A = []
ans = 1
L.sort()

for i in range (N):
  ans*= L[i]
  if ans == 0 or ans > 10**18:
    break
if ans > 10**18:
  print(-1)
else:
  print(ans)
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
B=A
for i in range(N):
  x=A[i]
  A.pop(i)
  S=list(set(A))
  sum=0
  for j in range(len(S)):
    a=A.count(S[j])
    if a!=1:
      sum+=a*(a-1)//2
  A.insert(i,x)
  print(sum)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[0]*n
cnt=0
for i in a:
  b[i-1]+=1
for i in b:
  cnt+=i*(i-1)//2
for i in a:
  print(cnt+(1-b[i-1]))
### BUGGY CODE ###

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

total = 0
for i in range(N-1):
    for j in range(N-i-1):
        total += A[i]*A[i+j+1]
        total %= 1000000007

print(total)

### FIXED CODE ###

mod = 10**9 + 7
  
N = int(input())
A = [int(i)%mod for i in input().split()][:N]

wa = sum(A)

total = 0
for n in range(N-1):
    wa -= A[n]

    total += A[n] * wa
    total %= mod

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

N=int(input())
A=list(map(int,input().split()))
h=[0]
for a in A:
    h.append(a+h[-1])
h.pop(0)
def spl_l(i,b):
    while abs(h[i]-2*h[b])>abs(h[i]-2*h[b+1]):
        b+=1
    return b
def spl_r(i,b):
    while abs(h[-1]-2*h[b]+h[i])>abs(h[-1]-2*h[b+1]+h[i]):
        b+=1
    return b
def calc(j,i,k,h):
    j=spl_l(i,j)
    k=spl_r(i,k)
    pqrs=[h[j],h[i]-h[j],h[k]-h[i],h[-1]-h[k]]
    ans=max(pqrs)-min(pqrs)
    return ans

j=0
k=2
ans=calc(j,1,k,h)
for i in range(2,N-2):
    ans=min(ans,calc(j,i,k,h))
print(ans)


### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
h=[0]
for a in A:
    h.append(a+h[-1])
h.pop(0)
def spl_l(i,b):
    while abs(h[i]-2*h[b])>abs(h[i]-2*h[b+1]):
        b+=1
    return b
def spl_r(i,b):
    while abs(h[-1]-2*h[b]+h[i])>abs(h[-1]-2*h[b+1]+h[i]):
        b+=1
    return b
def calc(j,i,k):
    pqrs=[h[j],h[i]-h[j],h[k]-h[i],h[-1]-h[k]]
    ans=max(pqrs)-min(pqrs)
    return ans

j=0
k=2
ans=18**20
for i in range(1,N-2):
    j=spl_l(i,j)
    k=spl_r(i,k)
    ans=min(ans,calc(j,i,k))
print(ans)
### BUGGY CODE ###

import math
from collections import deque
S = input()
index = []
L_kyoukai = []
R_kyoukai = [0]
flag = False
for i in range(1, len(S)):
    if flag is False and S[i] == "L":
        L_kyoukai.append(i)
        R_kyoukai.append(i - 1)
        index.append(i - 1)
        index.append(i)
        flag = True
    if flag is True and S[i] == "R":
        L_kyoukai.append(i - 1)
        R_kyoukai.append(i)
        flag = False
ans = []
L_kyoukai.append(len(S) - 1)
r_diff = [R_kyoukai[i + 1] - R_kyoukai[i] + 1 for i in range(0, len(R_kyoukai), 2)]
l_diff = [L_kyoukai[i + 1] - L_kyoukai[i] + 1 for i in range(0, len(L_kyoukai), 2)]
for r, l in zip(r_diff, l_diff):
    tmp_1 = math.ceil(r / 2)
    tmp_2 = math.ceil(l / 2)
    ans.append(tmp_1 + l - tmp_2)
    ans.append(r - tmp_1 + tmp_2)
q = deque(ans)    
answer = ""
for i in range(len(S)):
    if i in index:
        answer += str(q.popleft())
        answer += " "
    else:
        answer += "0 "
print(answer)        

### FIXED CODE ###

import math
from collections import deque
S = input()
L_kyoukai = []
R_kyoukai = [0]
flag = False
for i in range(1, len(S)):
    if flag is False and S[i] == "L":
        L_kyoukai.append(i)
        R_kyoukai.append(i - 1)
        flag = True
    if flag is True and S[i] == "R":
        L_kyoukai.append(i - 1)
        R_kyoukai.append(i)
        flag = False
ans = []
L_kyoukai.append(len(S) - 1)
r_diff = [R_kyoukai[i + 1] - R_kyoukai[i] + 1 for i in range(0, len(R_kyoukai), 2)]
l_diff = [L_kyoukai[i + 1] - L_kyoukai[i] + 1 for i in range(0, len(L_kyoukai), 2)]
for r, l in zip(r_diff, l_diff):
    tmp_1 = math.ceil(r / 2)
    tmp_2 = math.ceil(l / 2)
    ans.append(tmp_1 + l - tmp_2)
    ans.append(r - tmp_1 + tmp_2)
q = deque(ans)    
answer = ""

for i in range(len(S)):
    if 1 <= i <= len(S) - 2:
        if (S[i] == "L" and S[i - 1] == "R") or (S[i] == "R" and S[ i + 1] == "L"):
            answer += str(q.popleft())
            answer += " "
        else:
            answer += "0 "
    elif i == 0:
        if S[i + 1] == "L":
            answer += str(q.popleft())
            answer += " "
        else:
            answer += "0 "
    elif i == len(S) - 1:
        if S[i - 1] == "R":
            answer += str(q.popleft())
            answer += " "
        else:
            answer += "0 "

print(answer)
### BUGGY CODE ###

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

for i in range(n):
    res = res * a[i]
    
if res > 1000000000000000000:
    res = -1

print(res)

### FIXED CODE ###

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

if 0 not in a:

    for i in range(n):
        res = res * a[i]
        
        if res > 1000000000000000000:
            res = -1
            break
else:
    res = 0

print(res)
### BUGGY CODE ###

from collections import defaultdict

def to_dict(s):
    res = defaultdict(int)
    for i in range(0, len(s)):
        c = s[i]
        res[c] = res[c] + 1

    return res

def same_dict(d1, d2):
    for k, v in d1.items():
        if k not in d2:
            return False
        if d1[k] != d2[k]:
            return False

    return True

N = int(input())
s_dicts = []

for i in range(0, N):
    s_dicts.append(to_dict(input()))

count = 0

for i in range(0, N):
    for j in range(i+1, N):
        if same_dict(s_dicts[i], s_dicts[j]):
            count = count + 1

print(count)

### FIXED CODE ###

N = int(input())
d = dict()

for i in range(0, N):
    si = input()
    si_sorted = "".join(sorted(list(si)))
    if si_sorted in d:
        d[si_sorted] = d[si_sorted] + 1
    else:
        d[si_sorted] = 1

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

print(res)
### BUGGY CODE ###

a,b,c,d=map(int, input().split())
div_c=[]
div_d=[]
div_cd=[]
for i in range(a,b+1):
    if i%c==0 and i%d==0:
        div_cd.append(i)
    if i%c==0:
        div_c.append(i)
    if i%d==0:
        div_d.append(i)
print(b-a+1-len(div_c)-len(div_d)+len(div_cd))

### FIXED CODE ###

import fractions
def lcm(x, y):
    return (x * y) // fractions.gcd(x, y)

A,B,C,D=map(int, input().split())

#CとDの最小公倍数
LCM=lcm(C,D)
#A未満でCで割れる個数
Ac=(A-1)//C
#範囲内でCで割れる個数
div_C=B//C-Ac
#A未満でDで割れる個数
Ad=(A-1)//D
#範囲内でDで割れる個数
div_D=B//D-Ad
#A未満でLCMで割れる個数
Alcm=(A-1)//LCM
#範囲内でLCMで割れる個数
div_CD=B//LCM-Alcm
#解答
Ans=(B-A+1)-div_C-div_D+div_CD
print(Ans)
### BUGGY CODE ###

n = int(input())+1
a = list(map(int, input().split()))
cnt = []

sum = 0
for i in range(100005):
    cnt.append(a.count(i))
    sum += i * cnt[i]

q = int(input())
ans = []

for i in range(q):
    b, c = map(int, input().split())
    sum += (c-b)*cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    ans.append(sum)

for i in ans:
    print(i)






### FIXED CODE ###

n = int(input())+1
a = list(map(int, input().split()))
cnt = []
for i in range(100005):
    cnt.append(0)
sum = 0

for i in a:
    cnt[i] += 1
for i in range(100005):
    sum += i * cnt[i]

q = int(input())

for i in range(q):
    b, c = map(int, input().split())
    sum += (c-b)*cnt[b]
    cnt[c] += cnt[b]
    cnt[b] = 0
    print(sum)
### BUGGY CODE ###

W,H = map(int,input().split())
PQ = [(int(input()),0,i) for i in range(W)] + [(int(input()),1,i) for i in range(H)]
PQ.sort()

import sys
sys.setrecursionlimit(10**7)

class UnionFind:
    def __init__(self):
        self.Parent = {}
    def add(self,k):
        self.Parent[k] = k
    def get_Parent(self,n):
        if self.Parent[n] == n:return n
        p = self.get_Parent(self.Parent[n])
        self.Parent[n] = p
        return p
    def merge(self,x,y):
        x = self.get_Parent(x)
        y = self.get_Parent(y)
        if x!=y: self.Parent[y] = x
        return
    def is_united(self,x,y):
        return self.get_Parent(x)==self.get_Parent(y)

ans = 0
T = UnionFind()
for i in range(W+1):
    for j in range(H+1):
        T.add((i,j))
for c,pq,ij in PQ:
    if pq==0:
        i = ij
        for j in range(H+1):
            if not T.is_united((i,j),(i+1,j)):
                T.merge((i,j),(i+1,j))
                ans += c
    else:
        j = ij
        for i in range(W+1):
            if not T.is_united((i,j),(i,j+1)):
                T.merge((i,j),(i,j+1))
                ans += c
print(ans)

### FIXED CODE ###

W,H = map(int,input().split())
PQ = [(int(input()),0) for _ in [0]*W] + [(int(input()),1) for _ in [0]*H]
PQ.sort()
r = H+1
c = W+1
ans = 0
for d,pq in PQ:
    if pq==0:
        ans += d*r
        c -=1
    else:
        ans += d*c
        r -=1
print(ans)
### BUGGY CODE ###

N = int(input())
# X = []
# L = []
# for _ in range(N):
#   x, l = map(int, input().split()))
#   X.append(x)
#   L.append(l)

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


A = []
B = []
for _ in range(N):
  x, l = map(int, input().split())
  A.append(x - l)
  B.append(x + l - 1)

l = []
ans = 0
for i in range(N):
  count = 0
  for j in range(N):
    if i == j:
      continue
    else:
      if A[i] <= A[j] <= B[i] or A[i] <= B[j] <= B[i]:
        count += 1
  l.append(count)
print(N - l.count(max(l)) if max(l) != 0 else N)

### FIXED CODE ###

N = int(input())
robot = []
for _ in range(N):
  r = []
  x, l = map(int, input().split())
  a = x + l - 1
  b = x - l
  r += [a, b]
  robot.append(r)
Robot = sorted(robot)

robot_count = [Robot[0]]
for i in range(1, N):
  if Robot[i][1] > robot_count[-1][0]:
    robot_count.append(Robot[i])

print(len(robot_count))