Harryxun/stf_run huggingface dataset:
a=input()
b=input()
if (a[0]==b[2] and a[1]==b[a] and a[2]==b[0]):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

a=input()
b=input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")
import numpy as np

H, W = map(int, raw_input().split())

S = np.zeros((H, W))

d_flag = 0

for i in range(H):
    tmp = list(raw_input())
    for j in range(W):
        if tmp[j] == "#":
            S[i, j] = 1
            d_flag = 1
        else:
            S[i, j] = 0



for i in range(H):
    for j in range(W):
        if S[i, j] == 1:
            flag = 0
            if i>1:
                a1 = S[i-1, j]
            else:
                a1 = 0
            if j>1:
                a2 = S[i, j-1]
            else:
                a2 = 0
            if i<H-1:
                a3 = S[i+1, j]
            else:
                a3 = 0
            if j<W-1:
                a4 = S[i, j+1]
            else:
                a4 = 0
            print(a1+a2+a3+a4)
            if a1+a2+a3+a4 == 0:
                d_flag = 0
                
if d_flag == 1:

### FIXED CODE ###

H, W = map(int, raw_input().split())

s = [raw_input() for _ in range(H)]

ans = "Yes"

for y in range(H):
  for x in range(W):
    if s[y][x]=="#":
      ok = False
      for dx,dy in [(-1,0), (1,0), (0,-1), (0,1)]:
        if 0<=x+dx<W and 0<=y+dy<H and s[y+dy][x+dx]=="#":
          ok = True
      if not ok:
        ans = "No"

                
print ans
a,b=map(int, input().split())
print(b+a)

### FIXED CODE ###

c=list(map(str, input().split()))
print(c[1]+c[0])
nmx=list(map(int, input().split()))
N=nmx[0]
M=nmx[1]
X=nmx[2]
mylist=[]
for i in range(N):
    mylist.append(list(map(int, input().split())))
Ans=10000*12+1
for i in range(2**N):
    A=[[0]*M]
    C=0
    for j in range(N):
        if (i>>j) & 1:
            C+=mylist[j][0]
            for k in range(M):
                A[k]=A[k]+mylist[j][k+1]
    if min(A)>=X:
        #Ans=min(Ans, C)
if Ans==10000*12+1:
    print(-1)
else:
    print(Ans)



### FIXED CODE ###

nmx=list(map(int, input().split()))
N=nmx[0]
M=nmx[1]
X=nmx[2]
mylist=[]
for i in range(N):
    mylist.append(list(map(int, input().split())))
Ans=100000*12+1
for i in range(2**N):
    A=[0]*M
    C=0
    for j in range(N):
        if (i>>j) & 1:
            C=C+mylist[j][0]
            for k in range(M):
                A[k]=A[k]+mylist[j][k+1]
    if min(A)>=X:
        Ans=min(Ans, C)
if Ans==100000*12+1:
    print(-1)
else:
    print(Ans)
n = int(input())
count = 0
lia = []
lib = list(map(int,input().split()))
for i in range(1,n+1):
    lia.append(i)
for i in range(n):
    if lia[i] != lib[i]:
        count += 1
    if count > 3:
        print("NO")
        break
if count <= 2:
    print("YES")

### FIXED CODE ###

n,k = map(int,input().split())
li = list(map(int,input().split()))
count = 0
for i in range(n):
    if li[i] >= k:
        count += 1
print(count)
import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

ans = list((A@B) > -C).count(True)
print(ans)


### FIXED CODE ###

import numpy as np

N, M, C = map(int, input().split())
B = np.array(list(map(int, input().split())))
A = []
for i in range(N):
    A_i = list(map(int, input().split()))
    A.append(A_i)
A = np.array(A)

#ans = list((A@B) > -C).count(True)
ans = list((A.dot(B)) > -C).count(True)

print(ans)
N, D = map(int, input().split())
X, Y = [map(int, input().split()) for i in range(N)]

cnt = 0
for i in range(N):
    if X[i]**2 + Y[i]**2 < D**2:
        cnt += 1
print(cnt)

### FIXED CODE ###

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

cnt = 0
for i in range(N):
    X, Y = map(int, input().split())
    if X**2 + Y**2 <= D**2:
        cnt += 1
