Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-

"""
DP
"""

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

dp =[''] * (N+1)
dp[0] = 'P'

for i in range(1, N+1):
    dp[i] = 'B' + dp[i-1] + 'P' + dp[i-1] + 'B'

print(dp[N][:X].count('P'))


### FIXED CODE ###

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

"""
解説参考
・必要な値を出してから再帰で場合分け
"""

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

# まず、それぞれのレベルについて全体の厚さとパティの枚数を求める
A = [1] * (N+1)
P = [1] * (N+1)
for i in range(1, N+1):
    A[i] = A[i-1] * 2 + 3
    P[i] = P[i-1] * 2 + 1

# レベルn、食べる厚さx
def dfs(n, x):
    # レベル0まで来て食べる厚さが残ってればパティ1枚
    if n == 0:
        if x >= 1:
            return 1
        else:
            return 0
    # ひとつ前の総数 + 左端バンズ = 真ん中のパティの手前まで
    if x <= A[n-1] + 1:
        # 前のレベルを調べる(食べる厚さは左端バンズを引く)
        return dfs(n-1, x-1)
    # 食べる厚さが真ん中のパティまでより多い
    else:
        # ひとつ前の総取り + 真ん中 + 前のレベルを調べる
        # (食べる厚さは前半のひとつ前の分と、左端バンズと真ん中パティを引く)
        # ※右端バンズを食べる場合でも、最終的にn == 0で1を返す時xの残数が1多いだけなので考慮しなくていい
        return P[n-1] + 1 + dfs(n-1, x-A[n-1]-2)

print(dfs(N, X))
n = int(input())
lst = [int(input()) for _ in[0]*n]
visit = set()
current = 0
while True:
  visit.add(current)
  current = lst[current]
  if current == 2:
    print(len(visit) + 1)
    break
  if current in visit:
    print(-1)
    break
  

### FIXED CODE ###

def solve():
    n = int(input())
    lst = [int(input())-1 for _ in[0]*n]
    visit = set()
    current = 0
    while True:
        visit.add(current)
        current = lst[current]
        if current == 1:
            print(len(visit))
            break
        if current in visit:
            print(-1)
            break

if __name__=="__main__":
    solve()
import math
r= int(input())
print(r**2*math.pi, r*2*math.pi)


### FIXED CODE ###

import math
r = float(input())
print('{} {}'.format(r**2*math.pi, r*2*math.pi))
n,k = int(split(input()))
cnt=0
for i in range(1,n+1,2):
  cnt++

if (k<=cnt):
  print("YES")
else:
  print("NO")

### FIXED CODE ###

n,k = map(int,input().split())
cnt=0
for i in range(1,n+1,2):
  cnt += 1

if k <= cnt:
  print("YES")
else:
  print("NO")
a, b = input()
print(a*b)

### FIXED CODE ###

a, b = map(int, input().split())
print(a*b)
import math

R = input()
print(2 * math.pi * R)

### FIXED CODE ###

import sys
import math

R = input()
print(2.0 * math.pi * float(R))
import math

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

print(math.floor(ans))


### FIXED CODE ###

