peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())
a_list = list(map(int, input().split()))
count = len(a_list)
index = count // 2
index -= 1
diff = 2*10**5
while True:
	f_list = a_list[0:index]
	b_list = a_list[index:count]
	if len(f_list) == 0 or len(b_list) == 0:
		index += 1
		continue
	total_1 = sum(f_list)
	total_2 = sum(b_list)
	tmp_diff = abs(total_1 - total_2)
	if diff < tmp_diff:
		break
	diff = tmp_diff
	index += 1
	if index >= count:
		break
print(diff)
# Judge status: Wrong Answer
"""
author : halo2halo
date : 24, Jan, 2020
"""

import sys

# import numpy as np

read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

A, B, C = map(int, readline().split())

print('YES' if A < C and A + B > C else 'NO')
# Judge status: Accepted
n = int(input())
k = int(input())
x = int(input())
y = int(input())
sm = 0
if n<=k:
    sm+=x*n
else:
    sm+=x*k + (n-k)*y
print(sm)
# Judge status: Wrong Answer
l,r,d=map(int,input().split())
if l==d:
  print(r//d-l//d+1)
else:
  print(r//d-l//d)
# Judge status: Accepted
num_list=list(map(int,input().split()))
ans = 0
for i in range(num_list[0]+1):
    str_target = str(i)
    p=0
    for n in str_target:
      p += int(n)
    if num_list[1]<= p and p<=num_list[2]:
        ans += i

print(ans)
# Judge status: Accepted
n = int(input())
a = {}
for i in range(n):
    s = input()
    if s in a:
        a[s] += 1
    else:
        a[s] = 1
a = sorted(a.items(), key=lambda x: x[1], reverse=True)
max_a = a[0][1]
w = []
for i in range(len(a)):
    if a[i][1] == max_a:
        w.append(a[i][0])
    else:
        break
w = sorted(w)
for i in range(len(w)):
    print(w[i])
# Judge status: Accepted
s=str(input())
s=list(s)
ans=["x"]*len(s)
ans="".join(ans)
print(ans)
# Judge status: Accepted
C = [list(map(int, input().split())) for _ in range(3)]

D = [[0,0,0],[0,0,0],[0,0,0]]
for i in range(3):
    for j in range(3):
        D[i][j] = C[i][j] - C[i][j-1]

if D[0] == D[1] == D[2]:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
for i in range(min(a),max(a)+1):
  cnt = 0
  for j in a:
    cnt += (j-i)**2
  if i == min(a):
    ans = cnt
  else:
    if cnt < ans:
      ans = cnt
print(ans)
# Judge status: Accepted
H, N  = map(int, input().split())
a = list(map(int, input().split()))

s = 0
for i in a:
    s += i

if H > s:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
a,b,c=map(int,input().split())
e=a-b|c-b
print(len(bin(e&-e))-3or~c%-2)
# Judge status: Wrong Answer
n,k = map(int,input().split())
li = list(map(int,input().split()))
count = 1
li2 = [1]
li2.append(li[0])
for i in range(k):
    li2.append(li[li2[i+1]-1])
    count += 1
    if len(set(li2)) != count:
        break
print(li2[k % len(li2)])
# Judge status: Wrong Answer
import math

stdata = [0]*4
stdata = input().split()
plase = [0] * 4
plase[0] = float(stdata[0]) * math.sin(math.pi * 2 / 12 * float(stdata[2]))
plase[1] = float(stdata[0]) * math.cos(math.pi * 2 / 12 * float(stdata[2]))
plase[2] = float(stdata[1]) * math.sin(math.pi * 2 / 60 * float(stdata[3]))
plase[3] = float(stdata[1]) * math.cos(math.pi * 2 / 60 * float(stdata[3]))
temp = math.sqrt(float(plase[2] - plase[0]) * float(plase[2] - plase[0]) + float(plase[3] - plase[1]) * float(plase[3] - plase[1]))
print(temp)
# Judge status: Accepted
import itertools

N, M, Q = map(int, input().split())
ABCD = [list(map(int, input().split())) for _ in range(Q)]

max_score = 0

for A in itertools.combinations_with_replacement(range(1, M + 1), N):
    score = 0
    for a, b, c, d in ABCD:
        if A[b - 1] - A[a - 1] == c:
            score += d
    max_score = max(max_score, score)

print(max_score)
# Judge status: Wrong Answer
import math
N = int(input())
if math.floor(int(N/1.08)*1.08) == N*1.08:
  print(N//1.08)
else:
  print(':(')
# Judge status: Accepted
n = int(input())
ans = 0

for i in range(1,n+1):
	if i%3 == 0 or i%5 == 0:
		ans += 0
	else:
		ans += i
print(ans)
# Judge status: Accepted
X,Y=map(int,input().split())
if X%Y!=0:
    print(X)
else:
    print(-1)
# Judge status: Wrong Answer
r, g, b = map(int, input().split())
if (10 * g + b) % 4 == 0:
  print('Yes')
else:
  print('No')
# Judge status: Accepted
A, B, C = map(int, input().split())
print("Yes" if A + B >= C else "No")
# Judge status: Wrong Answer
def main():
    N = int(input())
    A = list(map(int,input().split()))
    B = [ A[i-1] - i for i in range(1,N+1)]
    b = B[N // 2] if N%2 == 1 else (B[N // 2 - 1] + B[N // 2]) // 2
    print(sum([abs(bb -b) for bb in B]))
    return

if __name__ == "__main__":
    main()
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
cnt=0
for i in range(n):
  x=min(a[i],b[i])
  a[i]-=x
  b[i]-=x
  y=min(a[i+1],b[i])
  a[i+1]-=y
  b[i]-=y
  cnt+=x+y
print(cnt)
# Judge status: Accepted
i=input()
S=input()
if S[:len(S)//2] != S[len(S)//2:] or len(S)%2 !=0:
  print("No")
else:
  print("Yes")
# Judge status: Accepted
import sys
def get_ints(): return map(int, sys.stdin.readline().strip().split())
def get_array(): return list(map(int, sys.stdin.readline().strip().split()))
def input(): return sys.stdin.readline().strip()
mod = 10**9 + 7

a,b = get_ints()
print(a*b)
# Judge status: Wrong Answer
h, n = map(int, input().split())
inf = 10**12
data = []
for i in range(n):
    data.append(list(map(int, input().split())))
dp = [[inf for i in range(h+1 + 10**4)] for j in range(n+1)]
dp[0][0] = 0
for i in range(n):
    a, b = data[i]
    for j in range(h+1+10**4):
        if j - a >= 0:
            dp[i+1][j] = min(dp[i+1][j-a] + b, dp[i][j])
        else:
            dp[i+1][j] = b
print(dp[-1][h-1])
# Judge status: Accepted
def main():
    K, X = map(int, input().split())
    print('Yes' if K * 500 >= X else 'No')


if __name__ == "__main__":
    main()
# Judge status: Accepted
a,b,c=sorted(map(int, input().split()))

print("Yes" if a+b==c else "No")
# Judge status: Accepted
#!/use/bin/env python3

n = int(input())
a = [int(s) for s in input().split()]

s = int(round(sum(a) / n))

ans = 0

for i in a:
    ans += pow(i - s, 2)

print(ans)
# Judge status: Accepted
import math
n,d = map(int,input().split())
ans = 0
for i in range(n):
    x,y = map(int,input().split())
    if math.sqrt((x ** 2) + (y ** 2)) <= d:
        ans += 1
print(ans)
# Judge status: Accepted
'''
Created on 2020/09/09

@author: harurun
'''
def main():
  import heapq
  import sys
  pin=sys.stdin.readline
  pout=sys.stdout.write
  perr=sys.stderr.write
  
  N,M=map(int,pin().split())
  A=list(map(int,pin().split()))
  B=list(map(lambda x: -x ,A))
  heapq.heapify(B)
  for i in range(M):
    t=heapq.heappop(B)
    s=-((-t)//2)
    heapq.heappush(B,s)
  ans=0
  for j in range(N):
    q=heapq.heappop(B)
    ans+=(-q)
  print(ans)
  return
main()
# Judge status: Accepted
S = input()

ans = "WA"

if S[0] == "A" and S[2:-1].count("C") == 1:
    if S[1:].replace("C", "").islower():
        ans = "AC"

print(ans)
# Judge status: Wrong Answer
s = input()

if s.islower():
  print(s.upper())
else:
  print(s.lower())
# Judge status: Accepted
#!python3

# input
S = input()
K = int(input())


def main():
    n = 1
    for s in S:
        if s != '1':
            print(int(s))
            return
        if n == K:
            print(1)
            return
        n += 1


if __name__ == "__main__":
    main()
# Judge status: Wrong Answer
n,x = map(int,input().split())
line = sorted(list(map(int,input().split())))
count = 0
if sum(line) < x:
  count = n - 1
elif sum(line) == x:
  count = n
else:
  for i in range(n):
    left = x - line[i]
    if left >= 0:
      count += 1
    else:
      break
print(count)
# Judge status: Accepted
n,x=map(int,input().split())
a=list(map(int,input().split()))
temp=[0]*n
for i in range(0,n):
  temp[i]=abs(a[i]-x)
import fractions
ans=temp[0]
for i in range(1,n):
  ans=fractions.gcd(ans,temp[i])
print(ans)
# Judge status: Wrong Answer
# D - Prediction and Restriction

n, k = map(int, input().split())
r, s, p = map(int, input().split())
T = list(str(input()))
A = []
ans = 0

for t in T:
    if t=='r':
        A.append(p)
    elif t=='s':
        A.append(r)
    else:
        A.append(s)

for i in range(len(A)):
    if i<k:
        ans += A[i]
        continue

    if A[i]==A[i-k]:
        A[i] = 0
    else:
        ans += A[i]

print(ans)
# Judge status: Accepted
s = list(input())
d = ["A","C","G","T"]
cnt = 0
ans = 0
for c in s:
    if c in d:
        cnt += 1
    else:
        ans = max(ans,cnt)
        cnt = 0
print(max(cnt,ans))
# Judge status: Wrong Answer
import math
N=int(input())
ans,n = 0,N
for i in range(2,int(math.sqrt(N))+1):
  ii=i
  if n%ii==0:
    ans+=1
    n=n//ii
    ii+=i
print(max(ans,1) if N!=1 else 0)
# Judge status: Accepted
n = int(input())
m = 0
i = 1
while True:
    m += i
    if m >= n:
        break
    i += 1
for j in range(1, i + 1):
    if not j == m - n:
        print(j)
# Judge status: Accepted

n=int(input())
ans=(n//500)*1000
n-=(n//500)*500
ans+=(n//5)*5
print(ans)
# Judge status: Wrong Answer
n = int(input())
for i in range(n+1):
  if i**2 > n:
    print(i-1)
    exit(0)
# Judge status: Accepted
n,k = map(int,input().split())
h = []
for i in range(n):
    h.append(int(input()))
h.sort()
min_number = 10**9+1
for i,j in zip(h[0:n-k+1],h[k-1:]):
    min_number = min(min_number,j-i)
    #print('{} {}'.format(i,j))
print(min_number)
# Judge status: Wrong Answer
import itertools 
n,m=map(int,input().split())
A=[list(input()) for _ in range(n)]
B=[list(input()) for _ in range(m)]
ans=False
for i in range(0,n-m+1):
  for j in range(0,n-m+1):
    a=[v[i:i+m] for v in zip(*A)]
    C=[list(w[j:j+m]) for w in zip(*a)]
    X=list(itertools.chain.from_iterable(C))
    Y=list(itertools.chain.from_iterable(B))
    ans=all(n==m for n,m in zip(X,Y))
print("Yes" if ans is True else "No")
# Judge status: Wrong Answer
import numpy as np
import math as mt
N = int(input())
num = list(map(int, input().split()))
ans = np.prod(num)
if ans != 0:
  if ans - 10**18 <= 0:
    print(ans)
  else:
    print(-1)
else:
  print(0)
# Judge status: Accepted
n=int(input())
L=list(map(int,input().split()))
max=0
ans=0
for i in range(n):
	if max>=L[i]:
		ans+=max-L[i]
	else:
		max=L[i]
print(ans)
# Judge status: Accepted
N,K = map(int,input().split())
import sys
S = input()

inside = 0
happy = 0

for i in range(N-1):
    if S[i] == S[i+1]:
        happy += 1
    if S[i] == 'R' and S[i+1] ==  'L':
        inside += 1

happy += 2*(min(K,inside))
if K - inside > 0:
  if S[N-1] == 'R':
    happy += 1
print(happy if happy < N else happy-1)
# Judge status: Wrong Answer
h,a = map(int,input().split())

ans=(h+a-1)/a
print(ans)
# Judge status: Wrong Answer
X = int(input())
for i in range(X+1, 9999999999999999):
    flag = 1
    for j in range(2, X//2 +1):
        if i % j == 0:
            flag = -1
            break
    if flag == 1:
        print(i)
        break
# Judge status: Accepted
def hantei(N):
    for i in range(100*N,100*(N+1)):
        if i%108 == 0:
            return(int(i/108))
    return ":("

N = int(input())
print(hantei(N))
# Judge status: Accepted
a = int(input())
print(a*(a-1)//2)
# Judge status: Accepted
n = int(input())
ans = 999
for i in range(1,10):
    if 111*i-n>=0:
        ans = min(ans,111*i-n)
print(ans+n)
# Judge status: Accepted
N = int(input())
f = 10**9 + 7
e = n = t = 1
for i in range(N):
    e = (e * 8) % f
    n = (n * 9) % f
    t = (t * 10) % f
ans = (t - 2*n + e) % f
print(ans)
# Judge status: Accepted
x, y = map(int, input().split())
A = [1, 3, 5, 7, 8, 10, 12]
B = [4, 6, 9, 11]
if (x in A and y in A) or (x in B and y in B):
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer
n = int(input())

words = {}

for i in range(n):
    key = input()
    if key not in words:
        words[key] = 0
    words[key] += 1

ans = sorted(words.items(), key=lambda x:x[1])[::-1]

for i in ans:
    if ans[0][1] == i[1]:
        print(i[0])
    else:
        break
# Judge status: Wrong Answer
a=4
b=8

answer= a*b
print(answer)
# Judge status: Wrong Answer
N = int(input())
if N % 2 == 0:
    print(N / 2)
else:
    print(N // 2 + 1)
# Judge status: Accepted
def num_divisors_table(n):
    table = [0] * (n + 1)
    
    for i in xrange(1, n + 1):
        for j in xrange(i, n + 1, i):
            table[j] += 1
    
    return table
  
n = int(input())  
a =  num_divisors_table(n)
ans = 0
for i in range(n+1):
  ans += i*a[i]
print(ans)
# Judge status: Accepted
n, r = list(map(int, input().split()))

if n >= 10:
    print(r)
else:
    print(r + 100 * (10 - n))
# Judge status: Wrong Answer
N, A, B = map(int, input().split())

print((N // (A + B)) * A + (N % (A + B)))
# Judge status: Accepted
S = input()

if ( S[2] == S[3] ) & ( S[4] == S[5] ):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
# N = int(input())
# A = list(map(int, input().split()))
H, W = map(int, input().split())

if H == 1 or W == 1 :
  print(1)
  exit()

print(-(-(H * W) // 2))
# Judge status: Accepted
X = input()
N = len(X)
S = 0
ans = 0
for i in range(N):
    if X[i] == 'S':
        S += 1
    elif S > 0:
        S -= 1
        ans += 2
        
print(N - ans)
# Judge status: Wrong Answer
from collections import Counter

n=int(input())
a=list(map(str,input().split()))
b=Counter(a)
b=list(b.values())

for i in range(len(b)):
    print(b[i])

for i in range(n-len(b)):
    print(0)
# Judge status: Wrong Answer
N = input()
print(N[-1])
n = N[-1]
if n in ["2","4","5","7","9"]:
    print("hon")
elif n in ["0","1","6","8"]:
    print("pon")
else:
    print("bon")
# Judge status: Accepted
n = int(input())
height_lst = list(map(int,input().split()))
move_lst = [0]
move = 0

for i in range(n-1):
    height1 = height_lst[i]
    height2 = height_lst[i+1]

    if height1>=height2:
        move += 1
        if i==n-2:
            move_lst.append(move)
    else:
        if move!=0:
            move_lst.append(move)
        move = 0

print(max(move_lst))
# Judge status: Accepted
X, Y = map(int, input().split())

ans=1
while X<=Y:
    X *= 2
    ans += 1

print(ans-1)
# Judge status: Accepted
a, b, k = map(int, input().split())
cnt = 0
for i in range(100, 0, -1):
    if a % i == 0 and b % i == 0:
        cnt += 1
        if cnt == k:
            print(i)
            break
# Judge status: Wrong Answer
S,W = map(int, input().split())
if (S<W):
    print("unsafe")
else:
    print("safe")
# Judge status: Accepted
from sys import stdin
input = stdin.readline

# map(int, input().rstrip().split())

def VI(N, init=0):
  return [init for _ in range(N)]
def VVI(N, M, init=0):
  return [[init for _ in range(M)] for _ in range(N)]

def VD(N, init=0.0):
  return [init for _ in range(N)]
def VVD(N, M, init=0.0):
  return [[init for _ in range(M)] for _ in range(N)]

LINF = int(1e18+7)
S = input().rstrip()
K = int(input().rstrip())

tmp = LINF
ch = '1'
for i in range(len(S)):
  if S[i] != '1':
    tmp = i
    ch = S[i]
    break

if tmp >= K:
  print(1)
else:
  print(ch)
# Judge status: Accepted
n, m, k = map(int, input().split())
nmk = 100 * n + 10 * m + k
if nmk % 4 == 0:
    print('YES')
else:
    print('NO')
# Judge status: Accepted
S = list(input())
cnt_1 = S.count("1")
cnt_0 = S.count("0")
print(2*min(cnt_1,cnt_0))
# Judge status: Accepted
N,K = map(int,input().split())

p = list(map(int,input().split()))
max = 0
for i in range(K):
    max += (1+p[i])/2
tmp = max
for i in range(K,len(p)):
    tmp -= (1+p[i-K])/2
    tmp += (1+p[i])/2
    #print(max)
    if max < tmp:
        max = tmp
    #print(max)    
print(max)




#ロケットペンシル方式
# Judge status: Wrong Answer
n=int(input())
tener=int(n/500)
res=n-tener
fiver=int(res/5)
print((tener*1000)+(fiver*5))
# Judge status: Wrong Answer
n = input()
p = input().split()
cnt = 0
cn = 0
fm = False

for i in range(len(p)):
	cn = int(p[i])
	if fm and i > 0 and p[i] < p[i-1] :
		cnt += 1
		continue
	for j in range(i + 1):
		if cn > int(p[j]):
			fm = False
			break
		if i == j:
			cnt += 1
			fm = True

print(cnt)
# Judge status: Accepted
a,b,c=map(int,input().split())
print(int(a*b/2))
# Judge status: Accepted
##C - Ubiquity
##0と9が一つずつない状況
N = int(input())
print((10**N - 2*9**N + 8**N) % (10**9+7))
# Judge status: Wrong Answer
N, K = map(int, input().split())
D = {x for x in input().split()}

for i in range(N, 10000):
    l = set(list(str(i)))
    if len(l & D) == 0:
        print(i)
        break
# Judge status: Accepted
def isAC(S):
    if S[0] != 'A':
        return False
    if S[2:-1].count('C') != 1:
        return False
    S = S[1:].replace('C', '')
    if not all('a' <= x <= 'z' for x in S):
        return False
    return True

print('AC' if isAC(input()) else 'WA')
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))
ct=0
ans=0
for i in range(n-1):
    if h[i]<h[i+1]:
        if ans<ct:
            ans=ct
        ct=0
    ct+=1
if ans<ct:
    ans=ct
if ans==0:
    ans=1
print(ans-1)
# Judge status: Accepted
X, A, B = map(int, input().split())

if A >= B:
    print('delicious')
elif A + X >= B:
    print('safe')
else:
    print('dangerous')
# Judge status: Wrong Answer
S, T = input().split()
print(T, S, end="")
# Judge status: Accepted
from collections import Counter
n = int(input())
s = [input() for i in range(n)]
m = int(input())
t = [input() for i in range(m)]
sc = Counter(s)
tc = Counter(t)
a = 0
for sck in sc.keys():
    a = max(a,sc.get(sck,0)-tc.get(sck,0))
if a>=1:
    print(a)
else:
    print(0)
# Judge status: Accepted
n = int(input())
A = tuple(map(int, input().split()))

from itertools import accumulate
ac = [0] + list(accumulate(A))

ans = 2*10**5*(10**9)
for i in range(1, n):
    ans = min(ans, abs(ac[i] - ac[n] + ac[i]))
print(ans)
# Judge status: Wrong Answer
s = list(input())
a = s[0]
cou = 1
i = 1
while i!=len(s) and i!=len(s)-1:
  if s[i]!=a:
    cou += 1
    a = s[i]
    i += 1
    print(0,a,cou,i)
  else:
    a = "".join(s[i:i+2])
    cou += 1
    i += 2
  #  print(10,a,cou,i)

if a==s[-1] and len(a)==1:
  print(cou)
elif a=="".join(s[-2:]) and len(a)==2:
  print(cou)
else:
  print(cou+1)
# Judge status: Accepted
a, b = map(int, input().split())
if a == 1:
    a = 14
if b == 1:
    b = 14
if a < b:
    print('Bob')
elif a > b:
    print('Alice')
else:
    print('Draw')
# Judge status: Accepted
x,n=map(int,input().split())
p=set([int(j)for j in input().split()])
for i in range(1000):
    if x-i not in p:
        print(x-i)
        exit()
    if x+i not in p:
        print(x+i)
        exit()
# Judge status: Accepted
N = int(input())
S = list(input())

sum_W = [0]
for i in range(1, N):
    if S[i-1] == "W":
        sum_W.append(sum_W[i-1]+1)
    else:
        sum_W.append(sum_W[i-1])

sum_E = [S[1:].count("E")]
for i in range(0, N-1):
    if S[i+1] == "E":
        sum_E.append(sum_E[i]-1)
    else:
        sum_E.append(sum_E[i])

counts = []
for i in range(N):
    count = 0
    counts.append(sum_W[i]+sum_E[i])

print(min(counts))
# Judge status: Accepted
n, m, k = map(int, input().split())
a_ = list(map(int, input().split()))
b_ = list(map(int, input().split()))

a = [0]
for i in range(n):
    a.append(a[i]+a_[i])

b = [0]
for i in range(m):
    b.append(b[i]+b_[i])

j = m
ans = 0
for i in range(n+1):
    if a[i] > k:
        break
    while 1:#b[j] > k - a[i]:
        if b[j] <= k - a[i]:
            break
        j -= 1
    ans = max(ans, i + j)

print(ans)
# Judge status: Accepted
#11
n,m = map(int,input().split())
ab = []
cd = []
for i in range(n):
    ab.append(list(map(int,input().split())))
for i in range(m):
    cd.append(list(map(int,input().split())))
    
for i in range(n):
    Min = [0,float("inf")]
    for j in range(m):
        l = abs(ab[i][0]-cd[j][0])+abs(ab[i][1]-cd[j][1])
        if Min[1]>l:
            Min = [j+1,l]
    print(Min[0])
# Judge status: Accepted
O=list(input())
E=list(input())

answer_list=[]
for i in range(len(O)):
  answer_list.append(O[i])
  if i<len(E):
    answer_list.append(E[i])
    
print("".join(answer_list))
# Judge status: Accepted
import bisect
n = int(input())
a, b, c = map(list, [sorted(list(map(int, input().split()))) for i in range(3)])
ans = 0
for i in range(n):
    ans += bisect.bisect_left(a, b[i]) * (n - bisect.bisect_right(c, b[i]))
print(ans)
# Judge status: Wrong Answer
n = int(input())
la = list(map(int,input().split()))
lb = list(map(int,input().split()))
count = 0
for i in range(n):
  if la[i]>=lb[i]:
    count+=lb[i]
  else:
    count+=la[i]
    if la[i+1] >= lb[i]-la[i]:
      count+=(lb[i]-la[i])
      la[i+1] == la[i+1]-(lb[i]-la[i])
    else:
      count+=la[i+1]
      la[i+1]==0
print(count)
# Judge status: Accepted
n = int(input())

xl =[]
for i in range(n):
    x,l = map(int,input().split())
    xl.append([x-l,x+l])
xl.sort(key=lambda x: x[1])

arm = xl[0][1] 
cnt = 1
for i in range(1,n):
    x,l = xl[i][0],xl[i][1]

    if arm <= xl[i][0]:
        arm = xl[i][1]
        cnt +=1
        
print(cnt)
# Judge status: Accepted
import math
N = int(input())

for i in range(N+1):
    if math.floor(1.08 * i) == N:
        print(i)
        exit()

print(":(")
# Judge status: Accepted
N,K=map(int,input().split())
h=[int(input()) for i in range(N)]
s=sorted(h)
ans=10**10
for i in range(N-K+1):
    Z=s[i+K-1]-s[i]
    ans=min(ans,Z)
print(ans)
# Judge status: Accepted
N, M = list(map(int, input().split()))
H = list(map(int, input().split()))
arr = [[] for i in range(N)]
ans = 0
#print(arr)
for i in range(M):
    a, b = list(map(int, input().split()))
    arr[a-1].append(b-1)
    arr[b-1].append(a-1)

for i in range(N):
    if arr[i] == []:
        ans += 1
    else:
        if all(H[i] > H[arr[i][j]] for j in range(len(arr[i]))):
            ans += 1

print(ans)
# Judge status: Accepted
n, k = map(int, input().strip().split())
hs = sorted([int(input()) for _ in range(n)])

ans = 1e15

for i in range(n - k + 1):
    h_max = hs[i + k - 1]
    h_min = hs[i]
    ans = min(h_max - h_min, ans)

print(ans)
# Judge status: Accepted
#coding:utf-8
from collections import deque
K=int(input())
L=deque([1,2,3,4,5,6,7,8,9])
cnt=0
x=0
for _ in range(K):
	cnt+=1
	x=L.popleft()
	if x%10 !=0:
		L.append(10*x+x%10-1)
	L.append(10*x+x%10)
	if x%10!=9:
		L.append(10*x+x%10+1)

print(x)
# Judge status: Accepted
from itertools import accumulate

n, x = map(int, input().split())
L = list(map(int, input().split()))
C = [0] + list(accumulate(L))
#print(C)

cnt = 0
for c in C:
    if c <= x:
        cnt += 1
print(cnt)
# Judge status: Wrong Answer
n, k = map(int, input().split())
a = list(map(int, input().split()))
b = a.index(1)
c=0
c-=(-(n-b-1)//(k-1))
c-=(-b)//(k-1)
print(c)
# Judge status: Wrong Answer
data = input()

dataa,datab,datac,datad = data.split(' ')

dataa = int(dataa)
datab = int(datab)
datac = int(datac)
datad = int(datad)

length1 = dataa - datab
length2 = datab - datac
length11 = length1 + length2
length3 = dataa - datac
datadd = datad * -1

if length1 <=datad and length1 >= datadd:
    print('Yes')
elif length2 <= datad and length2 >= datadd:
    print('Yes')
elif length11 <= datad and length11 >= datadd:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
A,B,C = map(int, input().split())
if A == B or B == C or A == C:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
x, a, b = map(int, input().split())
p = b - a
if p <= 0:
  print("delicious")
elif x >= p:
  print("safe")
else:
  print("dangerous")
# Judge status: Accepted
S=input()
a=int(S[:2])#前半
b=int(S[2:4])
cYYMM=b>0 and b<13
cMMYY=a>0 and a<13
#print(a,b)
#print(["NO","YES"][1-cond])
print([["NA","YYMM"],["MMYY","AMBIGUOUS"]][cMMYY][cYYMM])
# Judge status: Accepted
N = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
needed_minus = 0
for i in range(N):
    if a[i] > b[i]:
        needed_minus += a[i] - b[i]
    elif a[i] % 2 != b[i] % 2:
        needed_minus += 1
if needed_minus > sum(b) - sum(a):
    print("No")
else:
    print("Yes")
# Judge status: Accepted
n = int(input())

for i in range(n//4 + 1):
    for j in range(n//7 + 1):
        if 4*i + 7*j == n:
            print('Yes')
            exit()

print('No')
# Judge status: Accepted
a, b, c = map(int, input().split())

f = max(a, b, c)
if f == a:
    print(a*10 + int(str(b+c)))
elif f == b:
    print(b*10 + int(str(a+c)))
else:
    print(c*10 + int(str(b+a)))
# Judge status: Accepted
x,y=map(int,input().split())
if x%y == 0:
    print(-1)
else:
    print(x)