print(cnt)
from math import sqrt
from collections import defaultdict
N,P = map(int, input().split())
is_prime = [True]*(10**6+1)
is_prime[0] = is_prime[1] = False
def sieve(n:int):
    """Sieve of Eratoshenes
    return the number of prime number (0, n]"""
    global is_prime
    if n<2: return 0
    for i in range(2, n+1):
        if is_prime[i]:
            # 素数の倍数は合成数
            for j in range(i*2, n+1, i):
                is_prime[j] = False

sieve(10**6)
facts = defaultdict(lambda:0)
for i in range(P):
    if not is_prime[i]:
        continue
    if P == 1:
        break
    while P % i == 0:
        P //= i
        facts[i] += 1
ans = 1
for k,v in facts.items():
    ans *= pow(k, v//N)
print(ans)


### FIXED CODE ###

from collections import defaultdict
from math import sqrt
N,P = map(int, input().split())
is_prime = [True]*(10**6+1)
is_prime[0] = is_prime[1] = False
def sieve(n:int):
    """Sieve of Eratoshenes
    return the number of prime number (0, n]"""
    global is_prime
    for i in range(2, n+1):
        if is_prime[i]:
            # 素数の倍数は合成数
            for j in range(i*2, n+1, i):
                is_prime[j] = False

sieve(10**6)
facts = defaultdict(lambda:0)
p = P
for i in range(int(sqrt(P))):
    if not is_prime[i]:
        continue
    if p == 1:
        break
    while p % i == 0:
        p //= i
        facts[i] += 1
if p>0:
    facts[p] += 1
ans = 1
for k,v in facts.items():
    ans *= pow(k, v//N)
print(ans)
import sys
for x in sys.stdin.readlines():
    n = [int(y) for y in x.split()]

    print "%.3f %.3f" % ((n[2]*n[4]-n[1]*n[5])/(n[0]*n[3]-n[1]*n[3]),(n[5]*n[0]-n[2]*n[3])/(n[0]*n[4]-n[3]*n[1]))

### FIXED CODE ###

import sys
for x in sys.stdin.readlines():
    n = [float(y) for y in x.split()]

    print "%.3f %.3f" % ((n[2]*n[4]-n[1]*n[5])/(n[0]*n[4]-n[1]*n[3])+0,(n[5]*n[0]-n[2]*n[3])/(n[0]*n[4]-n[3]*n[1])+0)
v = str(input()).split()
dif_max = -200000

for i in range(len(v)):
    v[i] = int(v[i])

len = v[0]
for i in range(2, len + 1, 1):
    for j in range(i + 1, len + 1, 1):
        dif = v[j] - v[i]
        dif_max = dif if dif_max < dif else dif_max

print("{}".format(dif_max))

### FIXED CODE ###

cnt = int(input())
dif_max = -1000000000
v_min = 1000000000

for i in range(cnt):
    buf = int(input())
    if i > 0:
        dif_max = dif_max if buf - v_min < dif_max else buf - v_min
    v_min = buf if buf < v_min else v_min
print(dif_max)
S = input()
if (S == 'ABC)':
    print('ARC')
else:
    print('ABC')

### FIXED CODE ###

S = input()
if S == 'ABC':
    print('ARC')
else:
    print('ABC')
N = map(int, input().split())

area = (N * N * ??)
len = (N * 2 * ??)

print('{0:f} {1:f}'.format(area, len))

### FIXED CODE ###

ci = 3.14159265359
n = float(input())
print('{0:f} {1:f}'.format(n*n*ci, (n+n)*ci))
g = {}
a = int(input())
vertices = [i for i in range(1, a + 1)]
for i in range(a):
    c = [int(s) for s in input().split()] 
    print(0)

### FIXED CODE ###

g = {}
a = int(input())
for i in range(a - 1):
    c = [int(s) for s in input().split()]
    if c[0] not in g: g[c[0]] = [(c[1], c[2])]
    else: g[c[0]].append((c[1], c[2]))

    if c[1] not in g: g[c[1]] = [(c[0], c[2])]
    else: g[c[1]].append((c[0], c[2]))

c = {}
d = {i: False for i in range(1, a + 1)}
c[1], d[1] = 0, True
Q = [1]
while(Q != []):
    r = Q.pop(0)
    for i in g[r]:
        if d[i[0]] == False:
            d[i[0]] = True
            Q.append(i[0])
            if i[1] % 2 == 0: c[i[0]] = c[r]
            else: c[i[0]] = (c[r] + 1) % 2
for i in range(1, a + 1): print(c[i])
n=int(input())
lists=[]
for i in range(n):
	s=int(input())
  	lists.append(s)
if all(lists[i]%2==0 for i in range(n)):
  print("second")
else:
  print("first")

### FIXED CODE ###

n=int(input())
lists=[]
for i in range(n):
    s=int(input())
    lists.append(s)
if all(lists[i]%2==0 for i in range(n)):
    print("second")
else:
    
    print("first")
'''
in
-----
7
2
9
4
5
1
6
10
'''
'''
out
-----
8
'''
from collections import defaultdict
dp = defaultdict(lambda:int(10**9))

N = int(input())
L = [0] * (N +2)
dp[0] = 0
for i in range(0, N):
    L[i] = int(input())

for i in range(0, N):
    dp[i+1] = min(dp[i+1], dp[i] + abs(L[i+1] - L[i]))
    dp[i+2] = min(dp[i+2], dp[i] + abs(L[i+2] - L[i]))

print(dp[N-1])


### FIXED CODE ###

from collections import defaultdict
dp = defaultdict(lambda:int(10**9))

N = int(input())
L = list(map(int, input().split()))
dp[0] = 0
for i in range(0, N):
    if i+1 < N:
        dp[i+1] = min(dp[i+1], dp[i] + abs(L[i+1] - L[i]))
        if i+2 < N:
            dp[i+2] = min(dp[i+2], dp[i] + abs(L[i+2] - L[i]))

print(dp[N-1])
a = map(int, input().split())

success_cases = [(a[0], a[1], a[2]), (a[1], a[2], a[0]), a[2], a[0], a[1])]

for c in success_cases:
    if c == (5,7,5):
        print("YES")
        return
print("NO")



### FIXED CODE ###

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

success_cases = [(a[0], a[1], a[2]), (a[1], a[2], a[0]), (a[2], a[0], a[1])]

for c in success_cases:
    if c == (5,7,5):
        print("YES")
        exit(0)
print("NO")
N = int(input())
S = input().split()

for x in S:
  if x is 'Y'
  	print('Four')
    exit()
  else:
    print('Three')

### FIXED CODE ###

N = int(input())
S = list(input().split())

print('Four' if 'Y' in S else 'Three')
n = [int(input()) for _ in range(5)]
minNum = 9
x = 0
for i in n:
    if i % 10 < minNum and i % 10 != 0:
        minNum = i % 10
        x = i
n.pop(n.index(x))
total = x
for j in n:
    total += ((j + 9) // 10) * 10
print(total)

### FIXED CODE ###

n =  [int(input()) for x in range(5)]
minNum = 10
array = 0
for i in range(len(n)):
    num = n[i] % 10
    if((num <= minNum) and (num != 0)):
        minNum = num
        array = i
        
numList = []
a = n[array]
n[array] = 0

for x in n:
    k = ((x + 9) // 10) * 10
    numList.append(k)  
print(sum(numList) + a)
c = input()
c = ord(c + 1)
print(c)

### FIXED CODE ###

c = input()
c = ord(c) + 1
print(chr(c))
N,D=map(int,input().split())
print(math.ceil(N/(2*D+1)))


### FIXED CODE ###

import math
N,D=map(int,input().split())
print(math.ceil(N/(2*D+1)))
import math
def solve():
    a,b,c = map(int, input().split())
    if (4 * a * b < (c-a-b)**2 and c-a-b>=0) or (4 * a * b > (c-a-b) ** 2 and c-a-b<0):
        print('Yes')
    else:
        print('No')
    
if __name__ == '__main__':
    solve()

### FIXED CODE ###

def solve():
    mod = 10 ** 9 + 7
    fac, finv, inv = COMinit(10 ** 6, mod)

    X, Y = map(int, input().split())
    if (X + Y) % 3 != 0:
        print(0)
        return
    
    ans = 0
    for one_cnt in range(10 ** 6):
        x1 = one_cnt * 2
        y1 = one_cnt * 1
        remain_x = X - x1
        remain_y = Y - y1
        if remain_x * 2 != remain_y or remain_x < 0 or remain_y < 0:
            continue
        two_cnt = remain_x
        ans += COM(one_cnt+two_cnt, one_cnt,mod,fac,finv,inv)
    
    print(ans)

def n_combination(n, r, mod):
    numer_sum = 1
    denom_sum = 1
    for i in range(r):
        numer_sum *= n - i
        numer_sum % mod
        denom_sum *= r - i
        numer_sum % mod
    
    return numer_sum * modinv(denom_sum, mod) % mod

def modinv(a, mod):
    return pow(a, mod-2, mod)
    
def COMinit(N, mod):
    fac = [0] * N
    finv = [0] * N
    inv = [0] * N

    fac[0] = 1
    fac[1] = 1
    finv[0] = 1
    finv[1] = 1
    inv[1] = 1

    for i in range(2, N):
        fac[i] = fac[i-1] * i % mod
        inv[i] = mod - inv[mod%i] * (mod // i) % mod
        finv[i] = finv[i-1] * inv[i] % mod
    
    return fac, finv, inv

def COM(n, r, mod, fac, finv, inv):
    if n < r:
        return 0
    if n < 0 or r < 0:
        return 0
    return fac[n] * (finv[r] * finv[n-r] % mod) % mod

if __name__ == '__main__':
    solve()
n=int(input())
A=list(map(int,input().split()))
m=float('INF')
sa=[]
for i,a in enumerate(A):
    sa.append(sa[i]+ai)
for i in range(n+1):
    ans=min(ans,abs(sa[i]-(sa[-1]-sa[i])))
print(ans)
    

### FIXED CODE ###

n=int(input())
A=list(map(int,input().split()))
ans=float('INF')
sa=[0]
for i,a in enumerate(A):
    sa.append(sa[i]+a)
for i in range(n+1):
    ans=min(ans,abs(sa[i]-(sa[-1]-sa[i])))
print(ans)
#c
n,m = map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()) )
mod=10**9 + 7

def cmb(n, r, m,g1,g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % m

def nCrMOD(n,r,m):
    g1 = [1, 1]
    g2 = [1, 1]
    inverse = [0, 1]
    for i in range( 2, n + 1 ):
        g1.append( ( g1[-1] * i ) % m )
        inverse.append( ( -inverse[m % i] * (mod//i) ) % m )
        g2.append( (g2[-1] * inverse[-1]) % m )
    return cmb(n,r,m,g1,g2)


c=0
for i in range(m-1):
    if a[i]==a[i+1]-1: c+=1
if c!=0:
    print(0)
else:
    b=[a[0]-1] + [a[j+1]-a[j]-2 for j in range(m-1)] + [n-a[-1]-1]
cc=[ sum( nCrMOD(bb-i,i,mod) for i in range(bb//2+1) )%mod for bb in b ]

ans=1
for ccc in cc:
    ans = ans*ccc%mod
print(ans)

### FIXED CODE ###

#c dp version
n,m = map(int,input().split())
a=[]
for i in range(m):
    a.append(int(input()) )
from collections import deque
a=deque(a)
mod=10**9 + 7

dp=[0]*(n+2)
dp[0]=0
dp[1]=1
aa=0
if len(a)>0:
    aa=a.popleft()
for i in range(2,n+2):
    if i-1 == aa:
        dp[i]=0
        if len(a)>0:
            aa=a.popleft()
    else:
        dp[i]=( dp[i-1]+dp[i-2] )%mod
print(dp[-1])
n = int(input())
h = list(map(int,input().split()))
ans = h[0]
for i in range(1,n):
    if h[i-1] < h[i]:
        ans += h[i]-h[i-1]
print(ans)

### FIXED CODE ###

a,b,c = map(int,input().split())
print(int(a*b/2))
from math import factorial
def cmb(n, r):
    return factorial(n) // (factorial(n - r) * factorial(r))

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(round(dd/2) + 1):
                tmp += cmb(dd - j, j)
            ans *= tmp

    print(ans%1000000007)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
def cmb(n, r, mod, g1, g2):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

def main():
    N, M = map(int, input().split())
    A = [-1] + [int(input()) for i in range(M)] + [N + 1]

    mod = 10**9+7 #出力の制限
    N = 10**5
    g1 = [1, 1] # 元テーブル
    g2 = [1, 1] #逆元テーブル
    inverse = [0, 1] #逆元テーブル計算用テーブル
    for i in range( 2, N + 1 ):
        g1.append( ( g1[-1] * i ) % mod )
        inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
        g2.append( (g2[-1] * inverse[-1]) % mod )

    d = [0] * (len(A) - 1)
    for i in range(len(A) - 1):
        if A[i+1] - A[i] == 1:
            print(0)
            exit(0)
        d[i] = A[i+1] - 1 - (A[i] + 1)

    ans = 1
    for dd in d:
        if dd > 1:
            tmp = 0
            for j in range(dd//2 + 1):
                tmp += cmb(dd - j, j, mod, g1, g2)
            ans *= tmp

    print(ans % 1000000007)

if __name__ == '__main__':
    main()
s = int(input())
a = [s]

for i in range(2, 1000001):
  if s % 2 == 0:
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in a:
    print(i)
    break
   
  s.append(s)

### FIXED CODE ###

s = int(input())
a = [s]

for i in range(2, 1000001):
  if s % 2 == 0:
    s = s / 2
  else:
    s = 3 * s + 1
  
  if s in a:
    print(i)
    break
   
  a.append(s)
if S==T[:-1]:
  print("yes")
  else:
    print("No")

### FIXED CODE ###

S=input()
T=input()
if S==T[:-1]:
  print("Yes")
else:
  print("No")
s = list(map(int, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]

ALL[input()] -= 1

for i in range(len(s)):
  print(ALL[s[i]], end = ' ')



### FIXED CODE ###

s = list(map(str, input().split()))
num = list(map(int, input().split()))
ALL = {}
for i in range(len(s)):
  ALL[s[i]] = num[i]
 
ALL[input()] -= 1
 
for i in range(len(s)):
  print(ALL[s[i]], end = ' ')
a,b,c=map(int,input().split())
print(a[0]+b[0]+c[0])

### FIXED CODE ###

a,b,c=map(str,input().split())
print(a[0]+b[0]+c[0])
from random import sample
from math import gcd

n = int(input())

nl = []
for j in range(1, 30000 + 1):
    if (j % 2 == 0 or j % 3 == 0 or j % 5 == 0):
        nl.append(j)
len_nl = len(nl)

while True:
    tl = sample(nl, len_nl)
    g = 0
    total = 0
    for j in range(n):
        g = gcd(g, tl[j])
        total += tl[j]
    if total % 30 == 0:
        continue
    if g != 1:
        continue
    break
print(*tl[:n])

### FIXED CODE ###

from random import sample
def gcd(x, y):
    if x < y:# x >= y とする
        x, y = y, x
    r = x % y
    res = y if r == 0 else gcd(y, r)
    return res

n = int(input())

nl = []
for j in range(1, 30000 + 1):
    if (j % 2 == 0 or j % 3 == 0 or j % 5 == 0):
        nl.append(j)
len_nl = len(nl)

while True:
    tl = sample(nl, len_nl)
    g = tl[0]
    total = 0
    for j in range(n):
        g = gcd(g, tl[j])
        total += tl[j]
    if total % 30 != 0:
        continue
    if g != 1:
        continue
    break
print(*tl[:n])
import math
r = int(input())
print("%.5f %.5f" % (math.pi*r *r, 2*math.pi*r))


### FIXED CODE ###

import math
r = float(input())
print("%.5f %.5f" % (math.pi*r *r, 2*math.pi*r))
al = "abcdefghijklmnopqrstuvwxyz"
i = input()
for a in ramge(al):
  if al[a] == i:
    print(al[a+1])

al = "abcdefghijklmnopqrstuvwxyz"
i = input()
for a in range(len(al)):
  if al[a] == i:
    print(al[a+1])



### FIXED CODE ###

al = "abcdefghijklmnopqrstuvwxyz"
i = input()
for a in range(len(al)):
  if al[a] == i:
    print(al[a+1])
S = input()
T = input()
print(len([1 for i in range(3) if S[i]==T[i]])

### FIXED CODE ###

S = input()
T = input()
print(len([1 for i in range(3) if S[i]==T[i]]))
import numpy as np
n = int(input())
A = list(map(int, input().split()))

print(A)
lcm = np.lcm.reduce(A)
ans = ((lcm - 1) % A).sum()
print(ans)


### FIXED CODE ###

import numpy as np
n = int(input())
A = np.array(list(map(int, input().split())))

ans = (A-1).sum()
print(ans)
import sys,bisect
input=sys.stdin.readline

N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[0 for i in range(100001)] for i in range(2**9)]
for i in range(vw[1][1],100001):
    dp[1][i]=vw[1][0]
MAX=min(2**9,N+1)
for i in range(2,MAX):
    v,w=vw[i]
    for j in range(100001):
        dp[i][j]=max(dp[i//2][j],(dp[i//2][j-w]+v)*(j>=w))

temp=[[0,0] for i in range(2**9)]

def solve(v,L):
    t=[]
    while v>=2**9:
        t.append(vw[v])
        v//=2
    n=len(t)
    for i in range(1,2**n):
        m=i.bit_length()
        temp[i][0]=temp[i-2**(m-1)][0]+t[m-1][0]
        temp[i][1]=temp[i-2**(m-1)][1]+t[m-1][1]
    ans=0
    for i in range(2**n):
        if L>=temp[i][1]:
            ans=max(ans,temp[i][0]+dp[v][L-temp[i][1]])
    return ans

def main():
    for i in range(int(input())):
        print(solve(map(int,input().split())))

if __name__=="__main__":
    main()



### FIXED CODE ###

import sys,random,time,bisect
input=sys.stdin.buffer.readline

start=time.time()
N=int(input())
vw=[(-1,-1)]
for i in range(N):
    vw.append(tuple(map(int,input().split())))

dp=[[] for i in range(2**9)]
def make_dp(v):
    t=[[0,0] for i in range(15)]
    V=v
    id=0
    while v>=1:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    temp=[[0,0] for i in range(2**n)]
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]
    temp.sort(key=lambda x:x[1])
    for i in range(1,2**n):
        temp[i][0]=max(temp[i][0],temp[i-1][0])

    dp[V]=[0]*(10**5+1)
    for i in range(2**n-1):
        L=temp[i][1]
        R=temp[i+1][1]
        if L>10**5:
            break
        elif R>10**5:
            R=10**5+1
        for j in range(L,R):
            dp[V][j]=temp[i][0]
    else:
        L=temp[-1][1]
        if L<=10**5:
            for j in range(L,10**5+1):
                dp[V][j]=temp[-1][0]

MAX=min(2**9,N+1)
for i in range(1,MAX):
    make_dp(i)

Q=int(input())
query=[[] for i in range(N+1)]
for i in range(Q):
    v,L=map(int,input().split())
    query[v].append((L,i))

ans=[0]*Q
temp=[[0,0] for i in range(2**9)]
t=[[0,0] for i in range(15)]
def solve(v):
    V=v
    id=0
    while v>=2**9:
        t[id]=vw[v]
        id+=1
        v//=2
    n=id
    for i in range(n):
        for j in range(2**i,2**(i+1)):
            temp[j][0]=temp[j-2**i][0]+t[i][0]
            temp[j][1]=temp[j-2**i][1]+t[i][1]

    for L,ID in query[V]:
        res=0
        for i in range(2**n):
            if L>=temp[i][1]:
                res=max(res,temp[i][0]+dp[v][L-temp[i][1]])
        ans[ID]=res

for i in range(1,N+1):
    if query[i]:
        solve(i)

for i in range(Q):
    print(ans[i])
X,K,D = map(int,input().split())
if X > 0:
  if X // D >= K:
    ans = X - D*K
  else:
    K -= X//D
    X = X%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X < 0:
  if -1*X // D >= K:
    ans = abs(X + D*K)
  else:
    K -= X//D
    X = (-1*X)%D
    if K%2 == 0:
      ans = x
    else:
      ans = abs(X -D)
print(ans)

### FIXED CODE ###

X,K,D = map(int,input().split())
if X > 0:
  if X // D >= K:
    ans = X - D*K
  else:
    K -= X//D
    X = X%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X < 0:
  if -1*X // D >= K:
    ans = abs(X + D*K)
  else:
    K -= (-1*X)//D
    X = (-1*X)%D
    if K%2 == 0:
      ans = X
    else:
      ans = abs(X -D)
if X == 0:
  if K%2==0:
    ans = 0
  else:
    ans = D
print(ans)
H, N = map(int, input().split())
L= list(map(int, input().split())

if sum(L) >= H:
	print('Yes')
else:
	print('No')

### FIXED CODE ###

H, N = map(int, input().split())
L= list(map(int, input().split()))
 
if sum(L) >= H:
	print('Yes')
else:
	print('No')
x,y,z=map(int,input().split())
print(z+' '+x+' '+y)

### FIXED CODE ###

x,y,z=map(str,input().split())
a=[z,x,y]
print(' '.join(a))
import sys

n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
dif = []
pos = []
ans = 0

if n >= m:
    print(0)
    sys.exit(1)

for i in range(m - 1):
    dif.append([x[i + 1] - x[i], i])

dif.sort(reverse = True)

for i in range(n - 1):
    pos.append(dif[i][1])

pos.sort()

ans += x[pos[0]] - x[0]
for i in range(n - 2):
    ans += x[pos[i + 1]] - x[pos[i] + 1]
ans += x[m - 1] - x[pos[-1] + 1]

print(ans)


### FIXED CODE ###

n, m = map(int, input().split())
x = sorted(list(map(int, input().split())))
dif = []
pos = []
ans = 0

if n >= m:
    print(0)
elif n == 1:
    print(x[-1] - x[0])
else:
    for i in range(m - 1):
        dif.append([x[i + 1] - x[i], i])

    dif.sort(reverse = True)

    for i in range(n - 1):
        pos.append(dif[i][1])

    pos.sort()

    ans += x[pos[0]] - x[0]
    for i in range(n - 2):
        ans += x[pos[i + 1]] - x[pos[i] + 1]
    ans += x[m - 1] - x[pos[-1] + 1]

    print(ans)
#coding :utf-8
S=input(">")
if (S==sss):
    print(3)
elif(S==ssr):
    print(2)
elif(S==srs):
    print(1)
elif(S==rss):
    print(1)
elif(S==srr):
    print(2)
elif(S==rsr):
    print(1)
elif(S==rrs):
    print(2)
else:
    print(0)

### FIXED CODE ###

S=input()
if S=="SSS":
    print(0)
elif S=="SSR":
    print(1)
elif S=="SRS":
    print(1)
elif S=="RSS":
    print(1)
elif S=="SRR":
    print(2)
elif S=="RSR":
    print(1)
elif S=="RRS":
    print(2)
else:
    print(3)
n=int(input())
#X=[]
#L=[]
A=[]
B=[]
for _ in range(n):
    x,l=map(int,input().split())
    X.append(x)
    L.append(l)
    A.append(x-l)
    B.append(x+l)
k = zip(A,B,L)
k = sorted(k, key=lambda x:(x[0], x[2]))
c=1
ans=[]
ans.append((k[0][0],k[0][1]))

max_=k[0][1]
def judge(x,L):
    for l in L:
        if x[1]>l[0] and x[0] <l[1]:
            return False
    else:
        return True
for i in range(1,n):
    x=(k[i][0],k[i][1])
    if x[0] >= max_:
        c+=1
        max_=x[0]
    #print(c,max_,x)
print(c)

### FIXED CODE ###

n=int(input())
itv=[]
for _ in range(n):
    x,l=map(int,input().split())
    itv.append((x+l,x-l))
itv.sort()
ass = 0
tt = -float("inf")
for i in range(n):
    if tt <= itv[i][1]:
        ass += 1
        tt = itv[i][0]
print(ass)