s=input().split()
a=int(s[0])
b=int(float(s[1])*1000) 
ans=a*b
print(ans//1000)
if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    # check first step
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            print('No')
            flag = False
            break
    if flag:
        print('Yes')

### FIXED CODE ###

if __name__ == '__main__':
    N = int(input())
    t = [None]*N
    x = [None]*N
    y = [None]*N
    for i in range(N):
        t[i], x[i], y[i] = map(int, input().split())
    flag=True
    # check first step
    if (t[0] - max(x[0], -x[0]) - max(y[0], -y[0])) %2 != 0 or t[0] < max(x[0], -x[0]) + max(y[0], -y[0]):
        print('No')
        flag = False
    
    for i in range(N-1):
        delta_t = t[i+1] - t[i]
        delta_x = x[i+1] - x[i]
        if delta_x < 0:
            delta_x = -delta_x
        delta_y = y[i+1] - y[i]
        if delta_y < 0:
            delta_y = -delta_y
        delta = delta_x + delta_y
        if (delta_t - delta) % 2 == 0 and delta_t >= delta:
            continue
        else:
            if flag:
                print('No')
                flag = False
            break
    if flag:
        print('Yes')
import itertools

def index(a, x):
    'Find leftmost index of item greater than or equal to x'
    i = bisect_left(a, x)
    if i != len(a):
        return i
    return False

def main():
    N = int(input())
    S = input()
    lst = list(S)

    a = []
    for i,j,k in itertools.combinations(range(N), 3):
        if i < j < k:
            s = int(str(lst[i])+str(lst[j])+str(lst[k]))

            idx = bisect_left(a, s)

            if idx == len(a):
                a.append(s)
            
            elif a[idx] != s:
                a.insert(idx, s)

    print(len(a))

if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    N = int(input())
    S = input()
    lst = list(S)

    a = ['{:03d}'.format(i) for i in range(1000)]
    count = 0
    for i in range(len(a)):
        m,n,o = 0,1,2
        s = list(a[i])
        while m < n < o < len(lst) :
            if s[0] != lst[m]:
                m += 1
                n += 1
                o += 1
            elif s[1] != lst[n]:
                n += 1
                o += 1
            elif s[2] != lst[o]:
                o += 1
            else:
                count += 1
                break

    print(count)

if __name__ == "__main__":
    main()
N, M = open(0).readline().split()
from collections import Counter
cnt = Counter(open(0).read().split())
for i in range(1,int(N)+1):
    print(cnt[str(i)])

### FIXED CODE ###

N, M, *cnt = open(0).read().split()
from collections import Counter
cnt = Counter(cnt)
for i in range(1,int(N)+1):
    print(cnt[str(i)])
import sys
N = int(input())
A = list(map(int, input().split()))
B = 1
for i in A:
    B = B * i
    if B >= 10 ** 18
        print(-1)
        sys.exit()
print(B)

### FIXED CODE ###

import sys
N = int(input())
A = list(map(int, input().split()))
if 0 in A:
    print(0)
    sys.exit()
B = 1
for i in A:
    B = B * i
    if B > 10 ** 18:
        print(-1)
        sys.exit()
print(B)
N,K=map(int, input().split())
#print(N,K)
D=[[0 for i in range(N)] for j in range(K)]
#print(D)

for i in range(K):
    d=int(input())
    #print("d=",d)
    S=list(map(int, input().split()))
    #print("S=",S)
    for j in range(d):
        #print(S[j])
        D[(d-1)][S[j]-1] = 1
#print(D)
a = [0, 0, 0]
for i in range(K):
    a=list(map(sum, zip(a, D[:][i])))
    #print(a)
#print(a)
ans = 0
for i in a:
    if i == 0:
        ans = ans + 1
print(ans)

### FIXED CODE ###

import numpy as np
N,K=map(int, input().split())
D = np.zeros((K, N))
for i in range(K):
    d=int(input())
    A=np.array(list(map(int, input().split())))
    for j in range(len(A)):
        D[i][A[j]-1] = 1
ans = D.sum(axis=0)
print(sum(ans == 0))
X,Y = map(str,input().split())
L = ["A","B","C","D","E","F"]
for i in range(6) :
    if L[i] == X :
        lx = i
    elif L[i] == Y :
        ly = i
if lx < ly :
    print("<")
elif lx > ly :
    print(">")
else :
    print("=")
    
    

### FIXED CODE ###

X,Y = map(str,input().split())
L = ["A","B","C","D","E","F"]
for i in range(6) :
    if L[i] == X :
        lx = i
    if L[i] == Y :
        ly = i
if lx < ly :
    print("<")
elif lx > ly :
    print(">")
else :
    print("=")
N = int(input())
H = list(map(int, input().split()))
res = 0
temp = 0
for i in range(N):
    if temp > res:
        res = temp
    if H[i] >= H[i+1]:
        temp += 1
    else :
        temp = 0
print(res)

### FIXED CODE ###

N = int(input())
H = list(map(int, input().split()))
k = 0
m = 0
for i in range(N):
    if k < m:
        k = m
    if i != N - 1 and H[i] >= H[i+1]:
        m += 1
    else:
        m =0
print(k)
H,W =[int(i) for i in input().split()]
if H*W=1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))


