Harryxun/stf_run huggingface dataset:
def main():

    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    k = 10000
    ans2 = 0
    for i in range(k):
        t = 2*i*pi/k
        s = sin(t)
        c = cos(t)
        ans = [0, 0]
        for a, b in ab:
            if a*s+b*c >= 0:
                ans[0] += a
                ans[1] += b
        ans2 = max(ans2, ans[0]**2+ans[1]**2)
    print(ans2**0.5)


main()

### FIXED CODE ###

from math import*
def main():

    n = int(input())
    ab = [list(map(int, input().split())) for _ in [0]*n]
    k = 10000
    ans2 = 0
    for i in range(k):
        t = 2*i*pi/k
        s = sin(t)
        c = cos(t)
        ans = [0, 0]
        for a, b in ab:
            if a*s+b*c >= 0:
                ans[0] += a
                ans[1] += b
        ans2 = max(ans2, ans[0]**2+ans[1]**2)
    print(ans2**0.5)


main()
a = input()
a.sprit
if a[0] == a[1]:
    if a[1] == a[2]:
        print('yes')
    else:
        print('no')
else:
    print('no')

### FIXED CODE ###

a = input()
b = a.split()
if b[0] == b[1]:
    if b[1] == b[2]:
        print('Yes')
    else:
        print('No')
else:
    print('No')
from numba import njit
import numpy as np


def main(N, P):
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    que = []
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        que.append(player)
        for p in que:
            for i in (1, -1, N, -N):
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p-1]+sit[p-1] < d[p+i-1]:
                    d[p+i-1] = d[p-1]+sit[p-1]
                    que.append(player+i)
    print(count)


def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')
    cc.export('main', '(i8,i8[:])')(main)
    cc.compile()


if __name__ == '__main__':
    import sys
    if sys.argv[-1] == 'ONLINE_JUDGE':
        cc_export()
        exit(0)
    from my_module import main
    N = int(input())
    P = list(map(int, input().split()))
    main(N, P)


### FIXED CODE ###

from numba import njit
import numpy as np