### FIXED CODE ###

H,W =[int(i) for i in input().split()]
if H*W==1:
    print(1)
elif H==1 and W!=1:
    print(max(0, W-2))
elif W==1 and H!=1:
    print(max(0, H-2))
else:
    print(max(H-2, 0)*max(W-2, 0))
n,k = map(int, input().split())
lst = [int(input()) for _ in range(n)]
lst.sort()
print(min(h[i + k - 1] - h[i] for i in range(n - k + 1)))


### FIXED CODE ###

n,k = map(int, input().split())
lst = [int(input()) for _ in range(n)]
lst.sort()
print(min(lst[i + k - 1] - lst[i] for i in range(n - k + 1)))
str(input())
n = int(n[-1]) 

if n == 3:
    print('bon')
elif n in [0, 1, 6, 8]:
    print('pon')
else:
    print('hon')

### FIXED CODE ###

N = str(input())
last_num = int(N[-1]) 
 
if last_num == 3:
    print("bon")
elif last_num in [0, 1, 6, 8]:
    print("pon")
else:
    print("hon")
A, B, C, D = int(input())

if D >= A + C:
    print("Yes")
elif D >= A + B:
    print("Yes")
else:
    print("No")

### FIXED CODE ###

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

if abs(A - C) <= D:
    print("Yes")
elif abs(A - B) <= D and abs(B - C) <= D:
    print("Yes")
else:
    print("No")
# ABC 120 D

from collections import deque

def resolve():
    N, M = map(int, input().split())
    bridges = []
    for i in range(M):
        a, b = map(int, input().split())
        bridges.append([a, b])

    par = [i for i in range(N+1)]
    nums = [1] * (N+1)

    # x の根を求める
    def root(x):
        if par[x] == x:
            return x
        par[x] = root(par[x])  # 経路圧縮
        return par[x]

    # x と y の属する集合を併合
    # 便利になった数を返す
    def unite(x, y):
        x = root(x)
        y = root(y)
        if x == y:
            return
        par[x] = y
        conv = nums[x] * nums[y]
        nums[y] += nums[x]
        nums[x] = 0
        return conv

    # A[M-1] から順に橋をかけていく
    answers = [0] * M
    answers[M-1] = N*(N-1) // 2

    for i in range(M-1, 0, -1):
        a, b = bridges[i]
        if root(a) == root(b):  # 既に同じグループにいれば何もしない
            continue

        # 違うグループにいる場合はグループ同士を結合する
        conv = unite(a, b)
        answers[i-1] = answers[i] - conv

    for i in answers:
        print(i)


if __name__ == "__main__":
    resolve()


### FIXED CODE ###

# ABC 120 D

from collections import deque

class UnionFind():
    # n : 要素数
    def __init__(self, n):
        self.n = n
        # root[x] < 0 ならそのノードが根かつその値が木の要素数
        # root[x] > 0 ならそのノードが根
        self.root = [-1] * (n+1)
        # 木の高さの管理
        self.rnk = [0] * (n+1)

    # x が所属するグループの根を返す
    def findRoot(self, x):
        if self.root[x] < 0:
            return x
        else:
            self.root[x] = self.findRoot(self.root[x])  # 経路圧縮
            return self.root[x]

    # x と y がそれぞれ所属するグループを結合する
    def unite(self, x, y):
        x = self.findRoot(x)
        y = self.findRoot(y)
        if x == y:
            # 既に同じグループに所属していれば何もしない
            return
        elif self.rnk[x] > self.rnk[y]:    # x の方が高さがある場合
            self.root[x] += self.root[y]   # x の要素数に y の要素数を足す
            self.root[y] = x               # y の親を x にする
        else:
            self.root[y] += self.root[x]
            self.root[x] = y
            if self.rnk[x] == self.rnk[y]:
                self.rnk[y] += 1

    def isSameGroup(self, x, y):
        return self.findRoot(x) == self.findRoot(y)

    def count(self, x):
        return -self.root[self.findRoot(x)]

def resolve():
    N, M = map(int, input().split())
    AB = [list(map(int, input().split())) for _ in range(M)]

    AB = AB[::-1]

    ret = []

    uf = UnionFind(N)

    for a, b in AB:
        if uf.isSameGroup(a-1, b-1):
            ret.append(0)
        else:
            ret.append(uf.count(a-1) * uf.count(b-1))
            uf.unite(a-1, b-1)

    ans = 0
    for i in range(M-1, -1, -1):
        ans += ret[i]
        print(ans)

if __name__ == "__main__":
    resolve()
N,K = map(int,input().split())
S = list(map(int,input()))
blobs = []
if S[0] == 0:
    blobs.append(0)
cnt = 0
past_i = 0
for i in range(len(S)):
    if i == 0:
        past_i = S[i]
    if past_i == S[i]:
        cnt += 1
    else:
        blobs.append(cnt)
        cnt = 1
        past_i = S[i]
if S[-1] == 0:
    blobs.append(0)
sums = []
for i in range(len(blobs)//2):
    sums.append(sum(blobs[2*i:2*(i+K+1)]))
print(max(sums))
    

### FIXED CODE ###

N,K = map(int,input().split())
S = input()
one = [0]
zero = [0]
if S[0] == '0':
    one.append(0)
cnt = 1
for i in range(1,len(S)):
    if S[i] != S[i-1]:
        if S[i-1] == '1':
            one.append(cnt+one[-1])                
        else:
            zero.append(cnt+zero[-1])                
        cnt = 1
    else:
        cnt += 1
else:
    if S[-1] == '1':
        one.append(cnt+one[-1])                
    else:
        zero.append(cnt+zero[-1])                
        one.append(one[-1])                
window_size = min(len(zero)-1,K)
MAX = 0
for i in range(len(zero)-window_size):
    if MAX < (zero[i+window_size] - zero[i]) + (one[i+window_size+1] - one[i]):
        MAX = (zero[i+window_size] - zero[i]) + (one[i+window_size+1] - one[i])

print(MAX)
n,m,l = map(int,input().split(" "))
Ns = input().split(" ")
N = [int (n) for n in Ns]
Ms = input().split(" ")
M = [int(n) for n in Ms]
#print(n,m,l)
#print(N,M)
i = 0
j = 0
total = 0
cnt = 0
while total <= l:
  if  N[i] <= M[j]:
    total = total + N[i]
    i = i+1
    cnt = cnt +1
  else:
    total = total + M[j]
    j = j+1
    cnt = cnt +1
print(cnt-1)

### FIXED CODE ###

N,M,K = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
a,b = [0],[0]
for i in range(N):
  a.append(a[i]+A[i])
for j in range(M):
  b.append(b[j]+B[j])
ans = 0
#print(a,b,N+1)
j = M
for i in range(N+1):
  if a[i] > K:
    break

  while K - a[i] < b[j]:
    j = j-1
  ans = max(ans,i+j)

print(ans)
, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)


### FIXED CODE ###

N, M = [int(x) for x in input().split()]
K = [[0]*N]*M
for i in range(M):
  K[i] = [int(x) for x in input().split()]
P = [int(x) for x in input().split()]
total = 0
for i in range(2 ** N):
    lamp = [0] * N
    for j in range(N):
        if ((i >> j) & 1):
            lamp[j] = 1
    flag = True
    for x in range(M):
      result = 0
      for y in K[x][1:]:
        if lamp[y-1] == 1:
          result += 1
      result %= 2
      if result != P[x]:
        flag = False
    if flag:
      total += 1
print(total)
a = input()
b = 0
if a == "SAT"
    b = 1
if a == "SUN"
    b = 7
if a == "MON"
    b = 6