@njit
def main(N, P):
    lista = [1, -1, N, -N]
    d = np.zeros((N, N), dtype=np.int32)
    d = d.ravel()
    sit = np.ones_like(d)
    stack = np.empty_like(d)
    count = 0
    for i in range(N*N):
        d[i] = min(i % N, (N-1-i) % N, i//N, N-1-i//N)
    for player in P:
        sit[player-1] = 0
        count += d[player-1]
        stack[0] = player
        num = 0
        while num >= 0:
            p = stack[num]
            num -= 1
            a = d[p-1]+sit[p-1]
            for i in lista:
                if p+i < 1 or p + i > N*N:
                    continue
                if d[p+i-1] > a:
                    d[p+i-1] = a
                    num += 1
                    stack[num] = p+i
    print(count)

N = int(input())
P = np.array(input().split(), np.int32)

main(N, P)
n = input()
max = -10**9
min = R[]

for i in range(0, n-1):
 R[i] = input()
 if R[i] <= min:
   min = R[i]
 if max <= R[i] - min:
  max = R[i] - min

print max

### FIXED CODE ###

n = input()
n_max = -(10**9)
n_min = input() 

for i in range(0, n-1):
 R = input()
 if n_max < R - n_min:
  n_max = R - n_min
 if R < n_min:
  n_min = R
 
print n_max
n=int(input())
if n<3:
    print(0)
    exit()
if n==3:
    print(1)
    exit()
s=input()
s=[int(i)+1 for i in s]
l=[int(i) for i in s]
l1=[0]*(n+16) 
l2=[0]*(n+13)
l3=[0]*(n+12)
l2[n-1]=1 
l3[s[n-1]-1]=1 
k=3 
for i in range(n-2,-1,-1): 
    l2[i]=l2[i+1]
    if l3[s[i]-1]==0:
        l2[i]+=1 
        l3[s[i]-1]=1 
for j in range(1,k):
    l3=[0]*n 
    l1[n-1]=0 
    for i in range(n-2,-1,-1) : 
        l1[i]=l1[i+1]
        l1[i]=l1[i]+l2[i+1]
        l1[i]=l1[i]-l3[s[i]-1]
        l3[s[i]-1]=l2[i+1]
    l2=l1[:]
print(l1[0])

### FIXED CODE ###

n=int(input())
if n<3:
    print(0)
    exit()
if n==3:
    print(1)
    exit()
s=input()
s=[int(i)+1 for i in s]
l=[int(i) for i in s]
l1=[0]*(n+16) 
l2=[0]*(n+13)
l3=[0]*(n+12)
l2[n-1]=1 
l3[s[n-1]-1]=1 
k=3 
for i in range(n-2,-1,-1): 
    l2[i]=l2[i+1]
    if l3[s[i]-1]==0:
        l2[i]+=1 
        l3[s[i]-1]=1 
for j in range(1,k):
    l3=[0]*(n+18)
    l1[n-1]=0 
    for i in range(n-2,-1,-1) : 
        l1[i]=l1[i+1]
        l1[i]=l1[i]+l2[i+1]
        l1[i]=l1[i]-l3[s[i]-1]
        l3[s[i]-1]=l2[i+1]
    l2=l1[:]
print(l1[0])
in_list = list(map(int,input().split()))
a = in_list[0]
b = in_list[1]
c = in_list[2]
if 0 < (c*c - 2*a*b + a*a - 2*b*c + b*b - 2*c*a):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

str_K = input()
k = int(str_K)
tmp_list = [1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51]
print(tmp_list[k-1])
a,b = map(int,input().split())
print(100*b+pow(2,m)*1900)

### FIXED CODE ###

a,b = map(int,input().split())
print(100*(a-b)*pow(2,b)+pow(2,b)*1900*b)
N = int(input())
L = sorted([int(_) for _ in input().split()])
if L[N - 1] < sum(L[:N - 1]):
    print('Yes')
else:
    print('No')

### FIXED CODE ###

T, X = map(int, input().split())
print(T / X)
A, B, C, D = map(int, input().split())
print(min(A, B)+min(C, D))

### FIXED CODE ###

A, B, C, D = [int(input()) for i in range (4)]
print(min(A, B)+min(C, D))
n = int(input())
h = list(map(int, input().split()))

ans = 1
if h[0] < h[1]:
  ans += 1

for i in range(2,n):
  if h[0] <= h[i]:
    if h[1] <= h[i]:
      if h[i-1] <= h[i]:
        ans += 1
print(ans)

### FIXED CODE ###

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

ans = 1
if len(h) >= 2:
  if h[0] <= h[1]:
    ans += 1
  for i in range(2,n):
    isCount = True
    if h[0] <= h[i]:
      if h[1] <= h[i]:
      	for j in range(1,i):
          if h[j] > h[i]:
          	isCount = False
      	if isCount:
          ans += 1
print(ans)
n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.rempve(x)
print(len(ans))

### FIXED CODE ###

n,m=map(int,input().split())
a=[1]*n
ans=set([1])
for i in range(m):
  x,y=map(int,input().split())
  if a[x-1]==0:continue
  else:
    a[x-1]-=1
    a[y-1]+=1
    if x in ans:
      ans.add(y)
      if a[x-1]==0:ans.remove(x)
print(len(ans))
s = input()
n = len(s)
a = [B,D,E,F,H,I,J,K,L,M,N,O,P,Q,R,S,U,V,W,X,Y,Z]
cnt = []
for i in range(n):
    for j in range(i,n+1):
    	fr = s[i;j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))

### FIXED CODE ###

s = input()
n = len(s)
a = "BDEFHIJKLMNOPQRSUVWXYZ"
cnt = []
for i in range(0, n):
    for j in range(i,n+1):
    	fr = s[i:j]
    	value = 1
    	for k in a:
    		if k in fr:
    			value = 0
    	if value:
    		cnt.append(len(fr))
    		
print(max(cnt))
# -*- coding: utf-8 -*-

S = input()

for i in range(len(S)):
    if S[i] == S[i+1]:
        print('Bad')
        break
else:
    print('Good')


### FIXED CODE ###

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

S = input()

for i in range(len(S)-1):
    if S[i] == S[i+1]:
        print('Bad')
        break