if a == "TUE"
    b = 5
if a == "WED"
    b = 4
if a == "THU"
    b = 3
if a == "FRI"
    b = 2
print(b)

### FIXED CODE ###

a = input()
b = 0
if a == "SAT":
    b = 1
if a == "SUN":
    b = 7
if a == "MON":
    b = 6
if a == "TUE":
    b = 5
if a == "WED":
    b = 4
if a == "THU":
    b = 3
if a == "FRI":
    b = 2
print(b)
n = int(input())
print(n＊180 - 360)

### FIXED CODE ###

n = int(input())
print((n - 2) * 180)
from collections import Counter
n,p=map(int,input().split())
s=input()[::-1]
a=0
t=0
d=1
m=[0]*p
m=[0]
for i in range(n):
  x=int(s[i])*d%p
  m.append((m[-1]+x)%p)
  d=(d*10)%p
c=Counter(m)
for i,j in c.items():
  a+=j*(j-1)//2

if p==2 or p==5:
  a=0
  for i in range(n):
    if s[n-1-i]%p==0:
      a+=n-1-i
  print(a)
else:
  print(a)


### FIXED CODE ###

from collections import Counter
n,p=map(int,input().split())
s=input()[::-1]
a=0
t=0
d=1
m=[0]*p
m=[0]
for i in range(n):
  x=int(s[i])*d%p
  m.append((m[-1]+x)%p)
  d=(d*10)%p
c=Counter(m)
for i,j in c.items():
  a+=j*(j-1)//2

if p==2 or p==5:
  a=0
  for i in range(n):
    x=int(s[i])
    if x%p==0:
      a+=n-i
  print(a)
else:
  print(a)
import bisect as bs
l=int(input())
lst=sorted(list(map(int,input().split())))
n=lst[l-1]
m=bs.bisect_left(lst,n)
if n/2 - lst[m] <= lst[m+1] -n/2:
  print(n,lst[m])
else:
  print(n,lst[m+1])



### FIXED CODE ###

import bisect as bs
l=int(input())
lst=sorted(list(map(int,input().split())))
n=lst[l-1]
lst[l-1]=float("inf")
m=bs.bisect_right(lst,n/2)
if n/2 - lst[m-1] <= lst[m] -n/2:
  print(n,lst[m-1])
else:
  print(n,lst[m])
import numpy as np
#かけて最小公倍数になる　そのために必要な数がB
from fractions import gcd
N=int(input())
mod=10**9+7
A=list(map(int, input().split()))
def lcm(a,b):
  return (a*b)/gcd(a,b)

LCM=lcm(A[0],A[1])
#LCM%=mod
for i in range(2,N):
  LCM=lcm(LCM, A[i])
  #LCM%=mod
  
#print(LCM)
ans=0
for a in A:
  ans+=LCM//a
  ans%=mod

print(int(ans%mod))



### FIXED CODE ###


#かけて最小公倍数になる　そのために必要な数がB
from fractions import gcd
N=int(input())
if N==1:
  print(1)
  exit()

mod=10**9+7
A=list(map(int, input().split()))
def lcm(a,b):
  return a//gcd(a,b)*b