else:
    print('Good')
from collections import Counter
N = int(input())
Ac = Counter(list(map(int, input().split())))

ans = []
for k in sorted(Ac.keys())[::-1]:
  if len(ans) == 2:
    break
  if Ac[k] >=4:
    if ans:
      ans.append(k)
    else:
      ans.append(k)
      ans.append(k)
  elif Ac[k] >= 2:
    ans.append(k)
print(ans[0]*ans[1])

### FIXED CODE ###

from collections import Counter
N = int(input())
Ac = Counter(list(map(int, input().split())))
over2 = [ele for ele in Ac.items() if ele[1]>=2]
if len(over2) == 0:
  print(0)
elif len(over2) == 1:
  if over2[0][1] >= 4:
    print(over2[0][0]**2)
else:
  over2.sort(reverse=True)
  if over2[0][1] >= 4:
    print(over2[0][0]**2)
  else:
    print(over2[0][0]*over2[1][0])
n=int(input());a=list(map(int,input().split()));ans=0
for i in range(n):
  if i+1=a[a[i]-1]:ans+=1
print(ans)

### FIXED CODE ###

n=int(input());a=list(map(int,input().split()));ans=0
for i in range(n):
  if i+1==a[a[i]-1]:ans+=1
print(ans//2)
INF = 10e9+7 
import scipy.misc as scm
n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]
indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

for i in range(1,n+2):
        print(int((scm.comb(n+1,i)-scm.comb(n-(l1-l0), i-1))%INF))


### FIXED CODE ###

INF = 10**9+7 

n = int(input())
a = list(map(int, input().split()))
s = set()
result = [x for x in a if x in s or s.add(x)]
indexes = [i for i, x in enumerate(a) if x == result[0]]
l0 = indexes[0]+1
l1 = indexes[1] +1

def bin_pow(a,n):
    ans = 1
    mag = a
    while(n>0):
        if n%2==0:
            mag = (mag*mag)%INF
            n /= 2
        else:        
            ans = ans* mag%INF
            n -= 1
    return ans

factorial = [0]*(n+2)
inverse_factorial = [0] * (n+2)

factorial[0] = 1
for i in range(1, n+2):
    factorial[i] = factorial[i-1] * i % INF

inverse_factorial[n+1] = bin_pow(factorial[n+1], INF-2)
for i in range(n,-1,-1):
    inverse_factorial[i] = (inverse_factorial[i+1]*(i+1))%INF

def combi(n, r):
    if n < 0 or r < 0 or n < r:
        return 0
    return (factorial[n] * inverse_factorial[r] )%INF * (inverse_factorial[n-r]% INF)

for i in range(1,n+2):
    print((combi(n+1,i)-combi(n-(l1-l0), i-1) )%INF)
f = True
while True:
    if f:
        C = C - B
        f = False
    else:
        A = A - D
        f = True
    if A <= 0:
        print('No')
        break
    elif C <= 0:
        print('Yes')
        break
    else:
        continue



### FIXED CODE ###

A,B,C,D = (int(x) for x in input().split())
f = True
while True:
    if f:
        C = C - B
        f = False
    else:
        A = A - D
        f = True
    if A <= 0:
        print('No')
        break
    elif C <= 0:
        print('Yes')
        break
    else:
        continue
N,M = map(int,input().split())
num_c = N*2 + M
num_Scc = num_c//4
print(num_Scc)


### FIXED CODE ###

N = int(input())
x = 0
y = 0
for i in range(1,N+1):
    x += 800
    if (i%15 == 0):
        y += 200
print(x-y)
N = int(input())
A = [int(input()) for _ in range(N)]
A_sort = sorted(A)
for i in range(N) :
    if a[i] == a[-1] :
        print(a[-2])
    else :
        print(a[-1])

### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
A_sort = sorted(A)
for i in range(N) :
    if A[i] == A_sort[-1] :
        print(A_sort[-2])
    else :
        print(A_sort[-1])
literal = ('a', 'b', 'c', 'd', 'e', 'f', 
           'g', 'h', 'i', 'j', 'k', 'l', 
           'm', 'n', 'o', 'p', 'q', 'r', 
           's', 't', 'u', 'v', 'w', 'x', 
           'y', 'z')