if N==2:
  LCM=lcm(A[0],A[1])
  ans=((LCM//A[0])+(LCM//A[1]))%mod
  print(ans)
  exit()

LCM=1
#LCM%=mod
for a in A:
  LCM=lcm(LCM, a)
  #LCM%=mod
  
#print(LCM)
ans=0
for a in A:
  ans+=LCM//a
  #ans%=mod

print(int(ans%mod))
N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for i in range(M)]
PQ = [[int(_) for _ in input().split()] for i in range(Q)]

LR = sorted(LR)

W = []
x = 0
for i in range(N):
    while x < M and LR[x][0] < i:
        x += 1
    W.append(x)

from itertools import accumulate

for p, q in PQ:
    xs = LR[W[p]:]
    ys = [0] * (N+1)
    for x in xs:
        ys[x[1]] += 1
    zs = list(accumulate(ys))
    print(zs[q])



### FIXED CODE ###

N, M, Q = [int(_) for _ in input().split()]
LR = [[int(_) for _ in input().split()] for i in range(M)]
PQ = [[int(_) for _ in input().split()] for i in range(Q)]

from collections import defaultdict
from itertools import accumulate

C = [[0]*(N+1) for i in range(N+2)]

for l, r in LR:
    C[1][r] += 1
    C[l + 1][r] -= 1

#print(C)

T = [list(accumulate(row)) for row in C]
T = [list(accumulate(row)) for row in zip(*T)]

#print(T)

for p, q in PQ:
    print(T[q][p])
n=int(input())
a=list(map(int,input().split()))
b=set(a)
ans=0
for i in b:
  a.count(i)%2==1:
    ans+=1
print(ans)

### FIXED CODE ###

import collections
n=int(input())
lst=[int(input()) for i in range(n)]
xs=list(set(lst))
ans=0
lst=collections.Counter(lst)
for i in xs:
  if lst[i]%2==1:
    ans+=1

print(ans)
# -*- coding: utf-8 -*-
N,M=list(map(int,raw_input().split()))

nl=[[] for i in range(N+1)]
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)	
#print nl


def dfs(v,p):
	F[v]=1
	global bip_graph
	for i in nl[v]:
		#print v,i,color
		if color[v]=="w" and color[i]==0:
			color[i]="b"
		elif color[v]=="b" and color[i]==0:
			color[i]="w"				
		elif color[v]==color[i]:
			#二分木ではない
			bip_graph="NO"

		if bip_graph!="NO" and F[i]==0:
			#DFS(次の頂点i, 次に親となる頂点v, d+ 頂点vと頂点iの間の辺のコスト)
			dfs(i,v)


bip_graph="YES"
F=[0]*(N+1)
color=[0]*(N+1)
color[1]="b"
dfs(1,-1)
#print color
#print bip_graph

if bip_graph=="YES":
	print color.count("b")*color.count("w")-M
elif bip_graph=="NO":
	print N*(N-1)/2-M




### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
sys.setrecursionlimit(10**7)
N,M=list(map(int,raw_input().split()))

nl=[[] for i in range(N+1)]
for i in range(M):
	x,y=map(int,raw_input().split())
	nl[x].append(y)
	nl[y].append(x)	
#print nl


def dfs(v):
	F[v]=1
	for i in nl[v]:
		if color[v]=="w" and color[i]==0:
			color[i]="b"
		elif color[v]=="b" and color[i]==0:
			color[i]="w"				
		elif color[v]==color[i]:
			#２部グラフではない
			print N*(N-1)/2-M
			sys.exit()
		else:
			continue
		#print v,i,color,F
		
		if F[i]==0:
			dfs(i)


F=[0]*(N+1)
color=[0]*(N+1)
color[1]="w"
dfs(1)

#２部グラフの場合
print color.count("b")*color.count("w")-M
import sys
input = sys.stdin.readline
s = input()

if  a[0] == a[1] == a[2]:
    print("Np")
else:
    print("Yse")

### FIXED CODE ###

import sys
input = sys.stdin.readline
s = input()

if  s[0] == s[1] == s[2]:
    print("No")
else:
    print("Yes")
print min(abs(b-a-W), abs(b-a), abs(b+W-a), abs(b-a))

### FIXED CODE ###

W, a, b = map(int, raw_input().split())
if (a+W-b) * (a-b-W) < 0:
    print 0
else:
    print min(abs(b-a-W), abs(b-a), abs(b+W-a), abs(b-a))
a,b = map(int,input().split())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")


### FIXED CODE ###

a = int(input())
b = int(input())
if a > b:
  print("GREATER")
elif a == b:
  print("EQUAL")
else:
  print("LESS")
import functools, math

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

def lcm(a, b):
	return a * b // math.gcd(a, b)

def check(L, NM):
    res = []
    for i in range(NM):
        res.append(int(i*(L/NM)+1))
    return res

def check2(x, L, NM):
    return int((x-1)*NM/L)