x = int(input())
str2 = ''
str3 = ''
q = x
while q > 26:
    q, mod = divmod(x, 26)
    str1 = ''
    if q > 26:
        x = q
        str1 = literal[mod - 1]
        str3 = str1 + str2
        str2 = str3
        str3 = ''
    else:
        str1 += literal[q - 1]
        str1 += literal[mod - 1]
        str3 = str1 + str2
print(str3)

### FIXED CODE ###

a = input()
if a.islower():
    print('a')
else:
    print('A')
values = [int(input()) for i in range(int(input()))]
maxv = -1000000
minv = values[0]

for val in enumerate(values):
    if (val - minv) > maxv:
        maxv = val - minv
print(maxv)


### FIXED CODE ###

values = [int(input()) for _ in range(int(input()))]
maxv = values[1] - values[0]
minv = values[0]

for val in values[1:]:
    maxv = max(maxv, val - minv)
    minv = min(minv, val)         # 今までの最小値を保持(自分と自分を比較しない様に、最大値の評価後に計算)
print(maxv)
n, k = map(int, input())

tree = [int(input()) for i in range(n)]
tree.sort()

res = (tree(i+k-1) - tree(i) for i range(n-k+11)
print(min(res))

### FIXED CODE ###

n, k = map(int, input().split())

tree = [int(input()) for i in range(n)]
tree.sort()

res = (tree[i+k-1] - tree[i] for i in range(n-k+1))
print(min(res))
from math import log2, ceil

A,B = map(int,input().split())
N = B - A + 1

#class A
ng = N // 2
ng %= 2
ans = ng ^ (B & 1)

for i in range(2,ceil(log2(B)) + 2):
  #class B
  K = N % pow(2,i)
  A_bit = int((A & pow(2,i-1)) > 0)
  next_multiple_dist = ceil(A / pow(2,i-1)) * pow(2,i-1) - A
  if next_multiple_dist == 0:
    next_multiple_dist = pow(2,i-1)
  
  #010
  if A_bit == 0:
    if next_multiple_dist < K:
      K -= next_multiple_dist
      next_multiple_dist = pow(2,i-1)
      ans += pow(2,i-1) * (min(K,next_multiple_dist) % 2)
  #101
  else:
    if next_multiple_dist < K:
      num_1 = next_multiple_dist
      K -= next_multiple_dist
      next_multiple_dist = pow(2,i-1)

      if next_multiple_dist < K:
        num_1 += K - next_multiple_dist

      ans += pow(2,i-1) * (num_1 % 2)
    else:
      ans += pow(2,i-1) * (K % 2)  

if A == B:
  print(A)
else:
  print(ans)


### FIXED CODE ###

def F(N): return ((N + 1) // 2) % 2 if N & 1 else ((N // 2) % 2) ^ N
A,B = map(int,input().split())
print(F(A-1) ^ F(B))
N, M, X, Y = tuple(map(int, input().split()))
area_X = [int(x) for x in inut().split()]
area_Y = [int(x) for x in inut().split()]
area_X.append(X)
area_Y.append(Y)

print('No War' if max(area_X) < min(area_Y) else 'War')


### FIXED CODE ###

N, M, X, Y = tuple(map(int, input().split()))
area_X = [int(x) for x in input().split()]
area_Y = [int(x) for x in input().split()]
area_X.append(X)
area_Y.append(Y)

print('No War' if max(area_X) < min(area_Y) else 'War')
import math
A,B,C,D = map(int,input().split())

def lcm(C, D):
    return (C * D) // math.gcd(C, D)

lcm_C_D = lcm(C,D)
rem_C = lcm_C_D // C
rem_D = lcm_C_D // D

lcm_count = rem_C + rem_D - 1


rem_A = A % lcm_C_D
dif_A = lcm_C_D - rem_A
count_A_C = dif_A // C
count_A_D = dif_A // D
before_count = count_A_C + count_A_D + 1



dif_B = B % lcm_C_D
count_B_C = dif_B // C
count_B_D = dif_B // D
after_count = count_B_C + count_B_D 


syou_A = (A + dif_A) // lcm_C_D
syou_B = (B - dif_B) // lcm_C_D
between_count = (syou_B - syou_A) * lcm_count


print(B - A + 1 - (after_count + between_count + before_count))





### FIXED CODE ###

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

def gcd(a,b):
	while b!=0:
		a,b=b,a%b
	return a


lcm_C_D = (C * D) // gcd(C, D)
rem_C = lcm_C_D // C
rem_D = lcm_C_D // D

lcm_count = rem_C + rem_D - 1


rem_A = A % lcm_C_D
if rem_A != 0:
	dif_A = lcm_C_D - rem_A
	count_A_C = dif_A // C
	count_A_D = dif_A // D
	before_count = count_A_C + count_A_D + 1
else:
	before_count = 1
	dif_A = 0



dif_B = B % lcm_C_D
if dif_B != 0:
	count_B_C = dif_B // C
	count_B_D = dif_B // D
	after_count = count_B_C + count_B_D 
else:
	after_count = 0
	


syou_A = (A + dif_A) // lcm_C_D
syou_B = (B - dif_B) // lcm_C_D
between_count = (syou_B - syou_A) * lcm_count


print(B - A + 1 - (after_count + between_count + before_count))
w = raw_input()

sum = 0
while True:
    t = raw_input()
    if t == "END_OF_TEXT":
        break
    elif t == w
        sum += 1

print sum

### FIXED CODE ###

w = raw_input().lower()
sum = 0
while True:
    t = raw_input().split()
    if t[0] == "END_OF_TEXT":
        break
    else:
        for ti in t:
            if ti.lower() == w:
                sum += 1
print sum
a,b=map(input().split(""))

if a>b:
 print(a-1)
else:
 print(a)

### FIXED CODE ###

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

if a<=b:
    print(a)
else:
    print(a-1)
print (sys.argv[2]+ sys.argv[1])

### FIXED CODE ###

L,R = input().split()
k = R + L
print (k)
N = int(input())
for i in range(N+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')


### FIXED CODE ###

n=int(input())
for i in range(n+1):
    if int(i*1.08)==n:
        print(i)
        exit()
print(':(')
import sys
input=sys.stdin.readline
from bisect import bisect_left
n,q=map(int,input().split())
stop=[]
for i in range(n):
	s,t,x=map(int,input().split())
	stop.append((s,t,x))
stop.sort(key=lambda x:x[2])
d=[int(input())for i in range(q)]

ans=[-1]*q
for s,t,x in stop:
	l=bisect_left(d,s-x)
	r=bisect_left(d,t-x)
    for i in range(l, r):
		if ans == -1:
			ans[i] = x
            
for x in ans:
	print(x)

### FIXED CODE ###

import sys
input=sys.stdin.readline
from bisect import bisect_left
n,q=map(int,input().split())
stop=[]
for i in range(n):
	s,t,x=map(int,input().split())
	stop.append((s,t,x))
stop.sort(key=lambda x:x[2])
d=[int(input())for i in range(q)]
R=[-1]*q
ans=[-1]*q
for s,t,x in stop:
	#lからrにある区間のansをxに更新したい
	l=bisect_left(d,s-x)
	r=bisect_left(d,t-x)
	while l<r:
		if R[l]==-1:#最左がまだ確定していない場合
			ans[l]=x
			R[l]=r
			l+=1
		else:
			l=R[l]#確定しているところを飛ばす
for x in ans:
	print(x)
import sys
K = int(input())
A = [int(x) for x in input().split()]
A.reverse()
jmax, jmin = 2,2

if A[0] != 2:
    print(-1)
    sys.exit()


"""max"""
for i in range(0,K-1):
    drop_num = []
    for j in range(0,A[i]):  #脱落者数の候補を入れていく
        if ( jmax + j ) % A[i+1] == 0:
            drop_num.append(j)

        if drop_num == []:  #A[i]について一通り調べたのち脱落者数の候補がなければ終わる
            print(-1)
            sys.exit()

    max_drop = max(drop_num)
    jmax = jmax + max_drop

jmax = jmax + A[K-1] -1


"""min"""
for i in range(0,K-1):
    drop_num = []
    for j in range(0,A[i]):  #脱落者数の候補を入れていく
        if ( jmin + j ) % A[i+1] == 0:
            drop_num.append(j)

        if drop_num == []:  #A[i]について一通り調べたのち脱落者数の候補がなければ終わる
            print(-1)
            sys.exit()

    min_drop = min(drop_num)
    jmin = jmin + min_drop


print(jmin, jmax)

### FIXED CODE ###

N, A, B = map(int,input().split())
if (B-1-A) % 2 == 0:
    print("Borys")
else:
    print("Alice")
import sys
sys.setrecursionlimit(10 ** 7)

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

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

INF = 10 ** 10
dp = [INF] * 10 ** 5
H += [H[-1] * K]

dp[0] = 0

for i in range(N):
    for k in range(1, K + 1):
        if i + k <= N:
            dp[i + k] = min(dp[i + k], dp[i] + abs(H[i + k] - H[i]))


print(dp[N-1])


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 7)

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

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

INF = 10 ** 10
dp = [INF] * (10 ** 5 + 10)
H += [H[-1] * K]

dp[0] = 0

for i in range(N):
    for k in range(1, K + 1):
        if i + k <= N:
            dp[i + k] = min(dp[i + k], dp[i] + abs(H[i + k] - H[i]))


print(dp[N-1])
h, w= map(int, raw_input().split())
n = int(raw_input())
ais = map(int, raw_input().split())
ais.sort()
mat = [[-1 for _ in range(w)] for ii in range(h)]
import collections
color = 0
vis = set([])
def bfs(start, color, count, vis,mat):
	q = collections.deque([start])
	vis = set([start])
	while(count):
		count -=1
		cur = q.popleft()
		mat[cur[0]][cur[1]] = color + 1
		i,j = cur
		for ni,nj in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
			if 0 <= ni < len(mat) and 0<= nj < len(mat[0]):
				if (ni,nj) not in vis:
					vis.add((ni,nj))
					q.append((ni,nj))

for i in range(len(mat)):
	for j in range(len(mat[0])):
		if mat[i][j]==-1:
			bfs((i,j), color, ais[color], vis,mat)
			color +=1

for l in mat:
	print ' '.join(map(str,l))

### FIXED CODE ###


h, w= map(int, raw_input().split())
n = int(raw_input())
ais = map(int, raw_input().split())
mat = [[-1 for _ in range(w)] for ii in range(h)]
import collections
color = 0
vis = set([])
def bfs(start, color, count,mat):
	q = collections.deque([start])
	vis = set([start])
	while(q and count):
		count -=1
		cur = q.popleft()
		mat[cur[0]][cur[1]] = color + 1
		i,j = cur
		for ni,nj in [(i-1,j),(i+1,j),(i,j-1),(i,j+1)]:
			if 0 <= ni < len(mat) and 0<= nj < len(mat[0]):
				if (ni,nj) not in vis:
					vis.add((ni,nj))
					q.append((ni,nj))

for i in range(len(mat)):
	for j in range(len(mat[0]))[::(-1 if i % 2 else 1)]:
		mat[i][j] = color +1
		ais[color] -= 1
		if ais[color] == 0: color +=1
for l in mat:
	print ' '.join(map(str,l))
a,b,c=map(int,input().split())
if a**2+b**2+c**2-2*a*b-2*b*c-2*c*a>0:
  if c-a-b>:
  print('Yes')
  else:
    print('No')
else:
  print ('No')


### FIXED CODE ###

a,b,c=map(int,input().split())
if a**2+b**2+c**2-2*a*b-2*b*c-2*c*a>0:
  if c-a-b>0:
    print('Yes')
  else:
    print('No')
else:
  print ('No')
N, M = map(int, input().split())
S = []
for i in range(M):
     a, b = map(int, input().split())
    S.append([a, b])
    
from operator import itemgetter
S = sorted(S, key=itemgetter(1))
ans = 0
last = -1*float('Inf')
for si in S:
    if si[0] >= last:
        ans += 1
        last = si[1]
print(ans)

### FIXED CODE ###

from operator import itemgetter

n, m = map(int, input().split())

# 区間の終端でソート
ab = sorted([tuple(map(int, input().split())) for i in range(m)], key=itemgetter(1))
# 前回除いた橋
removed = -1
ans = 0

for a, b in ab:
    # a が removed より大きい = まだ取り除いてない
    if a > removed:
        removed = b - 1
        ans += 1

print(ans)
N,M=map(int,input().split())
H = list(map(int,input().split()))
A = [0]*M
B = [0]*M
for i in range(M):
  A[i],B[i]=map(int,input().split())
c = 0
p=[0]*N
for i in range(1,N+1):
  if i not in A and i not in B:
    c = c+1
  else:
    for j in range(1,M+1):
      if i == A[j-1]:
        if H[A[j-1]-1] > H[B[j-1]-1]:
          p[i-1] = p[i-1]+1
      if i == B[j-1]:
        if H[B[j-1]-1] > H[A[j-1]-1]:
          p[i-1] = p[i-1]+1
    if p[i-1] == A.count(i)+B.count(i):
      c =c+1
print(c)

### FIXED CODE ###

x = input()
if x == "ABC":
  print("ARC")
else:
  print("ABC")
N, Q = map(int, input().split())
path = [list() for _ in range(N+1)]
for _ in range(N-1):
    a, b = map(int, input().split())
    path[a].append(b)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

nodes = [0]*(N+1)

def dfs(p, x, arr):
    arr[p] += x
    for loof in path[p]:
        dfs(loof, x, arr)

for op in px:
    dfs(op[0], op[1], nodes)

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

### FIXED CODE ###

import sys
sys.setrecursionlimit(400000)
N, Q = map(int, input().split())
paths = [list() for _ in range(N+1)] # paths[i] : 頂点iと繋がってる点を全て表す
for _ in range(N-1):
    a, b = map(int, input().split())
    paths[a].append(b)
    paths[b].append(a)
# ab = [list(map(int, input().split())) for _ in range(N-1)]
px = [list(map(int, input().split())) for _ in range(Q)]

ans = [0]*(N+1) # ans[i] : 頂点iについて答える値を格納

counters = [0]*(N+1) # そのノードの部分木に与える点数の総和を格納
for x in px:
    counters[x[0]] += x[1]

visit = [0]*(N+1) #dfsをする時に一度訪れた点に再訪しないための確認
def dfs(node, score, ans):
    visit[node] = 1 # 訪問したことを記録
    score += counters[node] # 自分の部分木に加点する分を加えて後世に残す
    ans[node] = score # 点数の記録
    for loof in paths[node]: # 自分と繋がってる各ノードについて
        if visit[loof] == 0: # まだ探索していなければ
            dfs(loof, score, ans) # 探索

dfs(1, 0, ans)
    

for i in range(1, N+1):
    print(ans[i])
#!/usr/bin/env python
 
# input
str1=input()
str2=input()
 
if str1 == str2[::-1]:
    print("YES")
else:
    print("NO")

### FIXED CODE ###

#!/usr/bin/env python

# input
str1=input()
str2=input()

if str1 == str2[::-1]:
    print("YES")
else:
    print("NO")
n, k = map(int,input().split())
n = str(n)
unlike = list(map(int,input().split()))
like = []
ans = ''
for i in range(1, 10):
    if i not in unlike:
        like.append(i)

for num in range(len(n)):
    for i in like:
        if n[0] == 9 and (9 not in like):
            ans += like[0]
            break
        if int(n[num]) <= i:
            ans += str(i)
            break
    if len(ans) != (num + 1):
        for j in like:
            if int(ans[num - 1]) < j:
                ans[num - 1] == j
                break
    if num == 0:
        like.insert(0,0)
print(ans)

### FIXED CODE ###

n, k = map(int,input().split())
unlike = list(map(int,input().split()))

while 1:
    for n_i in str(n):
        if int(n_i) in unlike:
            n += 1
            break
    else:
        print(n)
        break
n=int(input())
for i in range(7):
  print(i) if 2**i <= n < 2**(i+1)

### FIXED CODE ###

n=int(input())
for i in range(7):
  if 2**i<=n<2**(i+1):
    print(2**i)