L = lcm(N,M)
ans = L


a = list(set(check(L, N)) & set(check(L, M)))
for i in a:
    if S[check2(i, L, N)] != T[check2(i, L, M)]:
        ans = -1
        break
print(ans)

### FIXED CODE ###

import functools, fractions

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

def lcm(a, b):
	return a * b // fractions.gcd(a, b)

def check(L, NM):
    res = []
    for i in range(NM):
        res.append(int(i*(L/NM)+1))
    return res

def check2(x, L, NM):
    return int((x-1)*NM/L)

L = lcm(N,M)
ans = L


a = list(set(check(L, N)) & set(check(L, M)))
for i in a:
    if S[check2(i, L, N)] != T[check2(i, L, M)]:
        ans = -1
        break
print(ans)
n = int(input())
a = list(map(int,input().split()))

order = []


for i in range(1,n+1):
    order.append(a.index(i)+1)
    

for i in range(n):
    order[i] = str(order[i])

print(' '.join(order))

### FIXED CODE ###

n = int(input())

c = 0
for i in range(1,n+1):
    if i % 2 != 0:
        c += 1

print(c/n)
import sys
from bisect import bisect_left

n, q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
    s, t, x = map(int, line.split())
    c.append((x, s, t))
kkk.sort()
d = list(map(int, lines[n:]))

ans = [-1] * q
skip = [-1] * q
for x, s, t in k:
    ss = bisect_left(d, s - x)
    tt = bisect_left(d, t - x)
    while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss]
print(*ans,sep='\n')

### FIXED CODE ###

import sys
from bisect import bisect_left

n,q = map(int, input().split())
lines = sys.stdin.readlines()
c = []
for line in lines[:n]:
    s,t,x = map(int, line.split())
    c.append((x,s,t))
c.sort()
d = list(map(int,lines[n:]))

ans = [-1] * q
skip = [-1] * q
for x,s,t in c:
    ss = bisect_left(d,s-x)
    tt = bisect_left(d,t-x)
    while ss < tt:
        if skip[ss] == -1:
            ans[ss] = x
            skip[ss] = tt
            ss += 1
        else:
            ss = skip[ss]
print(*ans,sep='\n')
def g2():
    hw=[int(i) for i in input().split()]
    s=['.'+input()+'.' for i in range(hw[0])]
    s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
    for i in range(1,hw[1]+1):
        for n in range(1,hw[0]+1):
            if s[i][n]=='#':
                if s[i+1][n]=='.' and s[i][n+1]=='.' and s[i-1][n]=='.' and s[i][n-1]=='.':
                    print('No')
                    exit()
    print('Yes')
    exit()
print(g2())

### FIXED CODE ###

hw=[int(i) for i in input().split()]
s=['.'+input()+'.' for i in range(hw[0])]
s=['.'*(hw[1]+2)]+s+['.'*(hw[1]+2)]
for i in range(1,hw[0]+1):
    for n in range(1,hw[1]+1):
        if s[i][n]=='#':
            if s[i+1][n]==s[i][n+1]==s[i-1][n]==s[i][n-1]=='.':
                print('No')
                exit()
print('Yes')
import sys
input = sys.stdin.readline
def sol():
    n=int(input())
    new=[int(input()) for _ in [0]*n]
    a=[new[0]]
    for i in range(1,n):
        if a[-1]>=new[i]:a.append(new[i])
        else:
            for j in range(len(a)):
                if a[j]<new[i]:a[j]=new[i];break
    print(len(a))
sol()

### FIXED CODE ###

print(3*int(input())**2)
a,p = map(int,input().split())
if 3*a+b < 2:
  print(0)
elif (3*a+b) % 2 == 0:
  print((3*a+b)//2)
else:
  print((3*a+b-1)//2)

### FIXED CODE ###

a,p = map(int,input().split())
if 3*a+p < 2:
  print(0)
elif (3*a+p) % 2 == 0:
  print((3*a+p)//2)
else:
  print((3*a+p-1)//2)